ããããã«ã»ã»ã» ååã«ç¶ãã¦ãContinuation Monadã¨çµã¿åããã¦ä½¿ç¨ãããé¢æ°callCCã解説ãã¾ãã ååä½æããContåï¼Continuation Monadï¼ã¨é¢æ°pythagoras2ãåæ²ãã¾ãã cps.hs newtype Cont r a = Cont { runCont :: (a -> r) -> r } instance Monad (Cont r) where return x = Cont (\k -> k x) m >>= f = Cont (\k -> runCont m (\x -> runCont (f x) k)) infixr 5 =: (=:) :: a -> (a->b) -> b x =: f = f x squareCont x = Cont (\k -> k (x * x)) addCont x y = Cont (\k
{{#tags}}- {{label}}
{{/tags}}