[Haskell] Mixing monadic and non-monadic functions

Wolfgang Jeltsch wolfgang at jeltsch.net
Fri Sep 16 09:55:52 EDT 2005


Am Freitag, 16. September 2005 14:02 schrieb Sergey Zaharchenko:
> [...]

> > do x <- newIORef 0
> >    y <- newIORef 0
> >    z <- newIORef 0
> >    z := *x + *y   -- translated to { x' <- readIORef x; y' <- readIORef
> > y; writeIORef z (x'+y') }
>
> I might be misunderstanding, but aren't we going to introduce evaluation
> order for `+' in this case?

I think so and I think this is the case also for the approaches of including 
monadic expressions into "ordinary" expressions.  That is, in my opinion, a 
strong argument against these proposals.  One thing I like about Haskell is 
that side-effects are strictly separated from evaluation so that there is no 
such thing like an implicit evaluation order.

Best wishes,
Wolfgang


More information about the Haskell mailing list