Created
August 7, 2019 07:53
-
-
Save oliver-batchelor/f3514b6a5c5e58fb7f4ca30b709fa141 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data ApplyKey b a where | |
F :: ApplyKey (a -> b) | |
A :: ApplyKey a | |
instance Reflex t => Apply (Event t) where | |
evf <.> evx = fmapMaybe fromDMap e' where | |
e' merge (DMap.fromList [F :=> evf, A :=> evx]) | |
fromDMap m = case (DMap.lookup F m, DMap.lookup A m) of | |
(Just (Identity f), Just (Identity a)) -> Just (f a) | |
_ -> Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment