Re:Transducers are coming to Clojure
by davdar on Wednesday August 06, 2014 @08:59PM
(#8145776)
Clojure transducers are exactly signal functions from Haskell FRP literature, for those interested in such a connection.
[ Parent
| on HN ]
Re:Transducers are coming to Clojure
by richhickey on Wednesday August 06, 2014 @09:41PM
(#8145880)
I'm not yet seeing that, given:
Signal a :: Time -> a SF a b :: Signal a -> Signal b thus (Time -> a) -> (Time -> b)
not exactly:
(x->a->x) -> (x->b->x)
Can you point me to a paper that makes the connection clear?
In the non-continuous FRP literature[1], i.e. the kind you actually implement, SF a b = [a] -> [b], which is isomorphic to: Fold a -> Fold b, where Fold a = (exists s. (s, s -> (a, s))), which isomorphic to the type the author writes for transducer:
;;transducer signature
(whatever, input -> whatever) -> (whatever, input -> whatever)
Signal functions are easy to program in Haskell using arrow syntax, and many libraries already exist for dealing with signal functions.[1]: Nilsson, Courtney and Peterson. Functional Reactive Programming, Continued. Haskell '02. http://haskell.cs.yale.edu/wp-content/uploads/2011/02/worksh... (see section 4)
edit: formatting