diff --git a/src/Control/Monad/Co.hs b/src/Control/Monad/Co.hs index 67b0f03..12db93b 100644 --- a/src/Control/Monad/Co.hs +++ b/src/Control/Monad/Co.hs @@ -55,6 +55,7 @@ module Control.Monad.Co , diter, dctrlM , posW, peekW, peeksW , askW, asksW, traceW + , freeW )where #if __GLASGOW_HASKELL__ < 710 @@ -153,6 +154,9 @@ asksW f = liftCoT0 (Env.asks f) traceW :: ComonadTraced e w => e -> CoT w m () traceW e = liftCoT1 (Traced.trace e) +freeW :: ComonadCofree f w => Co f (CoT w m a) -> CoT w m a +freeW cof = CoT (runCo cof . fmap (flip runCoT) . unwrap) + liftCoT0M :: (Comonad w, Monad m) => (forall a. w a -> m s) -> CoT w m s liftCoT0M f = CoT (\wa -> extract wa =<< f wa)