[Haskell-cafe] a general question on Arrows

Steve Lihn stevelihn at gmail.com
Thu Feb 14 21:34:53 EST 2008


> >  1. Stream
> This is actually a comonad.

Something more to learn everyday.

> Here's another fun arrow:
>
> http://luqui.org/blog/archives/2007/09/06/quantum-entanglement-in-haskell/
>
> Luke
>
Luke,
I managed to get your quantum entanglement examples working. But
honestly, I can't quite figure out your Quantum module yet. My head is
exploding after reading the code :-) It is amazing to know it takes
several layers of arrows to simulate the quantum mechanics.

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

In the former, the result is printed on the screen. I can not collect
the result and do more analysis. For example, for a quantum state |0>
+ i |1>, the probability is half half. If I can repeat the simulation
10000 times and collect the "observations" (y) , then I can "prove"
the correctness of experiment by observing ~5000 of |0> and ~5000 of
|1>. Or even plot the probability distribution of the experiment.

Steve


More information about the Haskell-Cafe mailing list