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 :: {

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 wrote: > > 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 StandaloneDeriving #-} > {

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

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 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 >

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 cl

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 l