[Haskell-cafe] type inference and named fields
carette at mcmaster.ca
Thu Jun 23 14:16:50 EDT 2005
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?
Lennart Augustsson <lennart at augustsson.net> wrote:
> 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
More information about the Haskell-Cafe