Bulat Ziganshin wrote:
Hello Wolfgang,

Friday, February 03, 2006, 1:46:56 AM, you wrote:
i had one idea, what is somewhat corresponding to this discussion:

make a strict Haskell dialect. implement it by translating all
expressions of form "f x" into "f $! x" and then going to the
standard (lazy) haskell translator. the same for data fields - add
to all field definitions "!" in translation process. then add to
this strict
Haskell language ability to _explicitly_ specify lazy fields and
lazy evaluation, for example using this "~" sign

[Apologies for replying to a reply of a reply but I don't seem to have received the original post]

I've been thinking along these lines too, because it has always seemed to me that laziness is just a real nuisance because it hides a lot of inefficiency under the carpet as well as making the time/space behaviour of programs difficult to understand...

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:

go {e1;e2;e3}   ===           e1 >>= (\_-> (e2 >>= (\_->e3)))

Of course this doesn't solve the problem of how to translate programs that make heavy use of mapM etc.

I wonder: is monadic programming really dependent on lazyness or is there a realistic (ie not impossibly complicated) way to use monads in a strict setting?

A related question is: could monadic programming ever be as efficient as side-effect programming?

Regards, Brian.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to