Skip to content

Commit

Permalink
Add :>> for more concise type signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
arybczak committed Jan 22, 2022
1 parent e9be11e commit 938550b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions effectful-core/src/Effectful.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Effectful
, Dispatch(..)
, DispatchOf
, (:>)
, (:>>)

-- * Running the 'Eff' monad

Expand Down
11 changes: 11 additions & 0 deletions effectful-core/src/Effectful/Internal/Effect.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
module Effectful.Internal.Effect
( Effect
, (:>)(..)
, (:>>)

-- * Re-exports
, Type
Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions effectful-core/src/Effectful/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Effectful.Monad
, Dispatch(..)
, DispatchOf
, (:>)
, (:>>)

-- * Arbitrary I/O
, IOE
Expand Down

0 comments on commit 938550b

Please # to comment.