[Haskell-cafe] type inference and named fields

Jonathan Cast jcast at ou.edu
Sun Jun 26 18:40:56 EDT 2005


Lennart Augustsson <lennart at augustsson.net> wrote:
<snip>
> There  are, of  course,  type  systems where  my  program works  fine.
> O'Haskell is  an example of  a language with  such a type  system.  In
> O'Haskell the Either type is defined like this:
> 
>    data Left a = Left a
>    data Right a = Right a
>    data Either a b > Left a, Right b
> 
> which means that Either is really a union of the Left and Right types.
> Now my program type checks. :)
> 
>    foo :: Either a b -> Either () b
>    foo (Left _) = Left ()
>    foo x@(Right _) = x
> 
> And it has type checked in various type systems for quite a while, but
> not in System F.  But System F is not the end all of type systems.

OK.  I happily yield.

Jon Cast


More information about the Haskell-Cafe mailing list