dep-t-advice 0.2.0.0 → 0.2.0.1
raw patch · 3 files changed
+13/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +8/−6
- dep-t-advice.cabal +1/−1
- lib/Control/Monad/Dep/Advice.hs +4/−5
README.md view
@@ -70,13 +70,15 @@ arguments*. The same advice will work for functions with `0`, `1` or `N` arguments. -Advices are parameterized by the constraints they require of the function: +Advices can't change the type of a function, but they might: -- The function arguments. "All the arguments must be showable". -- The `DepT` environment and the base monad. "The environment must have a - logger, and the base monad must have a `MonadIO` instance." -- The function return type. "The function must return a type that is a - `Monoid`." +- Analyze and change the values of the function's arguments. + +- Add additional effects to the function, either effects from the base monad, or effects from handlers found in the environment. + +- Change the result value of the function. + +- Sidestep the execution of the function altogeher, providing al alternative result. Here's how a `printArgs` advice might be defined:
dep-t-advice.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: dep-t-advice -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Giving good advice to functions in a DepT environment. description: Companion to the dep-t package. Easily add behaviour to functions living in a DepT environment, whatever the number of arguments they might have.
lib/Control/Monad/Dep/Advice.hs view
@@ -144,9 +144,9 @@ -- provided the functions satisfy certain constraint @ca@ of kind @Type -> -- Constraint@ on all of their arguments. -- --- Note that the environment @e@ must be parameterizable by a monad, and the type --- constructor is given unapplied. That is, @Advice Show NilEnv IO ()@ --- kind-checks but @Advice Show (NilEnv IO) IO ()@ doesn't. See also 'Ensure'. +-- Note that the type constructor for the environment @e@ is given unapplied. +-- That is, @Advice Show NilEnv IO ()@ kind-checks but @Advice Show (NilEnv IO) +-- IO ()@ doesn't. See also 'Ensure'. -- -- 'Advice's that don't care about the @ca@ constraint (because they don't -- touch function arguments) can leave it polymorphic, and this facilitates @@ -485,8 +485,7 @@ -- automatically "collected" during composition. -- -- Instead, we need to harmonize the @ca@ constraints of each 'Advice' by turning them --- into the combination of all constraints. 'restrictArgs' help with that. --- help with that. +-- into the combination of all constraints. 'restrictArgs' helps with that. -- -- 'restrictArgs' takes as parameter evidence of entailment between @ca@ -- constraints, using the type '(:-)' from the \"constraints\" package. But