polysemy-methodology 0.2.1.0 → 0.2.2.0
raw patch · 3 files changed
+42/−30 lines, 3 filesdep ~basedep ~polysemyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, polysemy
API changes (from Hackage documentation)
- Polysemy.Methodology: process :: forall b_a4q5 c_a4q6 r_a5HT. MemberWithError (Methodology b_a4q5 c_a4q6) r_a5HT => b_a4q5 -> Sem r_a5HT c_a4q6
+ Polysemy.Methodology: process :: forall b_a5hT c_a5hU r_a6vY. Member (Methodology b_a5hT c_a5hU) r_a6vY => b_a5hT -> Sem r_a6vY c_a5hU
Files
- ChangeLog.md +5/−0
- polysemy-methodology.cabal +6/−6
- src/Polysemy/Methodology.hs +31/−24
ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for polysemy-methodology +## v0.2.2.0++* Enable StandaloneKindSignatures.+* Add explicit imports.+ ## v0.2.1.0 * Drop dependency on polysemy-plugin.
polysemy-methodology.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack name: polysemy-methodology-version: 0.2.1.0+version: 0.2.2.0 synopsis: Domain modelling algebra for polysemy category: Polysemy author: Daniel Firth@@ -20,7 +20,7 @@ source-repository head type: git- location: https://gitlab.com/homotopic-tech/polysemy-methodology+ location: https://gitlab.homotopic.tech/haskell/polysemy-methodology library exposed-modules:@@ -29,10 +29,10 @@ Paths_polysemy_methodology hs-source-dirs: src- ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints+ ghc-options: -Weverything -Wno-all-missed-specialisations -Wno-implicit-prelude -Wno-monomorphism-restriction -Wno-missing-local-signatures -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module -Wno-orphans -Wno-safe -Wno-unsafe build-depends:- base >=4.7 && <4.16- , polysemy >=1.3.0.0 && <1.7+ base >=4.7 && <4.18+ , polysemy >=1.3.0.0 && <1.8 , polysemy-kvstore >=0.1.2.0 && <0.2 , polysemy-several ==0.1.* default-language: Haskell2010
src/Polysemy/Methodology.hs view
@@ -1,14 +1,15 @@-{-# LANGUAGE AllowAmbiguousTypes #-}-{-# LANGUAGE BlockArguments #-}-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE BlockArguments #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE StandaloneKindSignatures #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-} -- | -- Module : Polysemy.Methodology@@ -71,17 +72,23 @@ ) where -import Control.Applicative-import Control.Arrow-import Control.Monad-import Polysemy-import Polysemy.Input-import Polysemy.KVStore-import Polysemy.Output-import Polysemy.Several-import Polysemy.Trace+import Control.Applicative (liftA2)+import Control.Arrow ((>>>))+import Control.Monad (join)+import Data.Foldable (fold)+import Data.Functor ((<&>))+import Data.Kind (Type)+import Polysemy (Members, Sem, intercept, interpret,+ makeSem, raise, raiseUnder, reinterpret2,+ reinterpret3)+import Polysemy.Input (Input, input)+import Polysemy.KVStore (KVStore, lookupKV)+import Polysemy.Output (Output, output)+import Polysemy.Several (HList (HNil, (:::)))+import Polysemy.Trace (Trace, trace) -- | A `Methodology` generalises a semantic process from `b` to `c`.+type Methodology :: Type -> Type -> (Type -> Type) -> Type -> Type data Methodology b c m a where Process :: b -> Methodology b c m c @@ -225,7 +232,7 @@ Process b -> do k <- process @b @(Either c c') b case k of- Left c -> process @c @d c+ Left c -> process @c @d c Right c' -> process @c' @d c' {-# INLINE decideMethodology #-} @@ -240,7 +247,7 @@ Process b -> do k <- process @b @(Either c c') b case k of- Left c -> raise $ process @c @d c+ Left c -> raise $ process @c @d c Right c' -> raise $ raise $ process @c' @d c' {-# INLINE decideMethodology' #-} @@ -303,7 +310,7 @@ Process k -> do z <- lookupKV k case z of- Just a -> return a+ Just a -> return a Nothing -> return d {-# INLINE runMethodologyAsKVStoreWithDefault #-} @@ -583,7 +590,7 @@ Sem (Methodology (f b) c ': r) a -> Sem r a mconcatMethodology = interpret \case- Process b -> traverse (process @b @c) b >>= return . foldr (<>) mempty+ Process b -> traverse (process @b @c) b <&> fold {-# INLINE mconcatMethodology #-} -- | Reinterpreting version of `mconcatMethodology`.