ãã¼ãä»æ¥ã¯ã¢ãããã©ã³ã¹ãã©ã¼ãã¼ã®ä¸ç¨®StateTã«ã¤ãã¦åå¼·ãã¦ã¿ã¾ãããåèã«ããã®ã¯ããã辺ã§ãã ã¢ããã¯å®éã«è¡ããããã¨ã®ä¸ã¤ã®é¢ã«ã¤ãã¦ã®ä¸æã«æ½è±¡åãã¦ãããã®ã§ãããä¸ã¤ä¸ã¤ã®ãã¨ãå¥ã ã®ã¢ããã§å®ç¾ããã¦ããã®ã§ãã¹ãã¼ããæã¡ãããã©IOãä¸ç·ã«ä½¿ãããã¨ããã¨ãã¯ã©ããã¦ãStateã¨IOã®ä¸¡æ¹ãæã¤ããªã©ã使ããããªãããã§ãã©ãããããããã¨ãã«ä½¿ãã®ãã¢ãããã©ã³ã¹ãã©ã¼ãã¼ã¨ãããã¨ãããã§ããStateTã¨ããã®ã¯å¥ã®ã¢ãããåãã©ã¡ã¿ï¼ï¼ï¼ã«ã¨ãã¢ãããã©ã³ã¹ãã©ã¼ãã¼ã§ã次ã®ãããªå®ç¾©ã«ãªã£ã¦ãã¾ãã newtype StateT s m a = StateT { runStateT :: (s -> m (a,s)) } instance (Monad m) => Monad (StateT s m) where return :: a -> S
{{#tags}}- {{label}}
{{/tags}}