On Sat, May 18, 2013 at 9:11 AM, TP <paratribulati...@free.fr> 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: lambda.fa...@gmail.com
  w: http://lfairy.github.io/

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to