-
-
Save dminuoso/28a5b34a92e4dc050313827ed2470ef9 to your computer and use it in GitHub Desktop.
This file contains 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 TypeFamilies #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilyDependencies #-} | |
import Data.Typeable | |
data Mode = Field | Descr | |
newtype Tagged tag a = Tagged { runTagged :: a } | |
type family Inner mode field = r | r -> mode field where | |
Inner Field f = Maybe f | |
Inner Descr f = Tagged f String | |
data Pair l r = Pair l r | |
data ArgF (f :: Mode) = ArgF | |
{ field1 :: Inner f Char | |
, field2 :: Inner f Char | |
} | |
type Sel pat = forall mode. ArgF mode -> Inner mode pat | |
f :: Sel pat -> IO pat | |
f sel = undefined | |
g :: Sel () -> IO tok | |
g sel = do | |
f sel | |
undefined | |
describe :: forall a pat. (Typeable a, Tagged a String ~ Inner Descr pat) => Sel pat -> TypeRep | |
describe _ = typeOf (undefined :: a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment