{-# OPTIONS_GHC -Wno-orphans #-}

module PlutusLedgerApi.V2.Orphans.Contexts () where

import Data.Set qualified as Set
import PlutusLedgerApi.V1.Orphans.Contexts ()
import PlutusLedgerApi.V1.Orphans.DCert ()
import PlutusLedgerApi.V1.Orphans.Interval ()
import PlutusLedgerApi.V1.Orphans.Tx ()
import PlutusLedgerApi.V1.Orphans.Value qualified as Value
import PlutusLedgerApi.V2 qualified as PLA
import PlutusLedgerApi.V2.Orphans.Tx ()
import Test.QuickCheck (
  Arbitrary (arbitrary, shrink),
  CoArbitrary (coarbitrary),
  Function (function),
  NonEmptyList (NonEmpty),
  functionMap,
  getNonEmpty,
 )

-- | @since 1.0.2
instance Arbitrary PLA.TxInInfo where
  {-# INLINEABLE arbitrary #-}
  arbitrary :: Gen TxInInfo
arbitrary = TxOutRef -> TxOut -> TxInInfo
PLA.TxInInfo (TxOutRef -> TxOut -> TxInInfo)
-> Gen TxOutRef -> Gen (TxOut -> TxInInfo)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen TxOutRef
forall a. Arbitrary a => Gen a
arbitrary Gen (TxOut -> TxInInfo) -> Gen TxOut -> Gen TxInInfo
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen TxOut
forall a. Arbitrary a => Gen a
arbitrary
  {-# INLINEABLE shrink #-}
  shrink :: TxInInfo -> [TxInInfo]
shrink (PLA.TxInInfo TxOutRef
outref TxOut
resolved) =
    TxOutRef -> TxOut -> TxInInfo
PLA.TxInInfo (TxOutRef -> TxOut -> TxInInfo)
-> [TxOutRef] -> [TxOut -> TxInInfo]
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> TxOutRef -> [TxOutRef]
forall a. Arbitrary a => a -> [a]
shrink TxOutRef
outref [TxOut -> TxInInfo] -> [TxOut] -> [TxInInfo]
forall a b. [a -> b] -> [a] -> [b]
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> TxOut -> [TxOut]
forall a. Arbitrary a => a -> [a]
shrink TxOut
resolved

-- | @since 1.0.2
instance CoArbitrary PLA.TxInInfo where
  {-# INLINEABLE coarbitrary #-}
  coarbitrary :: forall b. TxInInfo -> Gen b -> Gen b
coarbitrary (PLA.TxInInfo TxOutRef
outref TxOut
resolved) =
    TxOutRef -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. TxOutRef -> Gen b -> Gen b
coarbitrary TxOutRef
outref (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. TxOut -> Gen b -> Gen b
coarbitrary TxOut
resolved

-- | @since 1.0.2
instance Function PLA.TxInInfo where
  {-# INLINEABLE function #-}
  function :: forall b. (TxInInfo -> b) -> TxInInfo :-> b
function =
    (TxInInfo -> (TxOutRef, TxOut))
-> ((TxOutRef, TxOut) -> TxInInfo)
-> (TxInInfo -> b)
-> TxInInfo :-> b
forall b a c.
Function b =>
(a -> b) -> (b -> a) -> (a -> c) -> a :-> c
functionMap
      (\(PLA.TxInInfo TxOutRef
outref TxOut
resolved) -> (TxOutRef
outref, TxOut
resolved))
      ((TxOutRef -> TxOut -> TxInInfo) -> (TxOutRef, TxOut) -> TxInInfo
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry TxOutRef -> TxOut -> TxInInfo
PLA.TxInInfo)

-- | @since 1.0.2
instance Arbitrary PLA.TxInfo where
  {-# INLINEABLE arbitrary #-}
  arbitrary :: Gen TxInfo
arbitrary =
    [TxInInfo]
-> [TxInInfo]
-> [TxOut]
-> Value
-> Value
-> [DCert]
-> Map StakingCredential Integer
-> POSIXTimeRange
-> [PubKeyHash]
-> Map ScriptPurpose Redeemer
-> Map DatumHash Datum
-> TxId
-> TxInfo
PLA.TxInfo ([TxInInfo]
 -> [TxInInfo]
 -> [TxOut]
 -> Value
 -> Value
 -> [DCert]
 -> Map StakingCredential Integer
 -> POSIXTimeRange
 -> [PubKeyHash]
 -> Map ScriptPurpose Redeemer
 -> Map DatumHash Datum
 -> TxId
 -> TxInfo)
-> (NonEmptyList TxInInfo -> [TxInInfo])
-> NonEmptyList TxInInfo
-> [TxInInfo]
-> [TxOut]
-> Value
-> Value
-> [DCert]
-> Map StakingCredential Integer
-> POSIXTimeRange
-> [PubKeyHash]
-> Map ScriptPurpose Redeemer
-> Map DatumHash Datum
-> TxId
-> TxInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyList TxInInfo -> [TxInInfo]
forall a. NonEmptyList a -> [a]
getNonEmpty
      (NonEmptyList TxInInfo
 -> [TxInInfo]
 -> [TxOut]
 -> Value
 -> Value
 -> [DCert]
 -> Map StakingCredential Integer
 -> POSIXTimeRange
 -> [PubKeyHash]
 -> Map ScriptPurpose Redeemer
 -> Map DatumHash Datum
 -> TxId
 -> TxInfo)
-> Gen (NonEmptyList TxInInfo)
-> Gen
     ([TxInInfo]
      -> [TxOut]
      -> Value
      -> Value
      -> [DCert]
      -> Map StakingCredential Integer
      -> POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (NonEmptyList TxInInfo)
forall a. Arbitrary a => Gen a
arbitrary -- inputs
      Gen
  ([TxInInfo]
   -> [TxOut]
   -> Value
   -> Value
   -> [DCert]
   -> Map StakingCredential Integer
   -> POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen [TxInInfo]
-> Gen
     ([TxOut]
      -> Value
      -> Value
      -> [DCert]
      -> Map StakingCredential Integer
      -> POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen [TxInInfo]
forall a. Arbitrary a => Gen a
arbitrary -- reference inputs
      Gen
  ([TxOut]
   -> Value
   -> Value
   -> [DCert]
   -> Map StakingCredential Integer
   -> POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen [TxOut]
-> Gen
     (Value
      -> Value
      -> [DCert]
      -> Map StakingCredential Integer
      -> POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> (NonEmptyList TxOut -> [TxOut]
forall a. NonEmptyList a -> [a]
getNonEmpty (NonEmptyList TxOut -> [TxOut])
-> Gen (NonEmptyList TxOut) -> Gen [TxOut]
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (NonEmptyList TxOut)
forall a. Arbitrary a => Gen a
arbitrary) -- outputs
      Gen
  (Value
   -> Value
   -> [DCert]
   -> Map StakingCredential Integer
   -> POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen Value
-> Gen
     (Value
      -> [DCert]
      -> Map StakingCredential Integer
      -> POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> (FeeValue -> Value
Value.getFeeValue (FeeValue -> Value) -> Gen FeeValue -> Gen Value
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen FeeValue
forall a. Arbitrary a => Gen a
arbitrary) -- fee
      Gen
  (Value
   -> [DCert]
   -> Map StakingCredential Integer
   -> POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen Value
-> Gen
     ([DCert]
      -> Map StakingCredential Integer
      -> POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> (MintValue -> Value
Value.getMintValue (MintValue -> Value) -> Gen MintValue -> Gen Value
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen MintValue
forall a. Arbitrary a => Gen a
arbitrary) -- mint
      Gen
  ([DCert]
   -> Map StakingCredential Integer
   -> POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen [DCert]
-> Gen
     (Map StakingCredential Integer
      -> POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen [DCert]
forall a. Arbitrary a => Gen a
arbitrary -- dcert
      Gen
  (Map StakingCredential Integer
   -> POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen (Map StakingCredential Integer)
-> Gen
     (POSIXTimeRange
      -> [PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen (Map StakingCredential Integer)
forall a. Arbitrary a => Gen a
arbitrary -- withdrawals
      Gen
  (POSIXTimeRange
   -> [PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen POSIXTimeRange
-> Gen
     ([PubKeyHash]
      -> Map ScriptPurpose Redeemer
      -> Map DatumHash Datum
      -> TxId
      -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen POSIXTimeRange
forall a. Arbitrary a => Gen a
arbitrary -- valid range
      Gen
  ([PubKeyHash]
   -> Map ScriptPurpose Redeemer
   -> Map DatumHash Datum
   -> TxId
   -> TxInfo)
-> Gen [PubKeyHash]
-> Gen
     (Map ScriptPurpose Redeemer
      -> Map DatumHash Datum -> TxId -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> (Set PubKeyHash -> [PubKeyHash]
forall a. Set a -> [a]
Set.toList (Set PubKeyHash -> [PubKeyHash])
-> Gen (Set PubKeyHash) -> Gen [PubKeyHash]
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Set PubKeyHash)
forall a. Arbitrary a => Gen a
arbitrary) -- signatures
      Gen
  (Map ScriptPurpose Redeemer
   -> Map DatumHash Datum -> TxId -> TxInfo)
-> Gen (Map ScriptPurpose Redeemer)
-> Gen (Map DatumHash Datum -> TxId -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen (Map ScriptPurpose Redeemer)
forall a. Arbitrary a => Gen a
arbitrary -- redeemers
      Gen (Map DatumHash Datum -> TxId -> TxInfo)
-> Gen (Map DatumHash Datum) -> Gen (TxId -> TxInfo)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen (Map DatumHash Datum)
forall a. Arbitrary a => Gen a
arbitrary -- datums
      Gen (TxId -> TxInfo) -> Gen TxId -> Gen TxInfo
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Gen TxId
forall a. Arbitrary a => Gen a
arbitrary -- tid
  {-# INLINEABLE shrink #-}
  shrink :: TxInfo -> [TxInfo]
shrink (PLA.TxInfo [TxInInfo]
ins [TxInInfo]
routs [TxOut]
outs Value
fee Value
mint [DCert]
dcert Map StakingCredential Integer
wdrl POSIXTimeRange
validRange [PubKeyHash]
sigs Map ScriptPurpose Redeemer
reds Map DatumHash Datum
dats TxId
tid) = do
    NonEmpty [TxInInfo]
ins' <- NonEmptyList TxInInfo -> [NonEmptyList TxInInfo]
forall a. Arbitrary a => a -> [a]
shrink ([TxInInfo] -> NonEmptyList TxInInfo
forall a. [a] -> NonEmptyList a
NonEmpty [TxInInfo]
ins)
    [TxInInfo]
routs' <- [TxInInfo] -> [[TxInInfo]]
forall a. Arbitrary a => a -> [a]
shrink [TxInInfo]
routs
    NonEmpty [TxOut]
outs' <- NonEmptyList TxOut -> [NonEmptyList TxOut]
forall a. Arbitrary a => a -> [a]
shrink ([TxOut] -> NonEmptyList TxOut
forall a. [a] -> NonEmptyList a
NonEmpty [TxOut]
outs)
    Value.FeeValue Value
fee' <- FeeValue -> [FeeValue]
forall a. Arbitrary a => a -> [a]
shrink (Value -> FeeValue
Value.FeeValue Value
fee)
    Value.NonAdaValue Value
mint' <- NonAdaValue -> [NonAdaValue]
forall a. Arbitrary a => a -> [a]
shrink (Value -> NonAdaValue
Value.NonAdaValue Value
mint)
    [DCert]
dcert' <- [DCert] -> [[DCert]]
forall a. Arbitrary a => a -> [a]
shrink [DCert]
dcert
    Map StakingCredential Integer
wdrl' <- Map StakingCredential Integer -> [Map StakingCredential Integer]
forall a. Arbitrary a => a -> [a]
shrink Map StakingCredential Integer
wdrl
    POSIXTimeRange
validRange' <- POSIXTimeRange -> [POSIXTimeRange]
forall a. Arbitrary a => a -> [a]
shrink POSIXTimeRange
validRange
    [PubKeyHash]
sigs' <- Set PubKeyHash -> [PubKeyHash]
forall a. Set a -> [a]
Set.toList (Set PubKeyHash -> [PubKeyHash])
-> [Set PubKeyHash] -> [[PubKeyHash]]
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Set PubKeyHash -> [Set PubKeyHash]
forall a. Arbitrary a => a -> [a]
shrink ([PubKeyHash] -> Set PubKeyHash
forall a. Ord a => [a] -> Set a
Set.fromList [PubKeyHash]
sigs)
    Map ScriptPurpose Redeemer
reds' <- Map ScriptPurpose Redeemer -> [Map ScriptPurpose Redeemer]
forall a. Arbitrary a => a -> [a]
shrink Map ScriptPurpose Redeemer
reds
    Map DatumHash Datum
dats' <- Map DatumHash Datum -> [Map DatumHash Datum]
forall a. Arbitrary a => a -> [a]
shrink Map DatumHash Datum
dats
    TxId
tid' <- TxId -> [TxId]
forall a. Arbitrary a => a -> [a]
shrink TxId
tid
    TxInfo -> [TxInfo]
forall a. a -> [a]
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TxInfo -> [TxInfo]) -> (TxId -> TxInfo) -> TxId -> [TxInfo]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [TxInInfo]
-> [TxInInfo]
-> [TxOut]
-> Value
-> Value
-> [DCert]
-> Map StakingCredential Integer
-> POSIXTimeRange
-> [PubKeyHash]
-> Map ScriptPurpose Redeemer
-> Map DatumHash Datum
-> TxId
-> TxInfo
PLA.TxInfo [TxInInfo]
ins' [TxInInfo]
routs' [TxOut]
outs' Value
fee' Value
mint' [DCert]
dcert' Map StakingCredential Integer
wdrl' POSIXTimeRange
validRange' [PubKeyHash]
sigs' Map ScriptPurpose Redeemer
reds' Map DatumHash Datum
dats' (TxId -> [TxInfo]) -> TxId -> [TxInfo]
forall a b. (a -> b) -> a -> b
$ TxId
tid'

-- | @since 1.0.2
instance CoArbitrary PLA.TxInfo where
  {-# INLINEABLE coarbitrary #-}
  coarbitrary :: forall b. TxInfo -> Gen b -> Gen b
coarbitrary (PLA.TxInfo [TxInInfo]
ins [TxInInfo]
routs [TxOut]
outs Value
fee Value
mint [DCert]
dcert Map StakingCredential Integer
wdrl POSIXTimeRange
validRange [PubKeyHash]
sigs Map ScriptPurpose Redeemer
reds Map DatumHash Datum
dats TxId
tid) =
    [TxInInfo] -> Gen b -> Gen b
forall b. [TxInInfo] -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
coarbitrary [TxInInfo]
ins
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [TxInInfo] -> Gen b -> Gen b
forall b. [TxInInfo] -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
coarbitrary [TxInInfo]
routs
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [TxOut] -> Gen b -> Gen b
forall b. [TxOut] -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
coarbitrary [TxOut]
outs
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. Value -> Gen b -> Gen b
coarbitrary Value
fee
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. Value -> Gen b -> Gen b
coarbitrary Value
mint
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [DCert] -> Gen b -> Gen b
forall b. [DCert] -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
coarbitrary [DCert]
dcert
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map StakingCredential Integer -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. Map StakingCredential Integer -> Gen b -> Gen b
coarbitrary Map StakingCredential Integer
wdrl
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. POSIXTimeRange -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. POSIXTimeRange -> Gen b -> Gen b
coarbitrary POSIXTimeRange
validRange
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [PubKeyHash] -> Gen b -> Gen b
forall b. [PubKeyHash] -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
coarbitrary [PubKeyHash]
sigs
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map ScriptPurpose Redeemer -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. Map ScriptPurpose Redeemer -> Gen b -> Gen b
coarbitrary Map ScriptPurpose Redeemer
reds
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map DatumHash Datum -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. Map DatumHash Datum -> Gen b -> Gen b
coarbitrary Map DatumHash Datum
dats
      (Gen b -> Gen b) -> (Gen b -> Gen b) -> Gen b -> Gen b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxId -> Gen b -> Gen b
forall a b. CoArbitrary a => a -> Gen b -> Gen b
forall b. TxId -> Gen b -> Gen b
coarbitrary TxId
tid

-- | @since 1.0.2
instance Function PLA.TxInfo where
  {-# INLINEABLE function #-}
  function :: forall b. (TxInfo -> b) -> TxInfo :-> b
function = (TxInfo
 -> ([TxInInfo], [TxInInfo], [TxOut], Value, Value,
     ([DCert], Map StakingCredential Integer, POSIXTimeRange,
      [PubKeyHash], Map ScriptPurpose Redeemer, Map DatumHash Datum,
      TxId)))
-> (([TxInInfo], [TxInInfo], [TxOut], Value, Value,
     ([DCert], Map StakingCredential Integer, POSIXTimeRange,
      [PubKeyHash], Map ScriptPurpose Redeemer, Map DatumHash Datum,
      TxId))
    -> TxInfo)
-> (TxInfo -> b)
-> TxInfo :-> b
forall b a c.
Function b =>
(a -> b) -> (b -> a) -> (a -> c) -> a :-> c
functionMap TxInfo
-> ([TxInInfo], [TxInInfo], [TxOut], Value, Value,
    ([DCert], Map StakingCredential Integer, POSIXTimeRange,
     [PubKeyHash], Map ScriptPurpose Redeemer, Map DatumHash Datum,
     TxId))
into ([TxInInfo], [TxInInfo], [TxOut], Value, Value,
 ([DCert], Map StakingCredential Integer, POSIXTimeRange,
  [PubKeyHash], Map ScriptPurpose Redeemer, Map DatumHash Datum,
  TxId))
-> TxInfo
outOf
    where
      into ::
        PLA.TxInfo ->
        ([PLA.TxInInfo], [PLA.TxInInfo], [PLA.TxOut], PLA.Value, PLA.Value, ([PLA.DCert], PLA.Map PLA.StakingCredential Integer, PLA.POSIXTimeRange, [PLA.PubKeyHash], PLA.Map PLA.ScriptPurpose PLA.Redeemer, PLA.Map PLA.DatumHash PLA.Datum, PLA.TxId))
      into :: TxInfo
-> ([TxInInfo], [TxInInfo], [TxOut], Value, Value,
    ([DCert], Map StakingCredential Integer, POSIXTimeRange,
     [PubKeyHash], Map ScriptPurpose Redeemer, Map DatumHash Datum,
     TxId))
into (PLA.TxInfo [TxInInfo]
ins [TxInInfo]
routs [TxOut]
outs Value
fee Value
mint [DCert]
dcert Map StakingCredential Integer
wdrl POSIXTimeRange
validRange [PubKeyHash]
sigs Map ScriptPurpose Redeemer
reds Map DatumHash Datum
dats TxId
tid) =
        ([TxInInfo]
ins, [TxInInfo]
routs, [TxOut]
outs, Value
fee, Value
mint, ([DCert]
dcert, Map StakingCredential Integer
wdrl, POSIXTimeRange
validRange, [PubKeyHash]
sigs, Map ScriptPurpose Redeemer
reds, Map DatumHash Datum
dats, TxId
tid))
      outOf ::
        ([PLA.TxInInfo], [PLA.TxInInfo], [PLA.TxOut], PLA.Value, PLA.Value, ([PLA.DCert], PLA.Map PLA.StakingCredential Integer, PLA.POSIXTimeRange, [PLA.PubKeyHash], PLA.Map PLA.ScriptPurpose PLA.Redeemer, PLA.Map PLA.DatumHash PLA.Datum, PLA.TxId)) ->
        PLA.TxInfo
      outOf :: ([TxInInfo], [TxInInfo], [TxOut], Value, Value,
 ([DCert], Map StakingCredential Integer, POSIXTimeRange,
  [PubKeyHash], Map ScriptPurpose Redeemer, Map DatumHash Datum,
  TxId))
-> TxInfo
outOf ([TxInInfo]
ins, [TxInInfo]
routs, [TxOut]
outs, Value
fee, Value
mint, ([DCert]
dcert, Map StakingCredential Integer
wdrl, POSIXTimeRange
validRange, [PubKeyHash]
sigs, Map ScriptPurpose Redeemer
reds, Map DatumHash Datum
dats, TxId
tid)) =
        [TxInInfo]
-> [TxInInfo]
-> [TxOut]
-> Value
-> Value
-> [DCert]
-> Map StakingCredential Integer
-> POSIXTimeRange
-> [PubKeyHash]
-> Map ScriptPurpose Redeemer
-> Map DatumHash Datum
-> TxId
-> TxInfo
PLA.TxInfo [TxInInfo]
ins [TxInInfo]
routs [TxOut]
outs Value
fee Value
mint [DCert]
dcert Map StakingCredential Integer
wdrl POSIXTimeRange
validRange [PubKeyHash]
sigs Map ScriptPurpose Redeemer
reds Map DatumHash Datum
dats TxId
tid