Thomas,

  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.

As you already hinted at in a later message, this has to do with let- bindings being potentially polymorphic and monadic bindings being necessarily monomorphic:

  import Control.Monad.Identity
foo = let id = \x -> x in (id 'x', id 42) -- well-typed bar = runIdentity $ do id <- return (\x -> x) ; return (id 'x', id 42) -- ill-typed

Cheers,

  Stefan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to