Is there a write up on what makes an implementation lazy vs strict?
I like to better understand the trade off between the two and use cases
where one is better than the other.
I noticed that some functions in the lazy implementation uses "~" . For
example
evalStateT :: (Monad m) => StateT s m a -> s -> m a
evalStateT m s = do
~(a, _) <- runStateT m s
return a
What does ~ do?
thanks,
Daryoush
On Mon, Oct 13, 2008 at 1:34 PM, Jonathan Cast <[EMAIL PROTECTED]>wrote:
> 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.
>
> jcc
>
>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe