On Sat, May 18, 2013 at 9:11 AM, TP <[email protected]> wrote:
>
> So the following version does not work:
> ----------------------------------------
> [..]
> data Person :: Gender -> * where
> Dead :: Person Gender -- WHAT DO I PUT HERE
> Alive :: { name :: String
> , weight :: Float
> , father :: Person Gender } -> Person Gender
Here's the problem. In the line:
Dead :: Person Gender
you are referring to the Gender *type*, not the Gender kind.
To refer to the kind instead, change this to:
Dead :: forall (a :: Gender). Person a
This means "for all types A which have the kind Gender, I can give you
a Person with that type." The Alive declaration and deriving clause
can be fixed in a similar way.
Also, to enable the "forall" syntax, you need to add
{-# LANGUAGE ExplicitForAll #-}
at the top of the file.
Chris
--
Chris Wong, fixpoint conjurer
e: [email protected]
w: http://lfairy.github.io/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe