[Haskell-cafe] Rank2Types and pattern matching

Felipe Lessa felipe.lessa at gmail.com
Sat Jul 3 22:52:31 EDT 2010


On Sat, Jul 3, 2010 at 9:12 PM, Dan Doel <dan.doel at gmail.com> wrote:
> The problem is instantiation. SomeMonad is a constructor for the type
>  SomeMonad s a
> for any *particular* s and a. But the type:
>  forall s. SomeMonad s a
> is not that type. That type doesn't have constructors (proper) at all, and
> hence you cannot match against it. If types were passed explicitly, then
> values of the second type would look like:
>  /\s -> ...
> Where the big lambda is type abstraction. But you can't match against this, of
> course (just as you can't match against functions as lambda expressions), you
> can only apply values of this type.

I understood your explanation.  However, is this an implementation
detail/bug or is it an intended feature?



More information about the Haskell-Cafe mailing list