Last active
December 16, 2017 13:45
-
-
Save mbloms/a03e20c8f2d90d48c93a9ffee944871b to your computer and use it in GitHub Desktop.
ComonadScan
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
class Comonad w => ComonadScan w where | |
scanW :: (a -> w b -> a) -> a -> w b -> w a | |
scanW f acc w = (duplicate w) | |
instance ComonadScan Tree where | |
scanW f acc w@(Node _ as) = let acc' = f acc w in Node acc' (map (scanW f acc') as) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment