Hello Brian,

Saturday, February 04, 2006, 4:50:44 AM, you wrote:

>>> One question is how to get some kind of "do" notation that would
>>> work well in a strict setting.
>>> The existing "do" notation makes use of lazyness in so far as the
>>> second arg of  >> is only evaluated when needed. Perhaps a new
>>> keyword such as "go" could be used to use >>= instead ie:

BH> If strictness was the default (eg if the language were ML not Haskell), 
then 
BH> in

BH>              putStr "hello" >> putStr (show 1)

BH> both args to >>> would be evaluated before >> was called. Thus putStr (show
BH> 1) would be evaluated before the combined monad is actually run, which 
would 
BH> be wasteful if we were using a monad with a >> function that only runs the 
BH> rhs conditionally on the result of the lhs.
BH> If Haskell were a strict language I think an equivalent for the do notation 
BH> would have to lift everything (except the first expression) and use >>= 
BH> instead of >>> .

it seems that you misunderstand the monads (or may be i misunderstand :)

each and every monadic operation is a function! type "IO a" is really
"RealWorld -> (RealWorld,a)" and the same for any other monad. concept
of the monad by itself means carrying "hidden" state from one monadic
operation to the next. that allows to _order_ monadic operations plus
this state used for zillions other things, including state, logs,
fails and so on, so on


-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]



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

Reply via email to