[Haskell-cafe] Polymorphic algebraic type constructors

Philippa Cowderoy flippa at flippac.org
Wed Jun 23 09:20:42 EDT 2004

On Wed, 23 Jun 2004, Adrian Hey wrote:

> I think all occurences of [] have type forall a. [a]
> The case expression..
>          case a of
>                  (a':as) -> <expr1>
>                  []      -> <expr2>
> Should be typed as if written..
>          case a of
>                  (a':as) -> let a=(a':as) in <expr1>
>                  []      -> let a=[]      in <expr2>

How about when a is an expression rather than just an identifier?

I'm playing around with a subtyping extension to plain ol' H-M at the
moment, my solution there's to let the user use an as-pattern to capture
the extra type info where needed.

flippa at flippac.org

More information about the Haskell-Cafe mailing list