[Haskell-cafe] Design of a Physics Interface

Luke Palmer lrpalmer at gmail.com
Sat Dec 1 02:06:39 EST 2007


On Nov 30, 2007 7:26 PM, Dan Weston <westondan at imageworks.com> wrote:
> There seems to be three salient benefits of using arrows, as I read the
> Abstract and Introduction of Benjamin Lerner, "Arrow Laws and Efficiency
> in Yampa", 2003,
> http://zoo.cs.yale.edu/classes/cs490/03-04a/benjamin.lerner/
>
> 1) The discipline of using arrows assists in avoiding space-leaks
>     "The reasons underlying this...primarily stemmed from the
>      availability of signals as first-class values."
>     [the "ugly pain" you experience up front saves you
>      chronic pain later. Self-discipline is the key to a happy life.]

I experienced the chronic pain in my initial comonadic implementation
of FRP.  It was
pretty, but ran in quaadratic time :-(.

To be clear, I am not abandoning arrows in FRP.  I am abandoning using
an arrow to
represent *each* object in favor of moving objects into the value level rather
than the signal level.

i.e. the following dies:

ball :: Position -> Velocity -> SF PhysIn PhysOut
...

In favor of

game = proc () -> do
    rec world <- integrate initWorld -< trajectory world
    ...

I have an idea for an external solution though that I'm going to play
with now.  I'll
report on how it goes :-)

Luke


More information about the Haskell-Cafe mailing list