all 2 comments  [–]sjoerd_visscher 3 points4 points ago   shift
and reset aren't really needed. If you inline them the
make_zipper function can be simplified:  import Data.Traversable
import Control.Monad.Trans.Cont  data Zipper t a = ZDone (t a)
| Z a (Maybe a -> Zipper t a)  make_zipper :: Traversable t => t
a -> Zipper t a make_zipper t = runCont (traverse (\a -> cont
(\k -> Z a (k . maybe a id))) t) ZDone  Note that traverse also
works instead of mapM, i.e. we only need the applicative
instance of Cont. (Which is provided by the transformers
package).  [–]doliorules 2 points3 points ago*   There is an
alternate presentation of shift and reset using Cont. It looks
like this:  reset takes a computation with control effects and
delimits it so that no effects can escape. This means it can
yield a pure value, so:  reset :: Cont a a -> a reset m =
runCont m id  shift captures a continuation, but the
continuation it captures is a pure function that has no control
effects. Further, it delimits th