[Haskell] Mixing monadic and non-monadic functions

Bulat Ziganshin bulatz at HotPOP.com
Thu Sep 15 13:19:41 EDT 2005


Hello Ben,

Wednesday, September 14, 2005, 6:32:27 PM, you wrote:

BRG>      do { ... ; ... borrow E ... ; ... }

BRG> is transformed into

BRG>      do { ... ; x <- E ; ... x ... ; ... }

i strongly support this suggestion. actually, i suggest the same for
dealing with references (IORef/MVar/...), for example:

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') }



-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell mailing list