
Thomas, Stefan,
Thanks for a most edifying exchange! i will reflect on this.
Best wishes,
--greg
On 6/28/07, Stefan Holdermans
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
-- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103 +1 206.650.3740 http://biosimilarity.blogspot.com