diff --git a/src/Control/Abstract/Analysis.hs b/src/Control/Abstract/Analysis.hs index 8393e5a2f..9271b9527 100644 --- a/src/Control/Abstract/Analysis.hs +++ b/src/Control/Abstract/Analysis.hs @@ -13,7 +13,6 @@ module Control.Abstract.Analysis import Control.Abstract.Evaluator as X import Control.Effect as X -import qualified Control.Monad.Effect as Effect import Control.Monad.Effect.Fail as X import Control.Monad.Effect.Fresh as X import Control.Monad.Effect.NonDet as X @@ -100,4 +99,4 @@ runAnalysis :: ( Effectful m ) => m effects a -> Final effects a -runAnalysis = Effect.run . runEffects . lower +runAnalysis = runEffects . lower diff --git a/src/Control/Effect.hs b/src/Control/Effect.hs index e46ac6708..aaf41ba56 100644 --- a/src/Control/Effect.hs +++ b/src/Control/Effect.hs @@ -13,21 +13,21 @@ import Prologue -- | Run an 'Effectful' computation to completion, interpreting each effect with some sensible defaults, and return the 'Final' result. run :: (Effectful m, RunEffects effects a) => m effects a -> Final effects a -run = Effect.run . runEffects . lower +run = runEffects . lower -- | A typeclass to run a computation to completion, interpreting each effect with some sensible defaults. class RunEffects effects a where -- | The final result type of the computation, factoring in the results of any effects, e.g. pairing 'State' results with the final state, wrapping 'Fail' results in 'Either', etc. type Final effects a - runEffects :: Eff effects a -> Eff '[] (Final effects a) + runEffects :: Eff effects a -> Final effects a -instance (RunEffect effect1 a, RunEffects (effect2 ': effects) (Result effect1 a)) => RunEffects (effect1 ': effect2 ': effects) a where - type Final (effect1 ': effect2 ': effects) a = Final (effect2 ': effects) (Result effect1 a) +instance (RunEffect effect1 a, RunEffects effects (Result effect1 a)) => RunEffects (effect1 ': effects) a where + type Final (effect1 ': effects) a = Final effects (Result effect1 a) runEffects = runEffects . runEffect -instance RunEffect effect a => RunEffects '[effect] a where - type Final '[effect] a = Result effect a - runEffects = runEffect +instance RunEffects '[] a where + type Final '[] a = a + runEffects = Effect.run -- | A typeclass to interpret a single effect with some sensible defaults (defined per-effect).