[Haskell-cafe] couple of questions on monads
jonathanccast at fastmail.fm
Mon Oct 13 16:34:46 EDT 2008
On Mon, 2008-10-13 at 13:37 -0700, Daryoush Mehrtash wrote:
> Question 1: Why are there lazy and strict modules of some monads?
> (e.g. Control.Monad.State)
Because both are useful, for different purposes. (For the same reason
that it's helpful, in general, to have both eager and lazy evaluation in
the same language --- sometimes one version is more efficient, sometimes
the other one is).
> Question 2: If I define a new monad (say XYZ), does it have to be as
> Control.Monad.XYZ module?
No. Haskell has neither a requirement nor a convention that monads go
in Control.Monad. Control.Monad.* is simply the home of the MTL
library, which contains a number of exceptionally useful monads; new
monads that aren't as exceptionally general-purpose as MTL probably
shouldn't go there, to reduce clutter.
More information about the Haskell-Cafe