haskell - How to solve conflicting instance in type families? -
I'm trying to do a 'UnMaybe' type of family but it does not compile (Example family conflict) .
Here is my code
{- # LANGUAGE typefiles # -} type family error one :: * type example UnMaybe (probably one) = a type of example UnMaybe a = A
error message
test.hs: 4: 16: Dispute on family matters declaration: type example UnMaybe (probably A) - test. Definition of hs: 4:16 Examples of examples UnMaybe a - defined at test.hs: 5: 15
I understand why this is not working, the same results get anyway Another way to do ( Or who will allow it to activate an extension?)
If you really need it, Then you can use a closed-type family (at least GHC 7.8 is required):
{- # language type Families # -} Type of family is a :: * Where the ray (probably A) = a unmeo A = a
now:
gcii> :kind! Random (maybe int) unexpected (maybe int) :: * = int ghci & gt; :kind! UnMaybe Bool UnMaybe Bool :: * = Bool
Comments
Post a Comment