Skip to content

Commit

Permalink
foldFreerIx
Browse files Browse the repository at this point in the history
  • Loading branch information
echatav committed Jan 15, 2024
1 parent 4453e37 commit c895bed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Control/Monad/Trans/Indexed/Free.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The free indexed monad transformer.

module Control.Monad.Trans.Indexed.Free
( IxMonadTransFree (liftFreeIx, hoistFreeIx, foldFreeIx), coerceFreeIx
, IxFunctor, IxMap (IxMap), liftFreerIx, hoistFreerIx
, IxFunctor, IxMap (IxMap), liftFreerIx, hoistFreerIx, foldFreerIx
) where

import Control.Monad.Free
Expand Down Expand Up @@ -132,3 +132,9 @@ hoistFreerIx
=> (forall i j x. f i j x -> g i j x)
-> freeIx (IxMap f) i j m x -> freeIx (IxMap g) i j m x
hoistFreerIx f = hoistFreeIx (\(IxMap g x) -> IxMap g (f x))

foldFreerIx
:: (IxMonadTransFree freeIx, IxMonadTrans t, Monad m)
=> (forall i j x. f i j x -> t i j m x)
-> freeIx (IxMap f) i j m x -> t i j m x
foldFreerIx f x = foldFreeIx (\(IxMap g y) -> g <$> f y) x

0 comments on commit c895bed

Please sign in to comment.