From 10a1aa78b3f06682703f224344cf4609a92d2d4e Mon Sep 17 00:00:00 2001 From: Yamada Ryo Date: Sun, 3 Nov 2024 23:06:34 +0900 Subject: [PATCH] Update links for v0.5.0. --- README.md | 8 ++++---- cabal.project | 8 -------- heftia-effects/ChangeLog.md | 9 +++------ heftia-effects/heftia-effects.cabal | 4 +--- heftia/ChangeLog.md | 5 +++++ heftia/src/Control/Monad/Hefty.hs | 22 +++++++++++----------- 6 files changed, 24 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 16d7123..eee7586 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Heftia is an extensible effects library for Haskell that generalizes "Algebraic Effects and Handlers" to higher-order effects, providing users with maximum flexibility and delivering standard and reasonable speed. In its generalization, the focus is on ensuring predictable results based on simple, consistent semantics, while preserving soundness. -Please refer to the [Haddock documentation](https://hackage.haskell.org/package/heftia-0.4.0.0/docs/Control-Monad-Hefty.html) for usage and semantics. +Please refer to the [Haddock documentation](https://hackage.haskell.org/package/heftia-0.5.0.0/docs/Control-Monad-Hefty.html) for usage and semantics. For information on performance, please refer to [performance.md](https://github.com/sayo-hs/heftia/blob/v0.5.0/benchmark/performance.md). This library is inspired by the paper: @@ -67,7 +67,7 @@ If performance is particularly important, [`effectful`](https://github.com/haske * **Easy and Concise Implementation for Custom Effect Interpreters** - As you can see from the implementations of basic effect interpreters such as [State](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/src/Control.Monad.Hefty.State.html#runState), [Throw/Catch](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/src/Control.Monad.Hefty.Except.html#runThrow), [Writer](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/src/Control.Monad.Hefty.Writer.html#runTell), [NonDet](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/src/Control.Monad.Hefty.NonDet.html#runNonDet), and [Coroutine](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/src/Control.Monad.Hefty.Coroutine.html#runCoroutine), they can be implemented in just a few lines, or even a single line. Even for effects like NonDet and Coroutine, which involve continuations and might seem difficult to implement at first glance, this is exactly how simple it can be. This is the power of algebraic effects. Users can quickly define experimental and innovative custom effects using continuations. + As you can see from the implementations of basic effect interpreters such as [State](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/src/Control.Monad.Hefty.State.html#runState), [Throw/Catch](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/src/Control.Monad.Hefty.Except.html#runThrow), [Writer](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/src/Control.Monad.Hefty.Writer.html#runTell), [NonDet](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/src/Control.Monad.Hefty.NonDet.html#runNonDet), and [Coroutine](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/src/Control.Monad.Hefty.Coroutine.html#runCoroutine), they can be implemented in just a few lines, or even a single line. Even for effects like NonDet and Coroutine, which involve continuations and might seem difficult to implement at first glance, this is exactly how simple it can be. This is the power of algebraic effects. Users can quickly define experimental and innovative custom effects using continuations. * **Standard and Reasonable Performance** @@ -77,7 +77,7 @@ If performance is particularly important, [`effectful`](https://github.com/haske * Does not depend on the IO monad and can use any monad as the base monad. * Semantics are isolated from the IO monad, meaning that aspects like asynchronous exceptions and threads do not affect the behavior of effects. - * The constructors of the `Eff` monad are [exposed](https://hackage.haskell.org/package/heftia-0.4.0.0/docs/Control-Monad-Hefty.html#t:Eff), and users can manipulate them directly without any safety concerns. Still, the semantics remain intact. + * The constructors of the `Eff` monad are [exposed](https://hackage.haskell.org/package/heftia-0.5.0.0/docs/Control-Monad-Hefty.html#t:Eff), and users can manipulate them directly without any safety concerns. Still, the semantics remain intact. * These are in contrast to libraries like `effectful` and `eff`, making this library more **Haskell-ish and purely functional**. ## Downsides @@ -322,7 +322,7 @@ Sum {getSum = 10000} ``` ## Documentation -A detailed explanation of usage and semantics is available in [Haddock](https://hackage.haskell.org/package/heftia-0.4.0.0/docs/Control-Monad-Hefty.html). +A detailed explanation of usage and semantics is available in [Haddock](https://hackage.haskell.org/package/heftia-0.5.0.0/docs/Control-Monad-Hefty.html). The example codes are located in the [heftia-effects/Example/](https://github.com/sayo-hs/heftia/tree/v0.5.0/heftia-effects/Example) directory. Also, the following *HeftWorld* example (outdated): https://github.com/sayo-hs/HeftWorld diff --git a/cabal.project b/cabal.project index 3396408..43d6785 100644 --- a/cabal.project +++ b/cabal.project @@ -10,13 +10,5 @@ source-repository-package allow-newer: eff:primitive -source-repository-package - type: git - location: https://github.com/sayo-hs/data-effects - tag: 739db94528d66a94860e7130668b668075ad5f76 - subdir: data-effects-core - subdir: data-effects-th - subdir: data-effects - benchmarks: True tests: True diff --git a/heftia-effects/ChangeLog.md b/heftia-effects/ChangeLog.md index 8f9ce26..19a06a0 100644 --- a/heftia-effects/ChangeLog.md +++ b/heftia-effects/ChangeLog.md @@ -26,15 +26,12 @@ * Fixed an issue where builds would fail with Stack: https://github.com/sayo-hs/heftia/issues/15 -## 0.5.0.0 -- 2024-10-12 +## 0.5.0.0 -- 2024-11-03 * **New features** - * Added Concurrent/Parallel effects and Streaming functionality. + * Added Concurrent/Parallel effects, Streaming, and Subprocess functionality. * Added interpreters for the `co-log` ecosystem. -* **Breaking changes** - * Renamed `Control.Monad.Hefty.Provider.provide`/`provide_` -> `scope`/`scoped_` - * Renamed `Control.Monad.Hefty.Writer.listen` -> `intercept` - +* Renamed `Control.Monad.Hefty.Writer.listen` -> `intercept` * Reexported `Data.Effect.*` from the interpreters module `Control.Monad.Hefty.*`. * Generalized `runUnliftIO` to use any monad that is an instance of `MonadUnliftIO`. diff --git a/heftia-effects/heftia-effects.cabal b/heftia-effects/heftia-effects.cabal index 9cdf04f..6b91803 100644 --- a/heftia-effects/heftia-effects.cabal +++ b/heftia-effects/heftia-effects.cabal @@ -35,7 +35,7 @@ tested-with: source-repository head type: git location: https://github.com/sayo-hs/heftia - tag: v0.4.0.1 + tag: v0.5.0 subdir: heftia-effects common common-base @@ -62,9 +62,7 @@ common common-base unbounded-delays ^>= 0.1.1, ghc-typelits-knownnat ^>= 0.7, containers > 0.6.5 && < 0.8, - these, co-log-core, - random, process, bytestring, text, diff --git a/heftia/ChangeLog.md b/heftia/ChangeLog.md index 97d54a2..4afa8e3 100644 --- a/heftia/ChangeLog.md +++ b/heftia/ChangeLog.md @@ -27,3 +27,8 @@ * The interface is largely the same as before, but names have been changed throughout. * Dropped support for GHC 9.2.8, now supporting GHC 9.4.1 and later. * Added detailed explanations on how to use Heftia and its semantics to the Haddock documentation of the `Control.Monad.Hefty` module. + +## 0.5.0.0 -- 2024-11-03 + +* Fixed a bug in the lookup of keyed effects. +* Added missing functions such as `key`, `keyH`, `raiseAll`, and `raiseAllH`. diff --git a/heftia/src/Control/Monad/Hefty.hs b/heftia/src/Control/Monad/Hefty.hs index 12451c8..bcd7d7f 100644 --- a/heftia/src/Control/Monad/Hefty.hs +++ b/heftia/src/Control/Monad/Hefty.hs @@ -80,10 +80,10 @@ prog = 'runEff' . runLog . runSpan $ do Elaboration is generally performed by editing first-order (or higher-order) effectful operations within the computation held by the higher-order effect being elaborated. @ - [runCatch](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-Except.html#v:runCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => 'Eff' '[@t'Data.Effect.Except.Catch'@ e] ef t'Control.Effect.~>' 'Eff' '[] ef + [runCatch](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-Except.html#v:runCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => 'Eff' '[@t'Data.Effect.Except.Catch'@ e] ef t'Control.Effect.~>' 'Eff' '[] ef runCatch = 'interpretH' elabCatch - [elabCatch](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-Except.html#v:elabCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => t'Data.Effect.Except.Catch' e t'Control.Monad.Hefty.~~>' 'Eff' '[] ef + [elabCatch](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-Except.html#v:elabCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => t'Data.Effect.Except.Catch' e t'Control.Monad.Hefty.~~>' 'Eff' '[] ef elabCatch (@v'Data.Effect.Except.Catch'@ action hdl) = action & 'interposeWith' \\(@v'Data.Effect.Except.Throw'@ e) _ -> hdl e @ @@ -106,10 +106,10 @@ prog = 'runEff' . runLog . runSpan $ do By ignoring the continuation argument, it allows for global escapes like the 'Data.Effect.Except.Throw' effect. @ - [runThrow](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-Except.html#v:runThrow) :: 'Eff' '[] (@t'Data.Effect.Except.Throw'@ e ': r) a -> 'Eff' '[] r ('Either' e a) + [runThrow](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-Except.html#v:runThrow) :: 'Eff' '[] (@t'Data.Effect.Except.Throw'@ e ': r) a -> 'Eff' '[] r ('Either' e a) runThrow = 'interpretBy' ('pure' '.' 'Right') handleThrow - [handleThrow](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-Except.html#v:handleThrow) :: 'Interpreter' (@t'Data.Effect.Except.Throw'@ e) ('Eff' '[] r) ('Either' e a) + [handleThrow](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-Except.html#v:handleThrow) :: 'Interpreter' (@t'Data.Effect.Except.Throw'@ e) ('Eff' '[] r) ('Either' e a) handleThrow (@v'Data.Effect.Except.Throw'@ e) _ = 'pure' $ 'Left' e @ @@ -118,7 +118,7 @@ prog = 'runEff' . runLog . runSpan $ do By calling the continuation argument multiple times, it allows for non-deterministic computations like the "Data.Effect.NonDet" effect. @ - [runNonDet](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-NonDet.html#v:runNonDet) + [runNonDet](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-NonDet.html#v:runNonDet) :: forall f ef a . ('Alternative' f) => 'Eff' '[] (@t'Data.Effect.NonDet.Choose'@ ': t'Data.Effect.NonDet.Empty' ': ef) a @@ -228,10 +228,10 @@ By properly understanding and becoming familiar with this semantics, users can q Let's revisit the definition of @runCatch@: @ -[runCatch](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-Except.html#v:runCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => 'Eff' '[@t'Data.Effect.Except.Catch'@ e] ef t'Control.Effect.~>' 'Eff' '[] ef +[runCatch](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-Except.html#v:runCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => 'Eff' '[@t'Data.Effect.Except.Catch'@ e] ef t'Control.Effect.~>' 'Eff' '[] ef runCatch = 'interpretH' elabCatch -[elabCatch](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-Except.html#v:elabCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => t'Data.Effect.Except.Catch' e t'Control.Monad.Hefty.~~>' 'Eff' '[] ef +[elabCatch](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-Except.html#v:elabCatch) :: (@t'Data.Effect.Except.Throw'@ e t'Data.Effect.OpenUnion.<|' ef) => t'Data.Effect.Except.Catch' e t'Control.Monad.Hefty.~~>' 'Eff' '[] ef elabCatch (@v'Data.Effect.Except.Catch'@ action hdl) = action & 'interposeWith' \\(@v'Data.Effect.Except.Throw'@ e) _ -> hdl e @ @@ -322,13 +322,13 @@ This is a significant difference from 'IO'-fused effect system libraries like [e When performing recursive continuational stateful interpretation, that is, when using functions with @Rec@, it's necessary to understand their semantics. If you are not using @Rec@ functions, you don't need to pay particular attention to this section. -[@runStateRec@](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-State.html#v:runStateRec) is a variant of - [@runState@](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-State.html#v:runState), +[@runStateRec@](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-State.html#v:runStateRec) is a variant of + [@runState@](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-State.html#v:runState), a handler for the @State@ effect that can be used even when higher-order effects are unelaborated: @ -[@runStateRec@](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-State.html#v:runStateRec) :: 'Eff' eh (@t'Data.Effect.State.State'@ s ': ef) t'Control.Effect.~>' 'Eff' eh ef -[@runState@](https://hackage.haskell.org/package/heftia-effects-0.4.0.0/docs/Control-Monad-Hefty-State.html#v:runState) :: 'Eff' '[] (@t'Data.Effect.State.State'@ s ': ef) t'Control.Effect.~>' 'Eff' '[] ef +[@runStateRec@](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-State.html#v:runStateRec) :: 'Eff' eh (@t'Data.Effect.State.State'@ s ': ef) t'Control.Effect.~>' 'Eff' eh ef +[@runState@](https://hackage.haskell.org/package/heftia-effects-0.5.0.0/docs/Control-Monad-Hefty-State.html#v:runState) :: 'Eff' '[] (@t'Data.Effect.State.State'@ s ': ef) t'Control.Effect.~>' 'Eff' '[] ef @ @runStateRec@ uses @Rec@ functions internally. When a function uses @Rec@ functions internally, it's best to reflect that in its naming.