FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

Bayley, Alistair Alistair_Bayley at invescoperpetual.co.uk
Thu Aug 2 07:17:07 EDT 2007


> From: haskell-cafe-bounces at haskell.org 
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of peterv
> 
> However, one thing which I find annoying is that a "classic 
> pure" function cannot evaluate an IO function unless you use 
> unsafePerformIO; one must "promote" (?demote) the pure 
> function into the IO monad.

That's just a property of the IO monad, rather than monads in general:
http://www.haskell.org/all_about_monads/html/laws.html#nowayout


> Any ways of "promoting" such a pure function into the monadic 
> one automatically? I tried playing with "liftM", without succes.

This is where Claus plugs HaRe :-) (although liftM + friends is normally
what one uses). You might find this relevant:
http://www.cs.kent.ac.uk/projects/refactor-fp/catalogue/Monadification1.
html

Some people (but I'm not sure who) probably write most of their Haskell
code in a monadic style, so as to make conversion between various monads
less painful. It's still pure...

Alistair
*****************************************************************
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*****************************************************************


More information about the Haskell-Cafe mailing list