Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. data ApplyKey b a where
  2. F :: ApplyKey (a -> b)
  3. A :: ApplyKey a
  4.  
  5.  
  6. instance Reflex t => Apply (Event t) where
  7. evf <.> evx = fmapMaybe fromDMap e' where
  8. e' merge (DMap.fromList [F :=> evf, A :=> evx])
  9. fromDMap m = case (DMap.lookup F m, DMap.lookup A m) of
  10. (Just (Identity f), Just (Identity a)) -> Just (f a)
  11. _ -> Nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement