-
-
Save dminuoso/9144f5a72f645896a8a9f7c3d90eb423 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 #-} | |
data Mode = Field | Descr | |
type family Inner mode field where | |
Inner Field f = f | |
Inner Descr 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 | |
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
foo.hs:25:5: error: | |
• Couldn't match type ‘Inner mode ()’ with ‘Inner mode a0’ | |
Expected type: ArgF mode -> Inner mode a0 | |
Actual type: ArgF mode -> Inner mode () | |
NB: ‘Inner’ is a non-injective type family | |
The type variable ‘a0’ is ambiguous | |
• In the first argument of ‘f’, namely ‘sel’ | |
In a stmt of a 'do' block: f sel | |
In the expression: | |
do f sel | |
undefined | |
| | |
25 | f sel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment