mirror of
https://github.com/sayo-hs/heftia.git
synced 2024-11-26 23:05:04 +03:00
[add] subsuming functions.
This commit is contained in:
parent
02d5a21ade
commit
e5263b1742
@ -586,6 +586,20 @@ splitFreerEffects a =
|
||||
Left e -> liftInsT e
|
||||
Right e -> liftLowerFT $ freerEffects $ liftInsT e
|
||||
|
||||
-- | Transfer the effect to the underlying level.
|
||||
subsume ::
|
||||
(TransFreer c fr, SendIns e (FreerEffects fr u es f), Union u, c f) =>
|
||||
FreerEffects fr u (e ': es) f ~> FreerEffects fr u es f
|
||||
subsume = interpret sendIns
|
||||
{-# INLINE subsume #-}
|
||||
|
||||
-- | Transfer the effect to the lower carrier.
|
||||
subsumeLower ::
|
||||
(TransFreer c fr, SendIns e f, Union u, c f) =>
|
||||
FreerEffects fr u (e ': es) f ~> FreerEffects fr u es f
|
||||
subsumeLower = interpret $ liftLower . sendIns
|
||||
{-# INLINE subsumeLower #-}
|
||||
|
||||
-- | Lifts the lower carrier.
|
||||
liftLower :: (TransFreer c fr, c f) => f ~> FreerEffects fr u es f
|
||||
liftLower = freerEffects . liftLowerFT
|
||||
|
@ -713,6 +713,20 @@ interpretLowerH ::
|
||||
interpretLowerH f = overHeftiaEffects $ interpretLowerHT (unHeftiaEffects . f)
|
||||
{-# INLINE interpretLowerH #-}
|
||||
|
||||
-- | Transfer the higher-order effect to the underlying level.
|
||||
subsume ::
|
||||
( TransHeftia c h
|
||||
, MemberH u e es
|
||||
, UnionH u
|
||||
, HFunctor e
|
||||
, HFunctor (u es)
|
||||
, HFunctor (u (e : es))
|
||||
, c f
|
||||
) =>
|
||||
HeftiaEffects h u (e ': es) f ~> HeftiaEffects h u es f
|
||||
subsume = interpretH $ heftiaEffects . liftSigT . hfmap unHeftiaEffects . injectH
|
||||
{-# INLINE subsume #-}
|
||||
|
||||
-- | Lifts the lower carrier.
|
||||
liftLowerH :: (TransHeftia c h, c f, HFunctor (u es)) => f ~> HeftiaEffects h u es f
|
||||
liftLowerH = heftiaEffects . liftLowerHT
|
||||
|
Loading…
Reference in New Issue
Block a user