[Haskell-cafe] let vs do?

Thomas Schilling nominolo at googlemail.com
Thu Jun 28 15:47:07 EDT 2007

On 28 jun 2007, at 21.17, Greg Meredith wrote:
> Once you have a polymorphic let, why do you need 'let' in the base  
> language, at all? Is it possible to formulate Haskell entirely with  
> do-notation where there is a standard monad for let environments?  
> Probably this was all discussed before in the design deliberations  
> for the language standard. Pointers would be very much appreciated.

   let x = ... in ...

is only equal

   do x <- ...; ...

in the Identity monad.  Also, why would "do" be more primitive than  
"let".  That way you would have to use monads everywhere.  Also, let  
is treated specially by the type checker (IIRC) and there are many,  
many other reasons not to do that.

Why would you consider the syntactic sugar do { x <- e; .. } which is  
just a different way of writing function binding (e >>= \x -> ...)  
consider more primitive than "let"?

/ Thomas


More information about the Haskell-Cafe mailing list