supply-chain 0.0.0.1 → 0.0.1.0
raw patch · 4 files changed
+34/−7 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ SupplyChain.Vendor: state :: s -> (forall response. down response -> s -> Job up action (response, s)) -> Vendor up down action
- SupplyChain.Vendor: map :: (forall x. down x -> up x) -> Vendor up down action
+ SupplyChain.Vendor: map :: (forall response. down response -> up response) -> Vendor up down action
Files
- changelog.md +6/−2
- readme.md +10/−0
- supply-chain.cabal +2/−2
- supply-chain/SupplyChain/Vendor.hs +16/−3
changelog.md view
@@ -1,7 +1,11 @@-# 0.0.0.1 (2023-01-11)+## 0.0.1.0 (2023-03-03) +Add `SupplyChain.Vendor.state`++## 0.0.0.1 (2023-01-11)+ Documentation enhancements -# 0.0.0.0 (2022-11-08)+## 0.0.0.0 (2022-11-08) Initial release
readme.md view
@@ -241,3 +241,13 @@ This latter component is what allows vendors to be stateful, and it is usually defined recursively.+++## Notes on package versioning++This `supply-chain` package re-exports types and values from+`supply-chain-core`. Since a `supply-chain-core` API change can cause a+`supply-chain` API change, our version bounds on the `supply-chain-core`+dependency must include three digits. A major or minor version bump in+`supply-chain-core` prompts a corresponding bump in `supply-chain` if any+re-exported entities have changed.
supply-chain.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: supply-chain-version: 0.0.0.1+version: 0.0.1.0 category: Monads, Streaming synopsis: Composable request-response pipelines@@ -36,7 +36,7 @@ build-depends: , base ^>= 4.16 || ^>= 4.17- , supply-chain-core ^>= 0.0+ , supply-chain-core == 0.0.0.* library import: base
supply-chain/SupplyChain/Vendor.hs view
@@ -4,7 +4,7 @@ ( {- * Type -} Vendor (Vendor, handle), {- * Connection -} (>->), id,- {- * Some simple vendors -} function, action, map, absurd,+ {- * Some simple vendors -} function, action, state, map, absurd, {- * Running -} run, eval, eval', {- * Alteration -} alter, alter', )@@ -24,6 +24,7 @@ import Control.Applicative (pure) import Control.Monad (Monad) import Data.Function ((.))+import Data.Functor ((<&>)) import Data.Functor.Const (Const) import Data.Void (Void) @@ -80,9 +81,21 @@ -> Vendor up down action action f = loop' (Job.perform . f) +{-| A stateful vendor -}+state ::+ s -- ^ Initial state+ -> (forall response. down response -> s -> Job up action (response, s))+ -> Vendor up down action+state initial step = go initial+ where+ go s =+ Vendor{ handle = \request ->+ step request s <&> \(response, s') ->+ Referral response (go s') }+ {-| A vendor that applies a transformation to each request- and then simply forwards it upstream. -}-map :: (forall x. down x -> up x) -> Vendor up down action+ and then simply forwards it upstream -}+map :: (forall response. down response -> up response) -> Vendor up down action map f = loop' (Job.order . f) alter :: (forall x. Effect up action x -> Job up' action' x)