packages feed

heftia-effects 0.3.0.0 → 0.3.1.0

raw patch · 2 files changed

+36/−16 lines, 2 filesdep ~data-effectsdep ~heftiadep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: data-effects, heftia, text

API changes (from Hackage documentation)

Files

README.md view
@@ -188,25 +188,45 @@ * Effect System: For a term representing an effectful program, is it possible to statically decidable a type that enumerates all the effects the program may produce? * Purely Monadic: Is an effectful program represented as a transparent data structure that is a monad, and can it be interpreted into other data types using only pure operations without side effects or `unsafePerformIO`? * Dynamic Effect Rewriting: Can an effectful program have its internal effects altered afterwards (by functions typically referred to as `handle with`, `intercept`, `interpose`, `transform`, `translate`, or `rewrite`) ?++    For example, would it be possible to apply `interpose` as many times as the number of values input by the user at runtime?++* Semantics: Classification of behaviors resulting from the interpretation of effects.++    * continuation-based: The same as Algebraic Effects and Handlers.+    * IO-based: IO + Reader pattern.+    * carrier dependent: The behavior depends on the specific type inference result of the monad. Tagless-final style.+ * Performance: Time complexity or space complexity. -| Library or Language | Higher-Order Effects | Delimited Continuation | Effect System | Purely Monadic                    | Dynamic Effect Rewriting | Performance (TODO) |-| ------------------- | -------------------- | ---------------------- | --------------| --------------------------------- | ------------------------ | ------------------ |-| Heftia              | Yes                  | Multi-shot             | Yes           | Yes (also Applicative and others) | Yes                      | ?                  |-| freer-simple        | No                   | Multi-shot             | Yes           | Yes                               | Yes                      | ?                  |-| Polysemy            | Yes                  | No                     | Yes           | Yes                               | Yes                      | ?                  |-| Effectful           | Yes                  | No                     | Yes           | No (based on the `IO` monad)      | Yes                      | ?                  |-| eff                 | Yes                  | Multi-shot?            | Yes           | No (based on the `IO` monad)      | Yes                      | Fast               |-| mtl                 | Yes                  | Multi-shot (`ContT`)   | Yes           | Yes                               | No                       | ?                  |-| fused-effects       | Yes                  | No?                    | Yes           | Yes                               | No                       | ?                  |-| koka-lang           | No [^2]              | Multi-shot             | Yes           | No (language built-in)            | Yes                      | ?                  |-| OCaml-lang 5        | ?                    | One-shot               | No [^3]       | No (language built-in)            | ?                        | ?                  |+| Library or Language | Higher-Order Effects | Delimited Continuation | Effect System | Purely Monadic                    | Dynamic Effect Rewriting | Semantics                        | Performance (TODO) |+| ------------------- | -------------------- | ---------------------- | --------------| --------------------------------- | ------------------------ | -------------------------------- | ------------------ |+| Heftia              | Yes                  | Multi-shot             | Yes           | Yes (also Applicative and others) | Yes                      | continuation-based               | ?                  |+| freer-simple        | No                   | Multi-shot             | Yes           | Yes                               | Yes                      | continuation-based               | ?                  |+| Polysemy            | Yes                  | No                     | Yes           | Yes                               | Yes                      | weaving-based (functorial state) | ?                  |+| Effectful           | Yes                  | No                     | Yes           | No (based on the `IO` monad)      | Yes                      | IO-based                         | ?                  |+| eff                 | Yes                  | Multi-shot?            | Yes           | No (based on the `IO` monad)      | Yes                      | continuation-based (IO-fused)    | ?                  |+| in-other-words      | Yes                  | Multi-shot?            | Yes           | Yes                               | No?                      | carrier dependent                | ?                  |+| mtl                 | Yes                  | Multi-shot (`ContT`)   | Yes           | Yes                               | No                       | carrier dependent                | ?                  |+| fused-effects       | Yes                  | No?                    | Yes           | Yes                               | No                       | carrier dependent & weaving-based (functorial state) | ?                  |+| koka-lang           | No [^2]              | Multi-shot             | Yes           | No (language built-in)            | Yes                      | continuation-based               | ?                  |+| OCaml-lang 5        | ?                    | One-shot               | No [^3]       | No (language built-in)            | ?                        | continuation-based?              | ?                  |  [^2]: https://gist.github.com/ymdryo/6fb2f7f4020c6fcda98ccc67c090dc75 [^3]: Effects do not appear in the type signature and can potentially cause unhandled errors at runtime  Heftia can simply be described as a higher-order version of freer-simple. This is indeed true in terms of its internal mechanisms as well.++Additionally, this library provides a consistent *continuation-based* semantics that is independent of carriers and effects.+On the other hand, in libraries like in-other-words, mtl, and fused-effects, the semantics of the code depend on the effect and, in part, the carrier inferred by type inference.+Fixing the semantics to a *continuation-based* model helps improve the predictability of the behavior (interpretation result) of the code.++Carrier-dependent semantics can lead to unexpected behavior for code readers, particularly in situations where the types become implicit.+Particularly, attention should be given to the fact that due to type inference, semantic changes may propagate beyond the blocks enclosed by `interpret` or `interpose`.+In the case of carrier-independent semantics, especially with Freer-based effects, `interpret` and `interpose` do not alter the semantics by intervening in type inference or instance resolution of the carrier.+Instead, they function as traditional functions, simply transforming the content of the data structure.+This results in minimal surprise to the mental model of the code reader.  ### Compatibility with other libraries #### Representation of effects
heftia-effects.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               heftia-effects-version:            0.3.0.0+version:            0.3.1.0  -- A short (one-line) description of the package. synopsis: higher-order effects done right@@ -20,7 +20,7 @@ maintainer:         Yamada Ryo <ymdfield@outlook.jp>  -- A copyright notice.-copyright: 2023 Yamada Ryo+copyright: 2023-2024 Yamada Ryo category: Control, Effect, Monads  extra-source-files:@@ -55,8 +55,8 @@     build-depends:         base ^>= 4.16,         ghc-typelits-knownnat ^>= 0.7,-        data-effects ^>= 0.1.1,-        heftia ^>= 0.3,+        data-effects ^>= 0.1.2,+        heftia ^>= 0.3.1,      ghc-options: -Wall -fplugin GHC.TypeLits.KnownNat.Solver @@ -191,7 +191,7 @@     hs-source-dirs: Example/Logging     build-depends:         heftia-effects,-        text ^>= 1.2.5,+        text >= 2.0 && < 2.2,         time ^>= 1.11.1,  executable Continuation