Created
January 27, 2021 23:36
-
-
Save srid/a7e677fca4fef7c2923588459899b6db 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
-- | Like `unsafeMapIncremental` but the patch function also takes the old | |
-- target. | |
unsafeMapIncrementalWithOldValue :: | |
(Reflex t, Patch p, Patch p') => | |
(PatchTarget p -> PatchTarget p') -> | |
(PatchTarget p -> p -> p') -> | |
Incremental t p -> | |
Incremental t p' | |
unsafeMapIncrementalWithOldValue f g x = | |
let x0 = currentIncremental x | |
xE = updatedIncremental x | |
in unsafeBuildIncremental (f <$> sample x0) $ uncurry g <$> attach x0 xE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment