Created
February 8, 2024 07:56
-
-
Save ymdryo/52d9c4d15f3665ea3a92f44c53902a55 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
callCC :: forall r m a. (Shift r <<: m, Monad m) => ((a -> m r) -> m a) -> m a | |
callCC f = shift @r \k -> k =<< f (k >=> exit) | |
exit :: (Shift r <<: m, Applicative m) => r -> m a | |
exit r = shift \_ -> pure r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment