Created
December 15, 2017 00:50
-
-
Save mbloms/c9a1aabbe5b0568b0b4df7a90a778749 to your computer and use it in GitHub Desktop.
Comonadic fixed point
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
-- Normal fixed point | |
fix f = f (fix f) | |
-- | Slow comonadic fixed point à la Kenneth Foner: | |
pfix :: Comonad w => w (w a -> a) -> w a | |
pfix = extend wfix | |
-- | Comonadic fixed point à la Kenneth Foner: | |
kfix :: ComonadApply w => w (w a -> a) -> w a | |
kfix w = fix $ \u -> w <@> duplicate u | |
-- | Comonadic fixed point à la Blom: | |
bfix :: ComonadApply w => w (w a -> a) -> w a | |
bfix w = w <@> extend bfix w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment