Imperative Notation

Nick Kallen nkallen@uclink4.berkeley.edu
Tue, 9 Feb 1999 03:17:57 -0800


I've done very little programming with the Object IO library although I've
done (enough) with the 0.8 library. The points I bring up in this message
are undoubtedly ones the Clean team have considered in the past, but I still
think they're worth a more careful examination, especially in light of the
recent development with Arrows in the Haskell world.

> Start world
>     # (_,mbListener,world)              = openTCP_Listener 1888 world
>       (mbTCPDuplexChan, listener, world)= receive (fromJust
> mbListener) world
>       (_,{sChan,rChan})                 = fromJust mbTCPDuplexChan
>       world                             = closeChan listener world
>       (receivedData, rChan, world)      = receive rChan world
>       (sChan, world)                    = send sChan receivedData world
>       world                             = closeChan sChan world
>       world                             = closeChan rChan world
>     = world

I can't be the only person whom this strikes as horrible. Dare I bring up
the topic of a "do" notation?

Now, I know the Clean argument against Monads. Multiple environments
preclude this in principle. Why does Clean have multiple environments? For
concurrency purposes of course. Where is *Concurrent* Clean? Anybody's guess
;)

Regardless. It is a pain to read and write even the most trivial functions
with this explicit CPS. It makes me cringe. Am I the only Clean programmer
who has surrendered and said: "Give me do!?"

Simple stuff like the above map to "do" trivially. But, how do we handle
multiple environments? Well, has anybody looked into whether Arrows would
suffice?

I'm sure some nice syntactic solution to the implicit multiple environment
passing problem could be created. Has anyone in the Clean team tried? I'm
under the impression that you guys have said: "We have uniqueness typing,
it's better than monads; therefore, we don't need a do notation."

I don't have a proposal but I think this is a worthy topic to bring out in
the open between Clean users and the Clean people.