CPS(Continuation passing style, ç¶ç¶æ¸¡ãã¹ã¿ã¤ã«)ã¯ãé¢æ°åããã°ã©ãã³ã°ã«ãããããã°ã©ã ã®æ¸ãæ¹ã®ä¸ã¤ã§ãããCPSãå°å ¥ããç°¡åãªä¾ãããã¤ãç´¹ä»ãããã ã¾ããå ¥åãããæ°å¤ã3ã®åæ°ãã©ãããå¤å®ããããã°ã©ã ãä½ã£ã¦ã¿ããã foo :: IO Bool foo = do n <- readLn :: IO Int return (n `mod` 3 == 0) ããã§ãCPSå¤æããªãåå¼ãè¡ãã¨â¦ãããªãï¼ foo' :: (Bool -> IO r) -> IO r foo' cont = do n <- readLn :: IO Int cont (n `mod` 3 == 0) ããªã«ãããreturnãç½®ãæããã ããããããï¼æå³ããããã¼ï¼ãã¨ãã声ãèããã¦ãããã ããããå°ãèãã¦ã¿ããã 3ã®åæ°ãå ¥åããããFizzã5ã®
{{#tags}}- {{label}}
{{/tags}}