[Haskell-cafe] A curios monad

Daniel Fischer daniel.is.fischer at web.de
Sat Dec 13 18:15:00 EST 2008


Am Sonntag, 14. Dezember 2008 00:00 schrieb Andrew Coppin:
> David Menendez wrote:
> > On Thu, Dec 11, 2008 at 1:48 PM, Andrew Coppin
> >
> > <andrewcoppin at btinternet.com> wrote:
> >> BTW, does anybody know how rank-N types are different from existential
> >> types?
> >
> > You mean the Haskell extensions?
> >
> > ExistentialQuantification lets you define types such as,
> >
> >     data SomeNum = forall a. Num a => SomeNum a
> >
> > RankNTypes lets you nest foralls arbitrarily deep in type signatures,
> >
> >     callCC :: ((forall b. a -> m b) -> m a) -> m a   -- this is rank-3
> >
> > RankNTypes implies ExistentialQuantification (among others).
>
> So how is
>
>   foo :: ((forall b. a -> m b) -> m a) -> m a

Here, the argument of foo's argument must be a polymorphic function, capable 
of returning an (m b) whatever b is.

>
> different from
>
>   bar :: forall b. ((a -> m b) -> m a) -> m a

Here, the argument of bar's argument can have any monomorphic type (a -> m b)

>
> then?
>



More information about the Haskell-Cafe mailing list