
23 Jun
2005
23 Jun
'05
2:12 p.m.
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.