[Haskell-cafe] A lazy question

Mario Blazevic mblazevic at stilo.com
Sun Aug 13 11:51:46 EDT 2006

    I was hoping to use Haskell's laziness to implement some of the stuff from
"Continuation and Transducer Composition"
(http://www-static.cc.gatech.edu/~shivers/papers/fcoro.pdf)  a bit more elegantly, without
manually coding the coroutine logic in continuation-passing style. Unfortunately, I'm
beginning to think there is no workaround. Here's the challenge in a simplified form:


   newtype Source x = Source (x, Source x)
   newtype Sink x = Sink (x -> Sink x)

   type SourceTransducer x y = Source x -> Source y
   type SinkTransducer x y = Sink y -> Sink x

   sourceToSinkTransducer :: SourceTransducer x y -> SinkTransducer x y


 I can't find any way to implement the sourceToSinkTransducer function and its inverse.
This is disappointing, because SourceTransducer and SinkTransducer are obviously
isomorphic and there are languages like Oz that can accomplish this. Tell me I'm missing
something obvious?

More information about the Haskell-Cafe mailing list