type families + GADT = type unsafety?

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Sep 28 04:00:28 EDT 2007


Hello Stefan,

Friday, September 28, 2007, 1:10:09 AM, you wrote:

> data Foo a where
>    A :: Foo Int
>    B :: Foo Bool

> becomes

> data Foo a = (a ~ Int) => A | (a ~ Bool) => B

hm :)  this looks like my quasi-proposal of unifying data and function
definitions still has some meaning. i proposed to define GADTs as

data Foo Int  = A
     Foo Bool = B

but, with help of guards, this may be also written as

data Foo a | a==Int  = A
           | a==Bool = B

next step should be to add pattern guards? :)


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Glasgow-haskell-users mailing list