Is this functional reactive programming

What I want to be able to do is something like this: do x <- newSTRef 2 y <- newSTRef 3 z <- letSTRef (x + y) r1 <- readSTRef z writeSTRef x 5 r2 <- readSTRef z return (r1, r2) This should return (6,15) The "letSTRef" is what's new. The value it returns can change based on the parts that make up it's function changing. I understand this syntax above isn't going to work (I'd have to use applicative at least I'd imagine) but my main question is that does something like this exist? Is it functional reactive programming or is it something else? I don't want to be reinventing the wheel if this type of idea is already implemented but I haven't recognised it.

On Mon, May 11, 2015 at 7:36 AM, Clinton Mead
The "letSTRef" is what's new. The value it returns can change based on the parts that make up it's function changing.
Certainly that sounds very close to FRP, which propounds the concept of _time-varying_ values. I understand this syntax above isn't going to work (I'd have to use
applicative at least I'd imagine) but my main question is that does something like this exist?
Let's assume you want to adopt the classic effectful approach to FRP. Now when you write: x <- newSTRef 2 y <- newSTRef 3 z <- letSTRef (x + y) you're really working in a pure fragment. Moreover, letSTRef, while attractive, is sort of on the wrong track. Suppose we have two time-varying values mouseX and mouseY. They are both at least applicative values, i.e. f Int for some applicative, possibly even monadic, functor f. They are also primitive, like the way a Haskell Int is primitive and involves hardware-wired details, meaning you'll do the actual implement at a lower level than the following: We have a Euclidean distance function dist :: Int -> Int -> Int. To track the distance of the mouse pointer from the origin, we'd write liftA2 dist mouseX mouseY :: f Int, thus deriving another time-varying Int. Does this help clarify? -- Kim-Ee

This looks more like self-adjusting computation than functional reactive
programming. There's a lot of good literature on this topic that's pretty
easy to find on Google. Hope this helps!
On 8:36PM, Sun, May 10, 2015 Clinton Mead
What I want to be able to do is something like this:
do x <- newSTRef 2 y <- newSTRef 3 z <- letSTRef (x + y) r1 <- readSTRef z writeSTRef x 5 r2 <- readSTRef z return (r1, r2)
This should return (6,15)
The "letSTRef" is what's new. The value it returns can change based on the parts that make up it's function changing.
I understand this syntax above isn't going to work (I'd have to use applicative at least I'd imagine) but my main question is that does something like this exist? Is it functional reactive programming or is it something else?
I don't want to be reinventing the wheel if this type of idea is already implemented but I haven't recognised it.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

For the record, 'self-adjusting computation' is also known as 'incremental
computation'. The latter term is overloaded, as you might imagine.
-- Kim-Ee
On Tue, May 12, 2015 at 6:26 PM, Jake McArthur
This looks more like self-adjusting computation than functional reactive programming. There's a lot of good literature on this topic that's pretty easy to find on Google. Hope this helps!
On 8:36PM, Sun, May 10, 2015 Clinton Mead
wrote: What I want to be able to do is something like this:
do x <- newSTRef 2 y <- newSTRef 3 z <- letSTRef (x + y) r1 <- readSTRef z writeSTRef x 5 r2 <- readSTRef z return (r1, r2)
This should return (6,15)
The "letSTRef" is what's new. The value it returns can change based on the parts that make up it's function changing.
I understand this syntax above isn't going to work (I'd have to use applicative at least I'd imagine) but my main question is that does something like this exist? Is it functional reactive programming or is it something else?
I don't want to be reinventing the wheel if this type of idea is already implemented but I haven't recognised it.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (3)
-
Clinton Mead
-
Jake McArthur
-
Kim-Ee Yeoh