haskell-cafe@haskell.org
[Top] [All Lists]

Re[2]: [Haskell-cafe] Re: monad subexpressions

Subject: Re[2]: [Haskell-cafe] Re: monad subexpressions
From: Bulat Ziganshin
Date: Fri, 3 Aug 2007 17:36:40 +0400
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@xxxxxxxxx

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

<Prev in Thread] Current Thread [Next in Thread>