[Haskell-cafe] Arrow laws of Netwire

Ivan Perez ivanperezdominguez at gmail.com
Mon Feb 19 00:55:06 UTC 2018

On 18 February 2018 at 17:26, Ertugrul Söylemez <esz at posteo.de> wrote:

> [...]
> In AFRP all behaviours and events are "virtual" in a sense.

Only in "pure" forms of AFRP, that is, those without a monad, and only so
long as you stick to the arrow framework and/or arrow notation. Just
because something supports AFRP doesn't mean that you have to use it
limited to the traditional AFRP interface.

>   Though
> arrow notation can make it look like they are actual values this is
> really just an illusion.

But this is what I mean when I talk about applicatives.

I'm honestly not seeing a big difference between behaviours in CFRP and
signals in Dunai/Wires/Varying.

For instance, you can define Behaviour as:

type Beh a = MSF Identity a

(Or maybe a better monad ,or even an adhoc monad that connects the external
providers in a referentially transparent way.)

You can then put it in a data structure (it's a first-class entity), it
will be garbage collected when appropriately, you can demand new values as
necessary, and you can operate with it also "as if it where a signal":

myBeh = f <$> beh1 <*> beh2

You can define instances of Num if you want to write:

myBeh = beh1 + beh2

Although that's not easily extensible to all functions that act on values.

> That's why you can't sensibly communicate an
> event out of the wire/SF/MSF/MealyT/…

But you can. That's precisely what the monad allows you to do.

I suspect I may not be understanding precisely what you mean. Perhaps you
can describe this in more detail or with an example? (feel free to email me
personally if this is derailing the original conversation off-topic.)

If you mean what I understand from your words, I'd say you can communicate
events out, and I do this all the time. I even built a system to
synchronize discrete games with continuous animations without having to
pipe data explicitly all the way up, based on "implicit" event passing
using MSFs.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180218/76758ca4/attachment.html>

More information about the Haskell-Cafe mailing list