-- | An /effect/ is either /request/ or /perform/

module SupplyChain.Effect
  (
    {- * Type -} Effect (Request, Perform),
    {- * General alteration -} alterRequest, alterPerform,
    {- * Simplified alteration -} alterRequest', alterPerform',
  )
  where

import SupplyChain.Core.Effect (Effect (Request, Perform))

import qualified SupplyChain.Core.Effect as Effect

import Data.Function ((.))

alterRequest :: (up product -> Effect up' action product)
    -- ^ Transformation applied if the effect is a request
    -> Effect up action product -> Effect up' action product
alterRequest :: forall {k} (up :: k -> *) (product :: k) (up' :: k -> *)
       (action :: k -> *).
(up product -> Effect up' action product)
-> Effect up action product -> Effect up' action product
alterRequest = forall {k} (up :: k -> *) (product :: k) (up' :: k -> *)
       (action :: k -> *).
(up product -> Effect up' action product)
-> Effect up action product -> Effect up' action product
Effect.alterRequest

alterRequest' :: (up product -> up' product)
    -- ^ Transformation applied if the effect is a request
    -> Effect up action product -> Effect up' action product
alterRequest' :: forall {k} (up :: k -> *) (product :: k) (up' :: k -> *)
       (action :: k -> *).
(up product -> up' product)
-> Effect up action product -> Effect up' action product
alterRequest' up product -> up' product
f = forall {k} (up :: k -> *) (product :: k) (up' :: k -> *)
       (action :: k -> *).
(up product -> Effect up' action product)
-> Effect up action product -> Effect up' action product
Effect.alterRequest (forall {k} (up :: k -> *) (action :: k -> *) (product :: k).
up product -> Effect up action product
Effect.Request forall b c a. (b -> c) -> (a -> b) -> a -> c
. up product -> up' product
f)

alterPerform :: (action product -> Effect up action' product)
    -- ^ Transformation applied if the effect is an action
    -> Effect up action product -> Effect up action' product
alterPerform :: forall {k} (action :: k -> *) (product :: k) (up :: k -> *)
       (action' :: k -> *).
(action product -> Effect up action' product)
-> Effect up action product -> Effect up action' product
alterPerform = forall {k} (action :: k -> *) (product :: k) (up :: k -> *)
       (action' :: k -> *).
(action product -> Effect up action' product)
-> Effect up action product -> Effect up action' product
Effect.alterPerform

alterPerform' :: (action product -> action' product)
    -- ^ Transformation applied if the effect is an action
    -> Effect up action product -> Effect up action' product
alterPerform' :: forall {k} (action :: k -> *) (product :: k) (action' :: k -> *)
       (up :: k -> *).
(action product -> action' product)
-> Effect up action product -> Effect up action' product
alterPerform' action product -> action' product
f = forall {k} (action :: k -> *) (product :: k) (up :: k -> *)
       (action' :: k -> *).
(action product -> Effect up action' product)
-> Effect up action product -> Effect up action' product
Effect.alterPerform (forall {k} (up :: k -> *) (action :: k -> *) (product :: k).
action product -> Effect up action product
Effect.Perform forall b c a. (b -> c) -> (a -> b) -> a -> c
. action product -> action' product
f)