reflex-frp / reflex

Interactive programs without callbacks or side-effects. Functional Reactive Programming (FRP) uses composable events and time-varying values to describe interactive systems as pure functions. Just like other pure functional code, functional reactive code is easier to get right on the first try, maintain, and reuse.

Home Page:https://reflex-frp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide a library function to convert from `Incremental t (PatchDMap (Const2 k a) Identity)` to `Incremental t (PatchMap k a)`

mpickering opened this issue · comments

It seems that the conversion between Incremental t (PatchDMap (Const2 k a) Identity)
to Incremental t (PatchMap k a) is safe, but I couldn't find a library function which performed the conversion.

Therefore I implemented it as follows:

c :: Incremental t (PatchDMap (Const2 k a) Identity)
             -> Incremental t (PatchMap k a)
c = unsafeMapIncremental dmapToMap (patchDMapToPatchMapWith runIdentity)

A simple blessed function which did this conversion would be good to provide in the library for the purpose of discoverability.