data-effects-core 0.1.0.0 → 0.2.0.0
raw patch · 11 files changed
+107/−100 lines, 11 filesdep ~basedep ~compdatadep ~mtlPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, compdata, mtl, tasty
API changes (from Hackage documentation)
- Control.Effect: class SendIns (ins :: InsClass) f
- Control.Effect: class SendSig (sig :: SigClass) f
- Control.Effect: instance Control.Effect.SendIns ins f => Control.Effect.SendSig (Data.Effect.LiftIns ins) f
- Control.Effect: sendIns :: SendIns ins f => ins a -> f a
- Control.Effect: sendSig :: SendSig sig f => sig f a -> f a
- Control.Effect.Key: class SendInsBy key (ins :: InsClass) f | key f -> ins
- Control.Effect.Key: class SendSigBy key (sig :: SigClass) f | key f -> sig
- Control.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.InsClass) (f :: * -> *). Control.Effect.Key.SendInsBy key ins f => Control.Effect.SendIns ins (Control.Effect.Key.ByKey key f)
- Control.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.SigClass) (f :: * -> *). (Control.Effect.Key.SendSigBy key sig f, Data.Comp.Multi.HFunctor.HFunctor sig) => Control.Effect.SendSig sig (Control.Effect.Key.ByKey key f)
- Control.Effect.Key: sendInsBy :: SendInsBy key ins f => ins a -> f a
- Control.Effect.Key: sendSigBy :: SendSigBy key sig f => sig f a -> f a
- Control.Effect.Tag: instance forall k (ins :: Data.Effect.InsClass) (tag :: k) (f :: * -> *). Control.Effect.SendIns (ins Data.Effect.Tag.# tag) f => Control.Effect.SendIns ins (Control.Effect.Tag.ViaTag tag f)
- Control.Effect.Tag: instance forall k (sig :: Data.Effect.SigClass) (tag :: k) (f :: * -> *). (Control.Effect.SendSig (sig Data.Effect.Tag.## tag) f, Data.Comp.Multi.HFunctor.HFunctor sig) => Control.Effect.SendSig sig (Control.Effect.Tag.ViaTag tag f)
- Control.Effect.Tag: instance forall k1 k2 (key :: k1) (ins :: Data.Effect.InsClass) (tag :: k2) (f :: * -> *). Control.Effect.Key.SendInsBy key (ins Data.Effect.Tag.# tag) f => Control.Effect.Key.SendInsBy key ins (Control.Effect.Tag.ViaTag tag f)
- Control.Effect.Tag: instance forall k1 k2 (key :: k1) (sig :: Data.Effect.SigClass) (tag :: k2) (f :: * -> *). (Control.Effect.Key.SendSigBy key (sig Data.Effect.Tag.## tag) f, Data.Comp.Multi.HFunctor.HFunctor sig) => Control.Effect.Key.SendSigBy key sig (Control.Effect.Tag.ViaTag tag f)
- Data.Effect: LiftIns :: ins a -> LiftIns (ins :: InsClass) (f :: Type -> Type) a
- Data.Effect: [unliftIns] :: LiftIns (ins :: InsClass) (f :: Type -> Type) a -> ins a
- Data.Effect: instance Data.Comp.Multi.HFunctor.HFunctor (Data.Effect.LiftIns ins)
- Data.Effect: instance Data.Foldable.Foldable ins => Data.Foldable.Foldable (Data.Effect.LiftIns ins f)
- Data.Effect: instance Data.Traversable.Traversable ins => Data.Traversable.Traversable (Data.Effect.LiftIns ins f)
- Data.Effect: instance GHC.Base.Functor ins => GHC.Base.Functor (Data.Effect.LiftIns ins f)
- Data.Effect: newtype LiftIns (ins :: InsClass) (f :: Type -> Type) a
- Data.Effect: type InsClass = Type -> Type
- Data.Effect: type SigClass = (Type -> Type) -> Type -> Type
- Data.Effect.HFunctor.HCont: infixr 8 ~~>
- Data.Effect.HFunctor.HCont: type (~~>) = HCont
- Data.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.InsClass). Data.Foldable.Foldable ins => Data.Foldable.Foldable (Data.Effect.Key.Key key ins)
- Data.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.InsClass). Data.Traversable.Traversable ins => Data.Traversable.Traversable (Data.Effect.Key.Key key ins)
- Data.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.InsClass). GHC.Base.Functor ins => GHC.Base.Functor (Data.Effect.Key.Key key ins)
- Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.SigClass) (f :: * -> *). Data.Foldable.Foldable (sig f) => Data.Foldable.Foldable (Data.Effect.Key.KeyH key sig f)
- Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.SigClass) (f :: * -> *). Data.Traversable.Traversable (sig f) => Data.Traversable.Traversable (Data.Effect.Key.KeyH key sig f)
- Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.SigClass) (f :: * -> *). GHC.Base.Functor (sig f) => GHC.Base.Functor (Data.Effect.Key.KeyH key sig f)
- Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.SigClass). Data.Comp.Multi.HFunctor.HFunctor sig => Data.Comp.Multi.HFunctor.HFunctor (Data.Effect.Key.KeyH key sig)
- Data.Effect.Tag: instance forall (ins :: Data.Effect.InsClass) k (tag :: k). Data.Foldable.Foldable ins => Data.Foldable.Foldable (Data.Effect.Tag.Tag ins tag)
- Data.Effect.Tag: instance forall (ins :: Data.Effect.InsClass) k (tag :: k). Data.Traversable.Traversable ins => Data.Traversable.Traversable (Data.Effect.Tag.Tag ins tag)
- Data.Effect.Tag: instance forall (ins :: Data.Effect.InsClass) k (tag :: k). GHC.Base.Functor ins => GHC.Base.Functor (Data.Effect.Tag.Tag ins tag)
- Data.Effect.Tag: instance forall (sig :: Data.Effect.SigClass) k (tag :: k) (f :: * -> *). Data.Foldable.Foldable (sig f) => Data.Foldable.Foldable (Data.Effect.Tag.TagH sig tag f)
- Data.Effect.Tag: instance forall (sig :: Data.Effect.SigClass) k (tag :: k) (f :: * -> *). Data.Traversable.Traversable (sig f) => Data.Traversable.Traversable (Data.Effect.Tag.TagH sig tag f)
- Data.Effect.Tag: instance forall (sig :: Data.Effect.SigClass) k (tag :: k) (f :: * -> *). GHC.Base.Functor (sig f) => GHC.Base.Functor (Data.Effect.Tag.TagH sig tag f)
- Data.Effect.Tag: instance forall (sig :: Data.Effect.SigClass) k (tag :: k). Data.Comp.Multi.HFunctor.HFunctor sig => Data.Comp.Multi.HFunctor.HFunctor (Data.Effect.Tag.TagH sig tag)
+ Control.Effect: class SendFOE (ins :: EffectF) (f :: Type -> Type)
+ Control.Effect: class SendHOE (sig :: EffectH) (f :: Type -> Type)
+ Control.Effect: instance Control.Effect.SendFOE ins f => Control.Effect.SendHOE (Data.Effect.LiftFOE ins) f
+ Control.Effect: sendFOE :: SendFOE ins f => ins a -> f a
+ Control.Effect: sendHOE :: SendHOE sig f => sig f a -> f a
+ Control.Effect.Key: class SendFOEBy (key :: k) (ins :: EffectF) (f :: Type -> Type) | key f -> ins
+ Control.Effect.Key: class SendHOEBy (key :: k) (sig :: EffectH) (f :: Type -> Type) | key f -> sig
+ Control.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.EffectF) (f :: * -> *). Control.Effect.Key.SendFOEBy key ins f => Control.Effect.SendFOE ins (Control.Effect.Key.ByKey key f)
+ Control.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.EffectH) (f :: * -> *). (Control.Effect.Key.SendHOEBy key sig f, Data.Comp.Multi.HFunctor.HFunctor sig) => Control.Effect.SendHOE sig (Control.Effect.Key.ByKey key f)
+ Control.Effect.Key: sendFOEBy :: SendFOEBy key ins f => ins a -> f a
+ Control.Effect.Key: sendHOEBy :: SendHOEBy key sig f => sig f a -> f a
+ Control.Effect.Tag: instance forall k (ins :: Data.Effect.EffectF) (tag :: k) (f :: * -> *). Control.Effect.SendFOE (ins Data.Effect.Tag.# tag) f => Control.Effect.SendFOE ins (Control.Effect.Tag.ViaTag tag f)
+ Control.Effect.Tag: instance forall k (sig :: Data.Effect.EffectH) (tag :: k) (f :: * -> *). (Control.Effect.SendHOE (sig Data.Effect.Tag.## tag) f, Data.Comp.Multi.HFunctor.HFunctor sig) => Control.Effect.SendHOE sig (Control.Effect.Tag.ViaTag tag f)
+ Control.Effect.Tag: instance forall k1 k2 (key :: k1) (ins :: Data.Effect.EffectF) (tag :: k2) (f :: * -> *). Control.Effect.Key.SendFOEBy key (ins Data.Effect.Tag.# tag) f => Control.Effect.Key.SendFOEBy key ins (Control.Effect.Tag.ViaTag tag f)
+ Control.Effect.Tag: instance forall k1 k2 (key :: k1) (sig :: Data.Effect.EffectH) (tag :: k2) (f :: * -> *). (Control.Effect.Key.SendHOEBy key (sig Data.Effect.Tag.## tag) f, Data.Comp.Multi.HFunctor.HFunctor sig) => Control.Effect.Key.SendHOEBy key sig (Control.Effect.Tag.ViaTag tag f)
+ Data.Effect: LiftFOE :: ins a -> LiftFOE (ins :: EffectF) (f :: Type -> Type) a
+ Data.Effect: [unliftFOE] :: LiftFOE (ins :: EffectF) (f :: Type -> Type) a -> ins a
+ Data.Effect: instance Data.Comp.Multi.HFunctor.HFunctor (Data.Effect.LiftFOE ins)
+ Data.Effect: instance Data.Foldable.Foldable ins => Data.Foldable.Foldable (Data.Effect.LiftFOE ins f)
+ Data.Effect: instance Data.Traversable.Traversable ins => Data.Traversable.Traversable (Data.Effect.LiftFOE ins f)
+ Data.Effect: instance GHC.Base.Functor ins => GHC.Base.Functor (Data.Effect.LiftFOE ins f)
+ Data.Effect: newtype LiftFOE (ins :: EffectF) (f :: Type -> Type) a
+ Data.Effect: type EffectF = Type -> Type
+ Data.Effect: type EffectH = Type -> Type -> Type -> Type
+ Data.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.EffectF). Data.Foldable.Foldable ins => Data.Foldable.Foldable (Data.Effect.Key.Key key ins)
+ Data.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.EffectF). Data.Traversable.Traversable ins => Data.Traversable.Traversable (Data.Effect.Key.Key key ins)
+ Data.Effect.Key: instance forall k (key :: k) (ins :: Data.Effect.EffectF). GHC.Base.Functor ins => GHC.Base.Functor (Data.Effect.Key.Key key ins)
+ Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.EffectH) (f :: * -> *). Data.Foldable.Foldable (sig f) => Data.Foldable.Foldable (Data.Effect.Key.KeyH key sig f)
+ Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.EffectH) (f :: * -> *). Data.Traversable.Traversable (sig f) => Data.Traversable.Traversable (Data.Effect.Key.KeyH key sig f)
+ Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.EffectH) (f :: * -> *). GHC.Base.Functor (sig f) => GHC.Base.Functor (Data.Effect.Key.KeyH key sig f)
+ Data.Effect.Key: instance forall k (key :: k) (sig :: Data.Effect.EffectH). Data.Comp.Multi.HFunctor.HFunctor sig => Data.Comp.Multi.HFunctor.HFunctor (Data.Effect.Key.KeyH key sig)
+ Data.Effect.Tag: instance forall (ins :: Data.Effect.EffectF) k (tag :: k). Data.Foldable.Foldable ins => Data.Foldable.Foldable (Data.Effect.Tag.Tag ins tag)
+ Data.Effect.Tag: instance forall (ins :: Data.Effect.EffectF) k (tag :: k). Data.Traversable.Traversable ins => Data.Traversable.Traversable (Data.Effect.Tag.Tag ins tag)
+ Data.Effect.Tag: instance forall (ins :: Data.Effect.EffectF) k (tag :: k). GHC.Base.Functor ins => GHC.Base.Functor (Data.Effect.Tag.Tag ins tag)
+ Data.Effect.Tag: instance forall (sig :: Data.Effect.EffectH) k (tag :: k) (f :: * -> *). Data.Foldable.Foldable (sig f) => Data.Foldable.Foldable (Data.Effect.Tag.TagH sig tag f)
+ Data.Effect.Tag: instance forall (sig :: Data.Effect.EffectH) k (tag :: k) (f :: * -> *). Data.Traversable.Traversable (sig f) => Data.Traversable.Traversable (Data.Effect.Tag.TagH sig tag f)
+ Data.Effect.Tag: instance forall (sig :: Data.Effect.EffectH) k (tag :: k) (f :: * -> *). GHC.Base.Functor (sig f) => GHC.Base.Functor (Data.Effect.Tag.TagH sig tag f)
+ Data.Effect.Tag: instance forall (sig :: Data.Effect.EffectH) k (tag :: k). Data.Comp.Multi.HFunctor.HFunctor sig => Data.Comp.Multi.HFunctor.HFunctor (Data.Effect.Tag.TagH sig tag)
- Control.Effect: type (<<:) = SendSig
+ Control.Effect: type (<<:) = SendHOE
- Control.Effect: type f ~> g = forall (x :: Type). f x -> g x
+ Control.Effect: type (f :: Type -> Type) ~> (g :: Type -> Type) = forall x. () => f x -> g x
- Control.Effect.Key: ByKey :: f a -> ByKey key (f :: Type -> Type) a
+ Control.Effect.Key: ByKey :: f a -> ByKey (key :: k) (f :: Type -> Type) a
- Control.Effect.Key: [runByKey] :: ByKey key (f :: Type -> Type) a -> f a
+ Control.Effect.Key: [runByKey] :: ByKey (key :: k) (f :: Type -> Type) a -> f a
- Control.Effect.Key: key :: forall key f a. ByKey key f a -> f a
+ Control.Effect.Key: key :: forall {k} (key :: k) f a. ByKey key f a -> f a
- Control.Effect.Key: newtype ByKey key (f :: Type -> Type) a
+ Control.Effect.Key: newtype ByKey (key :: k) (f :: Type -> Type) a
- Control.Effect.Tag: ViaTag :: f a -> ViaTag tag (f :: Type -> Type) a
+ Control.Effect.Tag: ViaTag :: f a -> ViaTag (tag :: k) (f :: Type -> Type) a
- Control.Effect.Tag: [runViaTag] :: ViaTag tag (f :: Type -> Type) a -> f a
+ Control.Effect.Tag: [runViaTag] :: ViaTag (tag :: k) (f :: Type -> Type) a -> f a
- Control.Effect.Tag: newtype ViaTag tag (f :: Type -> Type) a
+ Control.Effect.Tag: newtype ViaTag (tag :: k) (f :: Type -> Type) a
- Control.Effect.Tag: tag :: forall tag f a. ViaTag tag f a -> f a
+ Control.Effect.Tag: tag :: forall {k} (tag :: k) f a. ViaTag tag f a -> f a
- Data.Effect: data Nop :: InsClass
+ Data.Effect: data Nop a
- Data.Effect: type LNop = LiftIns Nop
+ Data.Effect: type LNop = LiftFOE Nop
- Data.Effect.HFunctor.HCont: HCont :: ((f ~> b) -> ff b a) -> HCont ff b f (a :: Type)
+ Data.Effect.HFunctor.HCont: HCont :: ((f ~> b) -> ff b a) -> HCont (ff :: (Type -> Type) -> Type -> Type) (b :: Type -> Type) (f :: Type -> Type) a
- Data.Effect.HFunctor.HCont: [unHCont] :: HCont ff b f (a :: Type) -> (f ~> b) -> ff b a
+ Data.Effect.HFunctor.HCont: [unHCont] :: HCont (ff :: (Type -> Type) -> Type -> Type) (b :: Type -> Type) (f :: Type -> Type) a -> (f ~> b) -> ff b a
- Data.Effect.HFunctor.HCont: newtype HCont ff b f (a :: Type)
+ Data.Effect.HFunctor.HCont: newtype HCont (ff :: Type -> Type -> Type -> Type) (b :: Type -> Type) (f :: Type -> Type) a
- Data.Effect.Key: Key :: ins a -> Key key (ins :: InsClass) a
+ Data.Effect.Key: Key :: ins a -> Key (key :: k) (ins :: EffectF) a
- Data.Effect.Key: KeyH :: sig f a -> KeyH key (sig :: SigClass) f a
+ Data.Effect.Key: KeyH :: sig f a -> KeyH (key :: k) (sig :: EffectH) (f :: Type -> Type) a
- Data.Effect.Key: [unKeyH] :: KeyH key (sig :: SigClass) f a -> sig f a
+ Data.Effect.Key: [unKeyH] :: KeyH (key :: k) (sig :: EffectH) (f :: Type -> Type) a -> sig f a
- Data.Effect.Key: [unKey] :: Key key (ins :: InsClass) a -> ins a
+ Data.Effect.Key: [unKey] :: Key (key :: k) (ins :: EffectF) a -> ins a
- Data.Effect.Key: newtype Key key (ins :: InsClass) a
+ Data.Effect.Key: newtype Key (key :: k) (ins :: EffectF) a
- Data.Effect.Key: newtype KeyH key (sig :: SigClass) f a
+ Data.Effect.Key: newtype KeyH (key :: k) (sig :: EffectH) (f :: Type -> Type) a
- Data.Effect.Key: pattern K :: forall key ins a. ins a -> Key key ins a
+ Data.Effect.Key: pattern K :: forall {k} key ins a. ins a -> Key key ins a
- Data.Effect.Key: pattern KH :: forall key sig f a. sig f a -> KeyH key sig f a
+ Data.Effect.Key: pattern KH :: forall {k} key sig f a. sig f a -> KeyH key sig f a
- Data.Effect.Key: type (##>) = KeyH
+ Data.Effect.Key: type (##>) = KeyH :: k -> EffectH -> Type -> Type -> Type -> Type
- Data.Effect.Tag: Tag :: ins a -> Tag (ins :: InsClass) tag a
+ Data.Effect.Tag: Tag :: ins a -> Tag (ins :: EffectF) (tag :: k) a
- Data.Effect.Tag: TagH :: sig f a -> TagH (sig :: SigClass) tag f a
+ Data.Effect.Tag: TagH :: sig f a -> TagH (sig :: EffectH) (tag :: k) (f :: Type -> Type) a
- Data.Effect.Tag: [unTagH] :: TagH (sig :: SigClass) tag f a -> sig f a
+ Data.Effect.Tag: [unTagH] :: TagH (sig :: EffectH) (tag :: k) (f :: Type -> Type) a -> sig f a
- Data.Effect.Tag: [unTag] :: Tag (ins :: InsClass) tag a -> ins a
+ Data.Effect.Tag: [unTag] :: Tag (ins :: EffectF) (tag :: k) a -> ins a
- Data.Effect.Tag: newtype Tag (ins :: InsClass) tag a
+ Data.Effect.Tag: newtype Tag (ins :: EffectF) (tag :: k) a
- Data.Effect.Tag: newtype TagH (sig :: SigClass) tag f a
+ Data.Effect.Tag: newtype TagH (sig :: EffectH) (tag :: k) (f :: Type -> Type) a
- Data.Effect.Tag: pattern T :: forall tag ins a. ins a -> Tag ins tag a
+ Data.Effect.Tag: pattern T :: forall {k} tag ins a. ins a -> Tag ins tag a
- Data.Effect.Tag: pattern TH :: forall tag sig f a. sig f a -> TagH sig tag f a
+ Data.Effect.Tag: pattern TH :: forall {k} tag sig f a. sig f a -> TagH sig tag f a
- Data.Effect.Tag: type (##) = TagH
+ Data.Effect.Tag: type (##) = TagH :: EffectH -> k -> Type -> Type -> Type -> Type
Files
- ChangeLog.md +6/−0
- README.md +10/−7
- data-effects-core.cabal +12/−11
- src/Control/Effect.hs +16/−16
- src/Control/Effect/Key.hs +13/−13
- src/Control/Effect/Tag.hs +15/−15
- src/Data/Effect.hs +13/−13
- src/Data/Effect/HFunctor.hs +1/−1
- src/Data/Effect/HFunctor/HCont.hs +1/−4
- src/Data/Effect/Key.hs +10/−10
- src/Data/Effect/Tag.hs +10/−10
ChangeLog.md view
@@ -3,3 +3,9 @@ ## 0.1.0.0 -- 2023-09-18 * Initial public release.++## 0.2.0.0 -- 2024-10-10++* Remove the type operator for HCont.+* Rename the terms "instruction" and "signature" to the simpler "FOE" and "HOE".+* Support for GHC 9.8.2.
README.md view
@@ -11,12 +11,15 @@ the [Heftia](https://github.com/sayo-hs/heftia) extensible effects library. ## Your contributions are welcome!-Please see [CONTRIBUTING.md](CONTRIBUTING.md).+Please see [CONTRIBUTING.md](https://github.com/sayo-hs/data-effects/blob/ef706ef3fa547de01ce6bb5636af911354e53b58/CONTRIBUTING.md). -## Credits-Parts of this project have been adapted or inspired by the following resources:+## Acknowledgements, citations, and related work+The following is a non-exhaustive list of people and works that have had a significant impact, directly or indirectly, on its design and implementation: -* **[compdata](https://github.com/pa-ba/compdata)**- * **Copyright** (c) 2010--2011 Patrick Bahr, Tom Hvitved- * **License**: BSD-3-Clause- * **Modifications**: Used TemplateHaskell code to derive instances of the `HFunctor` type class.+- Casper Bach Poulsen and Cas van der Rest — [Hefty Algebras: Modular Elaboration of Higher-Order Algebraic Effects][casper:hefty]+- Patrick Bahr and Tom Hvitved — [`compdata`: Compositional Data Types][gh:compdata]+- Michael Szvetits — [`effet`][gh:effet]++[casper:hefty]: https://dl.acm.org/doi/10.1145/3571255+[gh:compdata]: https://github.com/pa-ba/compdata+[gh:effet]: https://github.com/typedbyte/effet
data-effects-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: data-effects-core-version: 0.1.0.0+version: 0.2.0.0 -- A short (one-line) description of the package. synopsis: A basic framework for effect systems based on effects represented by GADTs.@@ -15,28 +15,29 @@ -- The license under which the package is released. license: MPL-2.0 license-file: LICENSE-author: Yamada Ryo <ymdfield@outlook.jp>-maintainer: Yamada Ryo <ymdfield@outlook.jp>+author: Sayo Koyoneda <ymdfield@outlook.jp>+maintainer: Sayo Koyoneda <ymdfield@outlook.jp> -- A copyright notice. copyright:- 2023-2024 Yamada Ryo,- 2023 Casper Bach Poulsen and Cas van der Rest+ 2023-2024 Sayo Koyoneda category: Control, Effect -extra-source-files:+extra-doc-files: ChangeLog.md NOTICE README.md tested-with:+ GHC == 9.8.2+ GHC == 9.4.1 GHC == 9.2.8 source-repository head type: git location: https://github.com/sayo-hs/data-effects- tag: v0.1.0+ tag: v0.2.0 subdir: data-effects-core library@@ -56,9 +57,9 @@ -- LANGUAGE extensions used by modules in this package. -- other-extensions: build-depends:- base ^>= 4.16.4.0,- compdata ^>= 0.13.1,- mtl ^>= 2.2.2,+ base >= 4.16.4 && < 4.21,+ compdata >= 0.13.1 && < 0.14,+ mtl >= 2.2.2 && < 2.4, hs-source-dirs: src ghc-options: -Wall@@ -81,7 +82,7 @@ build-depends: data-effects-core, base,- tasty ^>= 1.4,+ tasty >= 1.4 && < 1.6, tasty-hunit ^>= 0.10, type: exitcode-stdio-1.0
src/Control/Effect.hs view
@@ -3,7 +3,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023-2024 Yamada Ryo+Copyright : (c) 2023-2024 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental@@ -11,32 +11,32 @@ -} module Control.Effect where -import Data.Effect (InsClass, LiftIns (unliftIns), SigClass)+import Data.Effect (EffectF, EffectH, LiftFOE (unliftFOE)) import Data.Kind (Type) --- | A type class that represents the ability to send an /instruction/ @ins@ to carrier @f@.-class SendIns (ins :: InsClass) f where+-- | A type class that represents the ability to send an first-order effect @ins@ to carrier @f@.+class SendFOE (ins :: EffectF) f where -- | Send an /instruction/ @ins@ to carrier @f@.- sendIns :: ins a -> f a+ sendFOE :: ins a -> f a --- | The operator version of `SendIns`.-type (<:) = SendIns+-- | The operator version of `SendFOE`.+type (<:) = SendFOE infix 2 <: --- | A type class that represents the ability to send a /signature/ @sig@ to carrier @f@.-class SendSig (sig :: SigClass) f where- -- | Send a /signature/ @sig@ to carrier @f@.- sendSig :: sig f a -> f a+-- | A type class that represents the ability to send a higher-order effect @sig@ to carrier @f@.+class SendHOE (sig :: EffectH) f where+ -- | Send a higher-order effect @sig@ to carrier @f@.+ sendHOE :: sig f a -> f a --- | The operator version of `SendSig`.-type (<<:) = SendSig+-- | The operator version of `SendHOE`.+type (<<:) = SendHOE infix 2 <<: -instance SendIns ins f => SendSig (LiftIns ins) f where- sendSig = sendIns . unliftIns- {-# INLINE sendSig #-}+instance (SendFOE ins f) => SendHOE (LiftFOE ins) f where+ sendHOE = sendFOE . unliftFOE+ {-# INLINE sendHOE #-} -- | A natural transformation. type f ~> g = forall (x :: Type). f x -> g x
src/Control/Effect/Key.hs view
@@ -5,7 +5,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023-2024 Yamada Ryo+Copyright : (c) 2023-2024 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental@@ -14,7 +14,7 @@ module Control.Effect.Key where import Control.Applicative (Alternative)-import Control.Effect (SendIns (sendIns), SendSig (sendSig))+import Control.Effect (SendFOE (sendFOE), SendHOE (sendHOE)) import Control.Monad (MonadPlus) import Control.Monad.Except (MonadError) import Control.Monad.Fix (MonadFix)@@ -24,15 +24,15 @@ import Control.Monad.State (MonadState) import Control.Monad.Writer (MonadWriter) import Data.Coerce (coerce)-import Data.Effect (InsClass, SigClass)+import Data.Effect (EffectF, EffectH) import Data.Effect.HFunctor (HFunctor, hfmap) import Data.Kind (Type) -class SendInsBy key (ins :: InsClass) f | key f -> ins where- sendInsBy :: ins a -> f a+class SendFOEBy key (ins :: EffectF) f | key f -> ins where+ sendFOEBy :: ins a -> f a -class SendSigBy key (sig :: SigClass) f | key f -> sig where- sendSigBy :: sig f a -> f a+class SendHOEBy key (sig :: EffectH) f | key f -> sig where+ sendHOEBy :: sig f a -> f a -- | A wrapper data type to represent sending an effect to the carrier @f@ with the specified key. newtype ByKey key (f :: Type -> Type) a = ByKey {runByKey :: f a}@@ -57,10 +57,10 @@ key = runByKey {-# INLINE key #-} -instance SendInsBy key ins f => SendIns ins (ByKey key f) where- sendIns = ByKey . sendInsBy @key- {-# INLINE sendIns #-}+instance (SendFOEBy key ins f) => SendFOE ins (ByKey key f) where+ sendFOE = ByKey . sendFOEBy @key+ {-# INLINE sendFOE #-} -instance (SendSigBy key sig f, HFunctor sig) => SendSig sig (ByKey key f) where- sendSig = ByKey . sendSigBy @key . hfmap coerce- {-# INLINE sendSig #-}+instance (SendHOEBy key sig f, HFunctor sig) => SendHOE sig (ByKey key f) where+ sendHOE = ByKey . sendHOEBy @key . hfmap coerce+ {-# INLINE sendHOE #-}
src/Control/Effect/Tag.hs view
@@ -6,7 +6,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023-2024 Yamada Ryo+Copyright : (c) 2023-2024 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental@@ -15,8 +15,8 @@ module Control.Effect.Tag where import Control.Applicative (Alternative)-import Control.Effect (SendIns (sendIns), SendSig (sendSig))-import Control.Effect.Key (SendInsBy, SendSigBy, sendInsBy, sendSigBy)+import Control.Effect (SendFOE (sendFOE), SendHOE (sendHOE))+import Control.Effect.Key (SendFOEBy, SendHOEBy, sendFOEBy, sendHOEBy) import Control.Monad (MonadPlus) import Control.Monad.Except (MonadError) import Control.Monad.Fix (MonadFix)@@ -53,18 +53,18 @@ tag = runViaTag {-# INLINE tag #-} -instance SendIns (ins # tag) f => SendIns ins (ViaTag tag f) where- sendIns = ViaTag . sendIns . T @tag- {-# INLINE sendIns #-}+instance (SendFOE (ins # tag) f) => SendFOE ins (ViaTag tag f) where+ sendFOE = ViaTag . sendFOE . T @tag+ {-# INLINE sendFOE #-} -instance (SendSig (sig ## tag) f, HFunctor sig) => SendSig sig (ViaTag tag f) where- sendSig = ViaTag . sendSig . TH @tag . hfmap coerce- {-# INLINE sendSig #-}+instance (SendHOE (sig ## tag) f, HFunctor sig) => SendHOE sig (ViaTag tag f) where+ sendHOE = ViaTag . sendHOE . TH @tag . hfmap coerce+ {-# INLINE sendHOE #-} -instance SendInsBy key (ins # tag) f => SendInsBy key ins (ViaTag tag f) where- sendInsBy = ViaTag . sendInsBy @key . T @tag- {-# INLINE sendInsBy #-}+instance (SendFOEBy key (ins # tag) f) => SendFOEBy key ins (ViaTag tag f) where+ sendFOEBy = ViaTag . sendFOEBy @key . T @tag+ {-# INLINE sendFOEBy #-} -instance (SendSigBy key (sig ## tag) f, HFunctor sig) => SendSigBy key sig (ViaTag tag f) where- sendSigBy = ViaTag . sendSigBy @key . TH @tag . hfmap coerce- {-# INLINE sendSigBy #-}+instance (SendHOEBy key (sig ## tag) f, HFunctor sig) => SendHOEBy key sig (ViaTag tag f) where+ sendHOEBy = ViaTag . sendHOEBy @key . TH @tag . hfmap coerce+ {-# INLINE sendHOEBy #-}
src/Data/Effect.hs view
@@ -3,7 +3,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023-2024 Yamada Ryo+Copyright : (c) 2023-2024 Sayo Koyoneda (c) 2023 Casper Bach Poulsen and Cas van der Rest License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp@@ -15,26 +15,26 @@ import Data.Effect.HFunctor (HFunctor, hfmap) import Data.Kind (Type) --- | A kind of /signature class/ (a datatype of higher-order effect).-type SigClass = (Type -> Type) -> Type -> Type+-- | The kind of first-order effects.+type EffectF = Type -> Type --- | A kind of /instruction class/ (a datatype of first-order effect).-type InsClass = Type -> Type+-- | The kind of higher-order effects.+type EffectH = (Type -> Type) -> Type -> Type -{- | Lift an /instruction class/ to a /signature class/.+{- | Lift first-order effects to higher-order effects. Come from [heft-lang\/POPL2023\/haskell\/src\/Elab.hs] (https://github.com/heft-lang/POPL2023/blob/74afe1d5ce0b491cffe40cc5c73a2a5ee6a94d9c/haskell/src/Elab.hs#L9-L10). -}-newtype LiftIns (ins :: InsClass) (f :: Type -> Type) a = LiftIns {unliftIns :: ins a}+newtype LiftFOE (ins :: EffectF) (f :: Type -> Type) a = LiftFOE {unliftFOE :: ins a} deriving stock (Functor, Foldable, Traversable) -instance HFunctor (LiftIns ins) where- hfmap _ (LiftIns e) = LiftIns e+instance HFunctor (LiftFOE ins) where+ hfmap _ (LiftFOE e) = LiftFOE e {-# INLINE hfmap #-} --- | An /instruction class/ with no effects.-data Nop :: InsClass+-- | A first-order effect with no operations.+data Nop :: EffectF --- | A /signature class/ with no effects.-type LNop = LiftIns Nop+-- | A higher-order effect with no operations.+type LNop = LiftFOE Nop
src/Data/Effect/HFunctor.hs view
@@ -3,7 +3,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023 Yamada Ryo+Copyright : (c) 2023 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental
src/Data/Effect/HFunctor/HCont.hs view
@@ -5,7 +5,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2024 Yamada Ryo+Copyright : (c) 2024 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental@@ -20,9 +20,6 @@ -- | This represents that the effect @ff@ is finally interpreted as the base carrier @b@. newtype HCont ff b f (a :: Type) = HCont {unHCont :: (f ~> b) -> ff b a} deriving stock (Functor)--type (~~>) = HCont-infixr 8 ~~> instance HFunctor (HCont ff g) where hfmap phi (HCont f) = HCont \k -> f $ k . phi
src/Data/Effect/Key.hs view
@@ -5,7 +5,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023-2024 Yamada Ryo+Copyright : (c) 2023-2024 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental@@ -14,34 +14,34 @@ module Data.Effect.Key where import Data.Comp.Multi.HFunctor (HFunctor)-import Data.Effect (InsClass, SigClass)+import Data.Effect (EffectF, EffectH) --- | Keyed /instruction class/.-newtype Key key (ins :: InsClass) a = Key {unKey :: ins a}+-- | Keyed first-order effect.+newtype Key key (ins :: EffectF) a = Key {unKey :: ins a} deriving stock (Functor, Foldable, Traversable) --- | Keyed /instruction class/.+-- | Keyed first-order effect. type (#>) = Key infixr 7 #> --- | Keyed /instruction class/.+-- | Keyed first-order effect. pattern K :: forall key ins a. ins a -> Key key ins a pattern K e = Key e {-# COMPLETE K #-} --- | Keyed /signature class/.-newtype KeyH key (sig :: SigClass) f a = KeyH {unKeyH :: sig f a}+-- | Keyed higher-order effect.+newtype KeyH key (sig :: EffectH) f a = KeyH {unKeyH :: sig f a} deriving stock (Functor, Foldable, Traversable) deriving newtype (HFunctor) --- | Keyed /signature class/.+-- | Keyed higher-order effect. type (##>) = KeyH infixr 7 ##> --- | Keyed /signature class/.+-- | Keyed higher-order effect. pattern KH :: forall key sig f a. sig f a -> KeyH key sig f a pattern KH e = KeyH e
src/Data/Effect/Tag.hs view
@@ -5,7 +5,7 @@ -- file, You can obtain one at https://mozilla.org/MPL/2.0/. {- |-Copyright : (c) 2023-2024 Yamada Ryo+Copyright : (c) 2023-2024 Sayo Koyoneda License : MPL-2.0 (see the file LICENSE) Maintainer : ymdfield@outlook.jp Stability : experimental@@ -14,34 +14,34 @@ module Data.Effect.Tag where import Data.Comp.Multi.HFunctor (HFunctor)-import Data.Effect (InsClass, SigClass)+import Data.Effect (EffectF, EffectH) --- | Tagged /instruction class/.-newtype Tag (ins :: InsClass) tag a = Tag {unTag :: ins a}+-- | Tagged first-order effect.+newtype Tag (ins :: EffectF) tag a = Tag {unTag :: ins a} deriving stock (Functor, Foldable, Traversable) --- | Tagged /instruction class/.+-- | Tagged first-order effect. type (#) = Tag infixl 8 # --- | Tagged /instruction class/.+-- | Tagged first-order effect. pattern T :: forall tag ins a. ins a -> Tag ins tag a pattern T e = Tag e {-# COMPLETE T #-} --- | Tagged /signature class/.-newtype TagH (sig :: SigClass) tag f a = TagH {unTagH :: sig f a}+-- | Tagged higher-order effect.+newtype TagH (sig :: EffectH) tag f a = TagH {unTagH :: sig f a} deriving stock (Functor, Foldable, Traversable) deriving newtype (HFunctor) --- | Tagged /signature class/.+-- | Tagged higher-order effect. type (##) = TagH infixl 8 ## --- | Tagged /signature class/.+-- | Tagged higher-order effect. pattern TH :: forall tag sig f a. sig f a -> TagH sig tag f a pattern TH e = TagH e