Mon, 19 Mar 2001 09:45:28 -0800
| What I had in mind was something like the following=20
| (pseudocode), which
| could easily be implemented on top of coroutines:
Concurrent Haskell provides exactly this Channel stuff.
| class Channel c t where
| send :: t -> c -> IO ()
| receive :: c -> IO t
| sender :: Int -> Channel -> ...
| sender n receiver =3D do send n receiver
| return (sender (n+1) receiver)
| receiver :: Channel -> ...
| receiver sender =3D do i <- receive sender
| return (receiver sender)
| c :: Channel Int
| c =3D ...
| main =3D run_them [ sender 1 c, receiver c ]
| Maybe there is also a way to achieve something similar using=20
| higher order
| functions---I just don't see how.
| > Or you may be interested in Concurrent Haskell
| > See section 4 of "Tackling the awkward squad"
| > http://research.microsoft.com/~simonpj/papers/marktoberdorf.htm
| Thanks, I'm chewing on this paper of yours since a couple of=20
| days already.
| I particularly like the introduction to monads---it's the=20
| best I have seen
| so far.