diff --git a/effectful-core/src/Effectful.hs b/effectful-core/src/Effectful.hs index 5e02b37d..bc83c155 100644 --- a/effectful-core/src/Effectful.hs +++ b/effectful-core/src/Effectful.hs @@ -7,6 +7,7 @@ module Effectful , Dispatch(..) , DispatchOf , (:>) + , (:>>) -- * Running the 'Eff' monad diff --git a/effectful-core/src/Effectful/Internal/Effect.hs b/effectful-core/src/Effectful/Internal/Effect.hs index 58714a83..84a0fa26 100644 --- a/effectful-core/src/Effectful/Internal/Effect.hs +++ b/effectful-core/src/Effectful/Internal/Effect.hs @@ -8,6 +8,7 @@ module Effectful.Internal.Effect ( Effect , (:>)(..) + , (:>>) -- * Re-exports , Type @@ -51,3 +52,13 @@ instance {-# OVERLAPPING #-} e :> (e : es) where instance e :> es => e :> (x : es) where reifyIndex = 1 + reifyIndex @e @es + +---------------------------------------- + +-- | Convenience operator for expressing that a function uses multiple effects +-- in a more concise way than enumerating them all with '(:>)'. +-- +-- @[E1, E2, ..., En] ':>>' es ≡ (E1 ':>' es, E2 ':>' es, ..., En :> es)@ +type family effs :>> es :: Constraint where + '[] :>> es = () + (e : effs) :>> es = (e :> es, effs :>> es) diff --git a/effectful-core/src/Effectful/Monad.hs b/effectful-core/src/Effectful/Monad.hs index 0e909cc9..0b7bccf0 100644 --- a/effectful-core/src/Effectful/Monad.hs +++ b/effectful-core/src/Effectful/Monad.hs @@ -8,6 +8,7 @@ module Effectful.Monad , Dispatch(..) , DispatchOf , (:>) + , (:>>) -- * Arbitrary I/O , IOE