------
-- This is the continuation monad.
------
type E x = ((x -> Double) -> Double)
 
return :: x -> E x
return x p = p x
 
-- Here, we have the following types.
--  w :: (x -> Double) -> Double
--  k :: x -> ((y -> Double) -> Double)
--  q :: y -> Double
(>>=) :: E x -> (x -> E y) -> E y
(w >>= k) q = w (\x -> k x q)

References.

Tags: continuation monad.