
7 Sep
2014
7 Sep
'14
8:57 a.m.
martin
writes:
Can someone help me cross this gap? There must be certain things I can do with Conts which I cannot do easily with values and functions.
Any function can be turned into a function accepting a continuation: f :: a -> b f_cont :: a -> (b -> c) -> c The Cont construction abstracts this pattern into its own type: f_Cont :: a -> Cont c b The advantage is that we now have a Functor instance over 'b', rather than over 'c' (for Functor (->) applied to f_cont). I cover Cont is more detail here, with a reference to green threading at the very bottom: https://www.fpcomplete.com/user/jwiegley/understanding-continuations John