Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-18 Thread TP
Chris Wong wrote: 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

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-18 Thread Denis Kasak
On 18 May 2013 11:16, TP paratribulati...@free.fr wrote: snip However, I have not managed to make the version with forall work. Below, the first occurrence of forall is ok, but the three following yield error. {-# LANGUAGE GADTs #-} {-# LANGUAGE

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-18 Thread TP
Denis Kasak wrote: Note that all of this would work even without explicit quantification since you have already specified that Person accepts an argument of kind Gender. In other words, this works as expected: data Person :: Gender - * where Dead :: Person a Alive :: { name ::

[Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-17 Thread TP
Hi everybody, I have a question about deriving automatically a Show instance when using GADT. It works in this situation: {-# LANGUAGE GADTs #-} data Male data Female data Person gender where Dead :: Person gender Alive :: { name :: String ,

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-17 Thread Adam Gundry
Hi TP, On 17/05/13 15:32, TP wrote: | [...] | | So I modify my code by removing deriving Show, and adding the line: | | instance Show (Person gender) | | | But now, I obtain: | | $ runghc test_show.hs | GHC stack-space overflow: current

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-17 Thread TP
Adam Gundry wrote: [...] To use standalone deriving, you need to write deriving instance Show (Person gender) and everything will work fine. By writing instance Show (Person gender) you are instead giving an instance with no methods, and the default methods in the Show class contain

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-17 Thread Chris Wong
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 ::