
23 Jun
2005
23 Jun
'05
2:16 p.m.
I was under the impression that, in ghc 6.4 at least, GADTs did just that: use information gained by matching on the
type constructor to refine types. I sort-of expected that the extension to pattern matching would follow.
Or is that a nice paper waiting to be written?
Jacques
Lennart Augustsson
A somewhat similar problem exists even without fields:
foo :: Either a b -> Either () b foo (Left _) = Left () foo x@(Right _) = x
Since Haskell type checking doesn't use the information gained by pattern matching to refine types we just have to accept that some perfectly safe programs don't type check.
-- Lennart