[Haskell-beginners] Simple Continuation question

martin martin.drautzburg at web.de
Sat Jul 12 10:24:58 UTC 2014


Hello all,

I just started trying to understand Continuations, but my very first exercise already left me mystified.

import Control.Monad.Cont

resultIs :: Int -> Cont String String
resultIs i = ContT $ f
        where
            f :: (String -> a) -> a
            f k = k ("result=" ++ show i)

If resultIs returns a Cont String String, then f should be (String->String)->String, but that doesn't compile. Why is
that so?


More information about the Beginners mailing list