ivanperez-keera / dunai

Classic FRP, Arrowized FRP, Reactive Programming, and Stream Programming, all via Monadic Stream Functions
212 stars 35 forks source link

`dunai`: MSFs are profunctors #224

Closed turion closed 1 year ago

turion commented 4 years ago

I think that for any functor m, MSF m is a profunctor. This means that we can pre- and postcompose MSFs with pure functions, and that precomposition is contravariant. In arrows, precomposition is known as the (^>>) operator.

For the additional dependency of the profunctor package, we could implement a Profunctor instance for MSF m. Possibly, this is not so hard, and might be a beginner's issue. I'm not sure what the huge advantages are, though.

turion commented 3 years ago

Similarly, I believe that MSF m is a Traversing: From an MSF m a b you can make an MSF m [a] [b], and similarly for other Traversable structures.