newtype Program (f :: * -> *) (a :: *)
= Program
{runProgram :: F (Coyoneda f) a}
-- Shouldn't this exist already in a library somewhere?
let eval (Coyoneda cf cm) = nt cm >>= cf in iterM eval (runProgram p)
Program . liftF . liftCoyoneda
let insf a b m' = flip insert b <$> f a <*> m'
in foldrWithKey insf (pure M.empty) m
maybeT a pure m
T.trace (show $ f a) a