[Haskell-cafe] Re[2]: strict Haskell dialect

Robin Green greenrd at greenrd.org
Fri Feb 3 17:51:09 EST 2006

On Fri, 3 Feb 2006 19:33:12 -0000
"Brian Hulley" <brianh at metamilk.com> wrote:
> 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)))

That's not necessary. >> has something in common with if', where

if' True x _ = x
if' False _ y = y

- in both cases, it makes sense to evaluate the arguments lazily.

So simply make strictness the default and have laziness annotations
(for arguments), instead of making laziness the default and having
strictness annotations.

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

Monads can be viewed as code generators. So, with partial
evaluation, my guess is yes, at least in many important cases.

More information about the Haskell-Cafe mailing list