-- | A /referral/ consists of a product and a new vendor

module SupplyChain.Referral
  (
    {- * Type -} Referral (Referral, product, next),
    {- * Alteration -} alter, alter',
  )
  where

import SupplyChain.Core.Effect (Effect)
import SupplyChain.Core.Job (Job, effect)
import SupplyChain.Core.Referral (Referral (Referral, product, next))

import qualified SupplyChain.Core.Referral as Referral

import Data.Function ((.))

alter :: (forall x. Effect up action x -> Job up' action' x)
    -- ^ Transformation applied to each effect that the 'next' vendor evokes
    -> Referral up down action product -> Referral up' down action' product
alter :: forall (up :: * -> *) (action :: * -> *) (up' :: * -> *)
       (action' :: * -> *) (down :: * -> *) product.
(forall x. Effect up action x -> Job up' action' x)
-> Referral up down action product
-> Referral up' down action' product
alter = forall (up :: * -> *) (action :: * -> *) (up' :: * -> *)
       (action' :: * -> *) (down :: * -> *) product.
(forall x. Effect up action x -> Job up' action' x)
-> Referral up down action product
-> Referral up' down action' product
Referral.alter

alter' :: (forall x. Effect up action x -> Effect up' action' x)
    -- ^ Transformation applied to each effect that the 'next' vendor evokes
    -> Referral up down action product -> Referral up' down action' product
alter' :: forall (up :: * -> *) (action :: * -> *) (up' :: * -> *)
       (action' :: * -> *) (down :: * -> *) product.
(forall x. Effect up action x -> Effect up' action' x)
-> Referral up down action product
-> Referral up' down action' product
alter' forall x. Effect up action x -> Effect up' action' x
f = forall (up :: * -> *) (action :: * -> *) (up' :: * -> *)
       (action' :: * -> *) (down :: * -> *) product.
(forall x. Effect up action x -> Job up' action' x)
-> Referral up down action product
-> Referral up' down action' product
Referral.alter (forall (up :: * -> *) (action :: * -> *) product.
Effect up action product -> Job up action product
effect forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall x. Effect up action x -> Effect up' action' x
f)