I am wondering if this monad has a standard name in the Haskell ecosystem
data Delay a = Wait (Delay a) | Done a deriving (Show, Eq, Functor)
instance Monad Delay where
return a = Done a
(Done a) >>= f = f a
(Wait da) >>= f = Wait (da >>= f)
It is useful so that possibly non-terminating computation can be "paused".
The end goal is to combine it with LogicT so I can search over possibly non terminating functions. I rolled my own implementation originally but the book-keeping was out of hand, especially since I have other monadic effects in the mix.