[Haskell-cafe] a general question on Arrows

Luke Palmer lrpalmer at gmail.com
Fri Feb 15 00:13:33 EST 2008


On Thu, Feb 14, 2008 at 7:34 PM, Steve Lihn <stevelihn at gmail.com> wrote:
>  I have a small question on the simulation technique. In both John
>  Hughes and your code, you wrap the "print" inside the runXYZ (...) to
>  print out the state of simulation. It is like:
>
>  runArrow ( ... simulation ...then print ...) -< input
>
>  Why don't you structure it like
>
>  y <- runArrow ( ... simulation ... then return observation ... ) -< input
>  reuse y or print y

After attempting to reply to this several times, I think I finally
know what you're asking.  Well, "observe" and "observeWith" are
exported, so you could do that if you wanted.  As far as why I didn't
do that in my example code, uh, I dunno.

Really the purpose of this was to port the Quantum::Entanglement Perl
module, for no other reason than that module made me go "Woah! That's
awesome!".  So I wanted to transliterate the Perl examples which
collapsed and printed in one go, because those were what made me feel
like I was inside some freaky quantum computer, not just running a
simulation module.  :-)

Luke


More information about the Haskell-Cafe mailing list