
20 Jan
2009
20 Jan
'09
1:10 p.m.
Great, thanks! I'm enlightened :)
And no one had to hit you with a stick first!
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
?
At a glance they look the same to me — but only the first is accepted by ghc. There is also the GADT syntax:
data SomeNum where SomeNum :: forall a. (Typeable a, Num a) => a -> SomeNum
which is accepted by ghc with the LANGUAGE GADTs extension. The GADT is more than simple syntactic sugar, it allows for easier use this kind of existential type. -- Chris