21 Mar
2001
21 Mar
'01
7:40 a.m.
Andreas Gruenbacher writes:
It's not what I had in mind, though. Simon's MVars (in the Awkward Squad) come pretty close, but they're still not the sort of (cooperative) multitasking that I'm thinking of.
I hope I'm not being too fussy, but seems to me that the CVar is what is needed, not the MVar:
main= newCVar >>= \l0 -> newCVar >>= \l1 -> newCVar >>= \l2 -> forkIO readInputLineAtATime l0 >> forkIO printHeader "silly header" l0 l1 >> forkIO numberLines 0 l1 l2 >> printOutputLineAtATime l2
(untested code.)