
| What I had in mind was something like the following | (pseudocode), which | could easily be implemented on top of coroutines: Concurrent Haskell provides exactly this Channel stuff. Simon | | class Channel c t where | send :: t -> c -> IO () | receive :: c -> IO t | | sender :: Int -> Channel -> ... | sender n receiver = do send n receiver | return (sender (n+1) receiver) | | receiver :: Channel -> ... | receiver sender = do i <- receive sender | return (receiver sender) | | c :: Channel Int | c = ... | | main = run_them [ sender 1 c, receiver c ] | | | Maybe there is also a way to achieve something similar using | 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 | days already. | I particularly like the introduction to monads---it's the | best I have seen | so far. | | | --Andreas. | |
participants (1)
-
Simon Peyton-Jones