Skip to content

Commit 8a66e45

Browse files
committed
Merge branch 'topic/free-functions'
2 parents 885fa4f + 4ab13a2 commit 8a66e45

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Control/Monad/Free.purs.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ instance monadFreeFree :: (Functor f) => MonadFree f (Free f) where
2828

2929
liftF :: forall f m a. (Functor f, Monad m, MonadFree f m) => f a -> m a
3030
liftF fa = wrap $ return <$> fa
31+
32+
iterM :: forall f m a. (Functor f, Monad m) => (f (m a) -> m a) -> Free f a -> m a
33+
iterM _ (Pure a) = return a
34+
iterM k (Free f) = k $ (iterM k) <$> f

0 commit comments

Comments
 (0)