[Haskell-cafe] type inference and named fields

Lennart Augustsson lennart at augustsson.net
Thu Jun 23 14:12:56 EDT 2005

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

Malcolm Wallace wrote:
> I have discovered something I believe to be a problem in Haskell'98,
> although it is not a simple bug as such - it has more of the flavour of
> an unintended mismatch in the interaction of two separate features.
> Since Haskell is deeply principled language, a feature conflict is
> extremely rare, and so worthy of note.

More information about the Haskell-Cafe mailing list