[Haskell-cafe] type inference and named fields
Lennart Augustsson
lennart at augustsson.net
Thu Jun 23 16:42:41 EDT 2005
It's true that GADTs does just that. But only if you use them.
And they are not part of Haskell. :)
-- Lennart
Jacques Carette wrote:
> 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 <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
mailing list