Created
February 13, 2018 19:17
-
-
Save amalloy/dfc8ee5769be6e20c1791d02df680cd2 to your computer and use it in GitHub Desktop.
This file contains 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
instance Monad Signal where | |
return = pure | |
(Signal s) >>= f = Signal $ \t -> let Signal s' = f (s t) | |
in s' t | |
-- or, equivalently but less readably: | |
-- s >>= f = Signal $ join (func . f . func s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment