Created
November 26, 2014 14:01
-
-
Save jkarni/1513f1a4991c0cb5d9fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveDataTypeable #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| import Data.Typeable | |
| import Data.Data | |
| import Data.Proxy | |
| import GHC.TypeLits | |
| ---- vvv this still needs to be fixed | |
| data (path :: Symbol) :> b = Proxy path :> b | |
| data Post a = Post a | |
| deriving (Data, Typeable) | |
| clean :: forall str met. (KnownSymbol str, Data met) => (str :> met) -> String | |
| clean (Proxy :> y) = symbolVal p | |
| ++ (dataTypeName $ dataTypeOf y) | |
| where p :: Proxy str | |
| p = Proxy | |
| t1 :: "endpoint" :> Post String | |
| t1 = Proxy :> undefined | |
| main = print $ clean t1 | |
| --- prints | |
| --- > "endpointMain.Post" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment