[Haskell-cafe] Re: monad subexpressions

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Aug 3 09:36:40 EDT 2007

Hello Claus,

Friday, August 3, 2007, 5:12:26 PM, you wrote:

>> can you please rewrite *p++=*q++ in haskell?
>     do { w p =<< r q; i p; i q }

how about *Object.File.Line.CurPtr++ = *AnotherObject.File.Line.CurPtr++  ? ;)

> but whatever line-noise one prefers, this still seems a call for
> better combinators in the standard libs, rather than a call for
> more syntax.

the problem with Haskell is that we need to split C expression into
several statements and explicitly specify execution order even when we
know that it doesn't matter. ideally, it should be possible to define

++x = modifyIORef x (+1) >> readIORef x
*x  = readIORef x

and know that ghc will automatically generate temporary variables for
results of monadic operations, understand the code and optimize it

the sole reason why it's required for me is writing imperative
software. while some purists may believe that haskell doesn't need
imperative code, it's part of my program/libs and i want to have
simple and concise representation for it

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list