1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 13:21:59 +03:00

Rename a bunch more type parameters.

This commit is contained in:
Rob Rix 2018-03-14 13:55:59 -04:00
parent 00549ae24b
commit 8ff194439c

View File

@ -16,28 +16,28 @@ run :: (Effectful m, RunEffects effects a) => m effects a -> Final effects a
run = Effect.run . runEffects . lower
-- | A typeclass to run a computation to completion, interpreting each effect with some sensible defaults.
class RunEffects fs a where
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 fs a
runEffects :: Eff fs a -> Eff '[] (Final fs a)
type Final effects a
runEffects :: Eff effects a -> Eff '[] (Final effects a)
instance (RunEffect f1 a, RunEffects (f2 ': fs) (Result f1 a)) => RunEffects (f1 ': f2 ': fs) a where
type Final (f1 ': f2 ': fs) a = Final (f2 ': fs) (Result f1 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)
runEffects = runEffects . runEffect
instance RunEffect f a => RunEffects '[f] a where
type Final '[f] a = Result f a
instance RunEffect effect a => RunEffects '[effect] a where
type Final '[effect] a = Result effect a
runEffects = runEffect
-- | A typeclass to interpret a single effect with some sensible defaults (defined per-effect).
class RunEffect f a where
class RunEffect effect a where
-- | The incremental result of an effect w.r.t. the parameter value, factoring in the interpretation of the effect.
type Result f a
type instance Result f a = a
type Result effect a
type instance Result effect a = a
-- | Interpret the topmost effect in a computation with some sensible defaults (defined per-effect), and return the incremental 'Result'.
runEffect :: Eff (f ': fs) a -> Eff fs (Result f a)
runEffect :: Eff (effect ': effects) a -> Eff effects (Result effect a)
-- | 'State' effects with 'Monoid'al states are interpreted starting from the 'mempty' state value into a pair of result value and final state.
instance Monoid b => RunEffect (State b) a where