[Haskell-cafe] Do expression definition

Henning Thielemann lemming at henning-thielemann.de
Mon Sep 13 03:45:43 EDT 2010

On Mon, 13 Sep 2010, Alexander Kotelnikov wrote:

> Hello.
> http://www.haskell.org/onlinereport/exps.html#sect3.14 a obscure (to me) note which says
> "As indicated by the translation of do, variables bound by let have fully polymorphic types while those defined by <- are lambda bound and are thus monomorphic."
> What actually does it mean?

It means that variables bound by let, may be instantiated to different 
types later.

> And, also, would it make any difference if
> do {p <- e; stmts}	=	let ok p = do {stmts}
>    ok _ = fail "..."
>  in e >>= ok
> is redefined as "e >>= (\p -> do {stmts})"?

It would not make a difference because the (>>=)-expression is what the 
do-expression is expanded to.

More information about the Haskell-Cafe mailing list