{-# OPTIONS_GHC -Wno-orphans #-}

-- Mirrors the equivalent V1 module in plutus-ledger-api
module Plutarch.LedgerApi.V1.Scripts (
  PScriptHash (..),
  PDatum (..),
  PRedeemer (..),
  PDatumHash (..),
  PRedeemerHash (..),
) where

import Data.ByteString (ByteString)
import GHC.Generics (Generic)
import Generics.SOP qualified as SOP
import Plutarch.Prelude
import PlutusLedgerApi.V3 qualified as Plutus
import PlutusTx.Builtins.Internal qualified as PlutusTx

-- | @since 2.0.0
newtype PScriptHash (s :: S) = PScriptHash (Term s PByteString)
  deriving stock
    ( -- | @since 2.0.0
      (forall x. PScriptHash s -> Rep (PScriptHash s) x)
-> (forall x. Rep (PScriptHash s) x -> PScriptHash s)
-> Generic (PScriptHash s)
forall x. Rep (PScriptHash s) x -> PScriptHash s
forall x. PScriptHash s -> Rep (PScriptHash s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PScriptHash s) x -> PScriptHash s
forall (s :: S) x. PScriptHash s -> Rep (PScriptHash s) x
$cfrom :: forall (s :: S) x. PScriptHash s -> Rep (PScriptHash s) x
from :: forall x. PScriptHash s -> Rep (PScriptHash s) x
$cto :: forall (s :: S) x. Rep (PScriptHash s) x -> PScriptHash s
to :: forall x. Rep (PScriptHash s) x -> PScriptHash s
Generic
    )
  deriving anyclass
    ( -- | @since 3.3.0
      All SListI (Code (PScriptHash s))
All SListI (Code (PScriptHash s)) =>
(PScriptHash s -> Rep (PScriptHash s))
-> (Rep (PScriptHash s) -> PScriptHash s)
-> Generic (PScriptHash s)
Rep (PScriptHash s) -> PScriptHash s
PScriptHash s -> Rep (PScriptHash s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PScriptHash s))
forall (s :: S). Rep (PScriptHash s) -> PScriptHash s
forall (s :: S). PScriptHash s -> Rep (PScriptHash s)
$cfrom :: forall (s :: S). PScriptHash s -> Rep (PScriptHash s)
from :: PScriptHash s -> Rep (PScriptHash s)
$cto :: forall (s :: S). Rep (PScriptHash s) -> PScriptHash s
to :: Rep (PScriptHash s) -> PScriptHash s
SOP.Generic
    , -- | @since 2.0.0
      (forall (s :: S).
 Term s (PAsData PScriptHash) -> Term s PScriptHash)
-> (forall (s :: S). Term s PScriptHash -> Term s PData)
-> PIsData PScriptHash
forall (s :: S). Term s (PAsData PScriptHash) -> Term s PScriptHash
forall (s :: S). Term s PScriptHash -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PScriptHash) -> Term s PScriptHash
pfromDataImpl :: forall (s :: S). Term s (PAsData PScriptHash) -> Term s PScriptHash
$cpdataImpl :: forall (s :: S). Term s PScriptHash -> Term s PData
pdataImpl :: forall (s :: S). Term s PScriptHash -> Term s PData
PIsData
    , -- | @since 2.0.0
      (forall (s :: S).
 Term s PScriptHash -> Term s PScriptHash -> Term s PBool)
-> PEq PScriptHash
forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
#== :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
PEq
    , -- | @since 2.0.0
      PEq PScriptHash
PEq PScriptHash =>
(forall (s :: S).
 Term s PScriptHash -> Term s PScriptHash -> Term s PBool)
-> (forall (s :: S).
    Term s PScriptHash -> Term s PScriptHash -> Term s PBool)
-> (forall (s :: S).
    Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash)
-> (forall (s :: S).
    Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash)
-> POrd PScriptHash
forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash
forall (t :: S -> Type).
PEq t =>
(forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> POrd t
$c#<= :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
#<= :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
$c#< :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
#< :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PBool
$cpmax :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash
pmax :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash
$cpmin :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash
pmin :: forall (s :: S).
Term s PScriptHash -> Term s PScriptHash -> Term s PScriptHash
POrd
    , -- | @since 2.0.0
      (forall (s :: S). Bool -> Term s PScriptHash -> Term s PString)
-> PShow PScriptHash
forall (s :: S). Bool -> Term s PScriptHash -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PScriptHash -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PScriptHash -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.3.0
      (forall (s :: S). PScriptHash s -> Term s (PInner PScriptHash))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PScriptHash)
    -> (PScriptHash s -> Term s b) -> Term s b)
-> PlutusType PScriptHash
forall (s :: S). PScriptHash s -> Term s (PInner PScriptHash)
forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptHash)
-> (PScriptHash s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PScriptHash s -> Term s (PInner PScriptHash)
pcon' :: forall (s :: S). PScriptHash s -> Term s (PInner PScriptHash)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptHash)
-> (PScriptHash s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptHash)
-> (PScriptHash s -> Term s b) -> Term s b
PlutusType
    )
    via (DeriveNewtypePlutusType PScriptHash)

-- | @since 3.3.0
instance PLiftable PScriptHash where
  type AsHaskell PScriptHash = Plutus.ScriptHash
  type PlutusRepr PScriptHash = ByteString
  {-# INLINEABLE haskToRepr #-}
  haskToRepr :: AsHaskell PScriptHash -> PlutusRepr PScriptHash
haskToRepr (Plutus.ScriptHash (PlutusTx.BuiltinByteString ByteString
str)) = ByteString
PlutusRepr PScriptHash
str
  {-# INLINEABLE reprToHask #-}
  reprToHask :: PlutusRepr PScriptHash -> Either LiftError (AsHaskell PScriptHash)
reprToHask = ScriptHash -> Either LiftError ScriptHash
forall a b. b -> Either a b
Right (ScriptHash -> Either LiftError ScriptHash)
-> (ByteString -> ScriptHash)
-> ByteString
-> Either LiftError ScriptHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinByteString -> ScriptHash
Plutus.ScriptHash (BuiltinByteString -> ScriptHash)
-> (ByteString -> BuiltinByteString) -> ByteString -> ScriptHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinByteString
PlutusTx.BuiltinByteString
  {-# INLINEABLE reprToPlut #-}
  reprToPlut :: forall (s :: S). PlutusRepr PScriptHash -> PLifted s PScriptHash
reprToPlut = PlutusRepr PScriptHash -> PLifted s PScriptHash
forall (a :: S -> Type) (s :: S).
(PLiftable a, Includes DefaultUni (PlutusRepr a)) =>
PlutusRepr a -> PLifted s a
reprToPlutUni
  {-# INLINEABLE plutToRepr #-}
  plutToRepr :: (forall (s :: S). PLifted s PScriptHash)
-> Either LiftError (PlutusRepr PScriptHash)
plutToRepr = (forall (s :: S). PLifted s PScriptHash)
-> Either LiftError (PlutusRepr PScriptHash)
forall (a :: S -> Type).
(PLiftable a, Includes DefaultUni (PlutusRepr a)) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni

-- | @since 2.0.0
newtype PDatum (s :: S) = PDatum (Term s PData)
  deriving stock
    ( -- | @since 2.0.0
      (forall x. PDatum s -> Rep (PDatum s) x)
-> (forall x. Rep (PDatum s) x -> PDatum s) -> Generic (PDatum s)
forall x. Rep (PDatum s) x -> PDatum s
forall x. PDatum s -> Rep (PDatum s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PDatum s) x -> PDatum s
forall (s :: S) x. PDatum s -> Rep (PDatum s) x
$cfrom :: forall (s :: S) x. PDatum s -> Rep (PDatum s) x
from :: forall x. PDatum s -> Rep (PDatum s) x
$cto :: forall (s :: S) x. Rep (PDatum s) x -> PDatum s
to :: forall x. Rep (PDatum s) x -> PDatum s
Generic
    )
  deriving anyclass
    ( -- | @since 2.0.0
      (forall (s :: S). Term s (PAsData PDatum) -> Term s PDatum)
-> (forall (s :: S). Term s PDatum -> Term s PData)
-> PIsData PDatum
forall (s :: S). Term s (PAsData PDatum) -> Term s PDatum
forall (s :: S). Term s PDatum -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PDatum) -> Term s PDatum
pfromDataImpl :: forall (s :: S). Term s (PAsData PDatum) -> Term s PDatum
$cpdataImpl :: forall (s :: S). Term s PDatum -> Term s PData
pdataImpl :: forall (s :: S). Term s PDatum -> Term s PData
PIsData
    , -- | @since 2.0.0
      (forall (s :: S). Term s PDatum -> Term s PDatum -> Term s PBool)
-> PEq PDatum
forall (s :: S). Term s PDatum -> Term s PDatum -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S). Term s PDatum -> Term s PDatum -> Term s PBool
#== :: forall (s :: S). Term s PDatum -> Term s PDatum -> Term s PBool
PEq
    , -- | @since 2.0.0
      (forall (s :: S). Bool -> Term s PDatum -> Term s PString)
-> PShow PDatum
forall (s :: S). Bool -> Term s PDatum -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PDatum -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PDatum -> Term s PString
PShow
    , -- | @since WIP
      All SListI (Code (PDatum s))
All SListI (Code (PDatum s)) =>
(PDatum s -> Rep (PDatum s))
-> (Rep (PDatum s) -> PDatum s) -> Generic (PDatum s)
Rep (PDatum s) -> PDatum s
PDatum s -> Rep (PDatum s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PDatum s))
forall (s :: S). Rep (PDatum s) -> PDatum s
forall (s :: S). PDatum s -> Rep (PDatum s)
$cfrom :: forall (s :: S). PDatum s -> Rep (PDatum s)
from :: PDatum s -> Rep (PDatum s)
$cto :: forall (s :: S). Rep (PDatum s) -> PDatum s
to :: Rep (PDatum s) -> PDatum s
SOP.Generic
    )
  deriving
    ( -- | @since 2.0.0
      (forall (s :: S). PDatum s -> Term s (PInner PDatum))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PDatum) -> (PDatum s -> Term s b) -> Term s b)
-> PlutusType PDatum
forall (s :: S). PDatum s -> Term s (PInner PDatum)
forall (s :: S) (b :: S -> Type).
Term s (PInner PDatum) -> (PDatum s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PDatum s -> Term s (PInner PDatum)
pcon' :: forall (s :: S). PDatum s -> Term s (PInner PDatum)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PDatum) -> (PDatum s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PDatum) -> (PDatum s -> Term s b) -> Term s b
PlutusType
    )
    via (DeriveNewtypePlutusType PDatum)

-- | @since 3.3.0
deriving via
  DeriveDataPLiftable PDatum Plutus.Datum
  instance
    PLiftable PDatum

-- | @since 2.0.0
newtype PDatumHash (s :: S) = PDatumHash (Term s PByteString)
  deriving stock
    ( -- | @since 2.0.0
      (forall x. PDatumHash s -> Rep (PDatumHash s) x)
-> (forall x. Rep (PDatumHash s) x -> PDatumHash s)
-> Generic (PDatumHash s)
forall x. Rep (PDatumHash s) x -> PDatumHash s
forall x. PDatumHash s -> Rep (PDatumHash s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PDatumHash s) x -> PDatumHash s
forall (s :: S) x. PDatumHash s -> Rep (PDatumHash s) x
$cfrom :: forall (s :: S) x. PDatumHash s -> Rep (PDatumHash s) x
from :: forall x. PDatumHash s -> Rep (PDatumHash s) x
$cto :: forall (s :: S) x. Rep (PDatumHash s) x -> PDatumHash s
to :: forall x. Rep (PDatumHash s) x -> PDatumHash s
Generic
    )
  deriving anyclass
    ( -- | @since 3.3.0
      All SListI (Code (PDatumHash s))
All SListI (Code (PDatumHash s)) =>
(PDatumHash s -> Rep (PDatumHash s))
-> (Rep (PDatumHash s) -> PDatumHash s) -> Generic (PDatumHash s)
Rep (PDatumHash s) -> PDatumHash s
PDatumHash s -> Rep (PDatumHash s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PDatumHash s))
forall (s :: S). Rep (PDatumHash s) -> PDatumHash s
forall (s :: S). PDatumHash s -> Rep (PDatumHash s)
$cfrom :: forall (s :: S). PDatumHash s -> Rep (PDatumHash s)
from :: PDatumHash s -> Rep (PDatumHash s)
$cto :: forall (s :: S). Rep (PDatumHash s) -> PDatumHash s
to :: Rep (PDatumHash s) -> PDatumHash s
SOP.Generic
    , -- | @since 2.0.0
      (forall (s :: S). Term s (PAsData PDatumHash) -> Term s PDatumHash)
-> (forall (s :: S). Term s PDatumHash -> Term s PData)
-> PIsData PDatumHash
forall (s :: S). Term s (PAsData PDatumHash) -> Term s PDatumHash
forall (s :: S). Term s PDatumHash -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PDatumHash) -> Term s PDatumHash
pfromDataImpl :: forall (s :: S). Term s (PAsData PDatumHash) -> Term s PDatumHash
$cpdataImpl :: forall (s :: S). Term s PDatumHash -> Term s PData
pdataImpl :: forall (s :: S). Term s PDatumHash -> Term s PData
PIsData
    , -- | @since 2.0.0
      (forall (s :: S).
 Term s PDatumHash -> Term s PDatumHash -> Term s PBool)
-> PEq PDatumHash
forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
#== :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
PEq
    , -- | @since 2.0.0
      PEq PDatumHash
PEq PDatumHash =>
(forall (s :: S).
 Term s PDatumHash -> Term s PDatumHash -> Term s PBool)
-> (forall (s :: S).
    Term s PDatumHash -> Term s PDatumHash -> Term s PBool)
-> (forall (s :: S).
    Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash)
-> (forall (s :: S).
    Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash)
-> POrd PDatumHash
forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash
forall (t :: S -> Type).
PEq t =>
(forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> POrd t
$c#<= :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
#<= :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
$c#< :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
#< :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PBool
$cpmax :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash
pmax :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash
$cpmin :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash
pmin :: forall (s :: S).
Term s PDatumHash -> Term s PDatumHash -> Term s PDatumHash
POrd
    , -- | @since 2.0.0
      (forall (s :: S). Bool -> Term s PDatumHash -> Term s PString)
-> PShow PDatumHash
forall (s :: S). Bool -> Term s PDatumHash -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PDatumHash -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PDatumHash -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.3.0
      (forall (s :: S). PDatumHash s -> Term s (PInner PDatumHash))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PDatumHash)
    -> (PDatumHash s -> Term s b) -> Term s b)
-> PlutusType PDatumHash
forall (s :: S). PDatumHash s -> Term s (PInner PDatumHash)
forall (s :: S) (b :: S -> Type).
Term s (PInner PDatumHash)
-> (PDatumHash s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PDatumHash s -> Term s (PInner PDatumHash)
pcon' :: forall (s :: S). PDatumHash s -> Term s (PInner PDatumHash)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PDatumHash)
-> (PDatumHash s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PDatumHash)
-> (PDatumHash s -> Term s b) -> Term s b
PlutusType
    )
    via (DeriveNewtypePlutusType PDatumHash)

-- | @since 3.3.0
instance PLiftable PDatumHash where
  type AsHaskell PDatumHash = Plutus.DatumHash
  type PlutusRepr PDatumHash = ByteString
  {-# INLINEABLE haskToRepr #-}
  haskToRepr :: AsHaskell PDatumHash -> PlutusRepr PDatumHash
haskToRepr (Plutus.DatumHash (PlutusTx.BuiltinByteString ByteString
str)) = ByteString
PlutusRepr PDatumHash
str
  {-# INLINEABLE reprToHask #-}
  reprToHask :: PlutusRepr PDatumHash -> Either LiftError (AsHaskell PDatumHash)
reprToHask = DatumHash -> Either LiftError DatumHash
forall a b. b -> Either a b
Right (DatumHash -> Either LiftError DatumHash)
-> (ByteString -> DatumHash)
-> ByteString
-> Either LiftError DatumHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinByteString -> DatumHash
Plutus.DatumHash (BuiltinByteString -> DatumHash)
-> (ByteString -> BuiltinByteString) -> ByteString -> DatumHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinByteString
PlutusTx.BuiltinByteString
  {-# INLINEABLE reprToPlut #-}
  reprToPlut :: forall (s :: S). PlutusRepr PDatumHash -> PLifted s PDatumHash
reprToPlut = PlutusRepr PDatumHash -> PLifted s PDatumHash
forall (a :: S -> Type) (s :: S).
(PLiftable a, Includes DefaultUni (PlutusRepr a)) =>
PlutusRepr a -> PLifted s a
reprToPlutUni
  {-# INLINEABLE plutToRepr #-}
  plutToRepr :: (forall (s :: S). PLifted s PDatumHash)
-> Either LiftError (PlutusRepr PDatumHash)
plutToRepr = (forall (s :: S). PLifted s PDatumHash)
-> Either LiftError (PlutusRepr PDatumHash)
forall (a :: S -> Type).
(PLiftable a, Includes DefaultUni (PlutusRepr a)) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni

-- | @since 2.0.0
newtype PRedeemer (s :: S) = PRedeemer (Term s PData)
  deriving stock
    ( -- | @since 2.0.0
      (forall x. PRedeemer s -> Rep (PRedeemer s) x)
-> (forall x. Rep (PRedeemer s) x -> PRedeemer s)
-> Generic (PRedeemer s)
forall x. Rep (PRedeemer s) x -> PRedeemer s
forall x. PRedeemer s -> Rep (PRedeemer s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PRedeemer s) x -> PRedeemer s
forall (s :: S) x. PRedeemer s -> Rep (PRedeemer s) x
$cfrom :: forall (s :: S) x. PRedeemer s -> Rep (PRedeemer s) x
from :: forall x. PRedeemer s -> Rep (PRedeemer s) x
$cto :: forall (s :: S) x. Rep (PRedeemer s) x -> PRedeemer s
to :: forall x. Rep (PRedeemer s) x -> PRedeemer s
Generic
    )
  deriving anyclass
    ( -- | @since 2.0.0
      (forall (s :: S). Term s (PAsData PRedeemer) -> Term s PRedeemer)
-> (forall (s :: S). Term s PRedeemer -> Term s PData)
-> PIsData PRedeemer
forall (s :: S). Term s (PAsData PRedeemer) -> Term s PRedeemer
forall (s :: S). Term s PRedeemer -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PRedeemer) -> Term s PRedeemer
pfromDataImpl :: forall (s :: S). Term s (PAsData PRedeemer) -> Term s PRedeemer
$cpdataImpl :: forall (s :: S). Term s PRedeemer -> Term s PData
pdataImpl :: forall (s :: S). Term s PRedeemer -> Term s PData
PIsData
    , -- | @since 2.0.0
      (forall (s :: S).
 Term s PRedeemer -> Term s PRedeemer -> Term s PBool)
-> PEq PRedeemer
forall (s :: S).
Term s PRedeemer -> Term s PRedeemer -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PRedeemer -> Term s PRedeemer -> Term s PBool
#== :: forall (s :: S).
Term s PRedeemer -> Term s PRedeemer -> Term s PBool
PEq
    , -- | @since 2.0.0
      (forall (s :: S). Bool -> Term s PRedeemer -> Term s PString)
-> PShow PRedeemer
forall (s :: S). Bool -> Term s PRedeemer -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PRedeemer -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PRedeemer -> Term s PString
PShow
    , -- | @since WIP
      All SListI (Code (PRedeemer s))
All SListI (Code (PRedeemer s)) =>
(PRedeemer s -> Rep (PRedeemer s))
-> (Rep (PRedeemer s) -> PRedeemer s) -> Generic (PRedeemer s)
Rep (PRedeemer s) -> PRedeemer s
PRedeemer s -> Rep (PRedeemer s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PRedeemer s))
forall (s :: S). Rep (PRedeemer s) -> PRedeemer s
forall (s :: S). PRedeemer s -> Rep (PRedeemer s)
$cfrom :: forall (s :: S). PRedeemer s -> Rep (PRedeemer s)
from :: PRedeemer s -> Rep (PRedeemer s)
$cto :: forall (s :: S). Rep (PRedeemer s) -> PRedeemer s
to :: Rep (PRedeemer s) -> PRedeemer s
SOP.Generic
    )
  deriving
    ( -- | @since 2.0.0
      (forall (s :: S). PRedeemer s -> Term s (PInner PRedeemer))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PRedeemer) -> (PRedeemer s -> Term s b) -> Term s b)
-> PlutusType PRedeemer
forall (s :: S). PRedeemer s -> Term s (PInner PRedeemer)
forall (s :: S) (b :: S -> Type).
Term s (PInner PRedeemer) -> (PRedeemer s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PRedeemer s -> Term s (PInner PRedeemer)
pcon' :: forall (s :: S). PRedeemer s -> Term s (PInner PRedeemer)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PRedeemer) -> (PRedeemer s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PRedeemer) -> (PRedeemer s -> Term s b) -> Term s b
PlutusType
    )
    via (DeriveNewtypePlutusType PRedeemer)

-- | @since 3.3.0
deriving via
  DeriveDataPLiftable PRedeemer Plutus.Redeemer
  instance
    PLiftable PRedeemer

-- | @since 2.0.0
newtype PRedeemerHash (s :: S) = PRedeemerHash (Term s PByteString)
  deriving stock
    ( -- | @since 3.1.0
      (forall x. PRedeemerHash s -> Rep (PRedeemerHash s) x)
-> (forall x. Rep (PRedeemerHash s) x -> PRedeemerHash s)
-> Generic (PRedeemerHash s)
forall x. Rep (PRedeemerHash s) x -> PRedeemerHash s
forall x. PRedeemerHash s -> Rep (PRedeemerHash s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PRedeemerHash s) x -> PRedeemerHash s
forall (s :: S) x. PRedeemerHash s -> Rep (PRedeemerHash s) x
$cfrom :: forall (s :: S) x. PRedeemerHash s -> Rep (PRedeemerHash s) x
from :: forall x. PRedeemerHash s -> Rep (PRedeemerHash s) x
$cto :: forall (s :: S) x. Rep (PRedeemerHash s) x -> PRedeemerHash s
to :: forall x. Rep (PRedeemerHash s) x -> PRedeemerHash s
Generic
    )
  deriving anyclass
    ( -- | @since 3.3.0
      All SListI (Code (PRedeemerHash s))
All SListI (Code (PRedeemerHash s)) =>
(PRedeemerHash s -> Rep (PRedeemerHash s))
-> (Rep (PRedeemerHash s) -> PRedeemerHash s)
-> Generic (PRedeemerHash s)
Rep (PRedeemerHash s) -> PRedeemerHash s
PRedeemerHash s -> Rep (PRedeemerHash s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PRedeemerHash s))
forall (s :: S). Rep (PRedeemerHash s) -> PRedeemerHash s
forall (s :: S). PRedeemerHash s -> Rep (PRedeemerHash s)
$cfrom :: forall (s :: S). PRedeemerHash s -> Rep (PRedeemerHash s)
from :: PRedeemerHash s -> Rep (PRedeemerHash s)
$cto :: forall (s :: S). Rep (PRedeemerHash s) -> PRedeemerHash s
to :: Rep (PRedeemerHash s) -> PRedeemerHash s
SOP.Generic
    , -- | @since 3.1.0
      (forall (s :: S).
 Term s (PAsData PRedeemerHash) -> Term s PRedeemerHash)
-> (forall (s :: S). Term s PRedeemerHash -> Term s PData)
-> PIsData PRedeemerHash
forall (s :: S).
Term s (PAsData PRedeemerHash) -> Term s PRedeemerHash
forall (s :: S). Term s PRedeemerHash -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PRedeemerHash) -> Term s PRedeemerHash
pfromDataImpl :: forall (s :: S).
Term s (PAsData PRedeemerHash) -> Term s PRedeemerHash
$cpdataImpl :: forall (s :: S). Term s PRedeemerHash -> Term s PData
pdataImpl :: forall (s :: S). Term s PRedeemerHash -> Term s PData
PIsData
    , -- | @since 3.1.0
      (forall (s :: S).
 Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool)
-> PEq PRedeemerHash
forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
#== :: forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
PEq
    , -- | @since 3.1.0
      PEq PRedeemerHash
PEq PRedeemerHash =>
(forall (s :: S).
 Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool)
-> (forall (s :: S).
    Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool)
-> (forall (s :: S).
    Term s PRedeemerHash
    -> Term s PRedeemerHash -> Term s PRedeemerHash)
-> (forall (s :: S).
    Term s PRedeemerHash
    -> Term s PRedeemerHash -> Term s PRedeemerHash)
-> POrd PRedeemerHash
forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
forall (s :: S).
Term s PRedeemerHash
-> Term s PRedeemerHash -> Term s PRedeemerHash
forall (t :: S -> Type).
PEq t =>
(forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> POrd t
$c#<= :: forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
#<= :: forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
$c#< :: forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
#< :: forall (s :: S).
Term s PRedeemerHash -> Term s PRedeemerHash -> Term s PBool
$cpmax :: forall (s :: S).
Term s PRedeemerHash
-> Term s PRedeemerHash -> Term s PRedeemerHash
pmax :: forall (s :: S).
Term s PRedeemerHash
-> Term s PRedeemerHash -> Term s PRedeemerHash
$cpmin :: forall (s :: S).
Term s PRedeemerHash
-> Term s PRedeemerHash -> Term s PRedeemerHash
pmin :: forall (s :: S).
Term s PRedeemerHash
-> Term s PRedeemerHash -> Term s PRedeemerHash
POrd
    , -- | @since 3.1.0
      (forall (s :: S). Bool -> Term s PRedeemerHash -> Term s PString)
-> PShow PRedeemerHash
forall (s :: S). Bool -> Term s PRedeemerHash -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PRedeemerHash -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PRedeemerHash -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.3.0
      (forall (s :: S). PRedeemerHash s -> Term s (PInner PRedeemerHash))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PRedeemerHash)
    -> (PRedeemerHash s -> Term s b) -> Term s b)
-> PlutusType PRedeemerHash
forall (s :: S). PRedeemerHash s -> Term s (PInner PRedeemerHash)
forall (s :: S) (b :: S -> Type).
Term s (PInner PRedeemerHash)
-> (PRedeemerHash s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PRedeemerHash s -> Term s (PInner PRedeemerHash)
pcon' :: forall (s :: S). PRedeemerHash s -> Term s (PInner PRedeemerHash)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PRedeemerHash)
-> (PRedeemerHash s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PRedeemerHash)
-> (PRedeemerHash s -> Term s b) -> Term s b
PlutusType
    )
    via (DeriveNewtypePlutusType PRedeemerHash)

-- | @since 3.3.0
instance PLiftable PRedeemerHash where
  type AsHaskell PRedeemerHash = Plutus.RedeemerHash
  type PlutusRepr PRedeemerHash = ByteString
  {-# INLINEABLE haskToRepr #-}
  haskToRepr :: AsHaskell PRedeemerHash -> PlutusRepr PRedeemerHash
haskToRepr (Plutus.RedeemerHash (PlutusTx.BuiltinByteString ByteString
str)) = ByteString
PlutusRepr PRedeemerHash
str
  {-# INLINEABLE reprToHask #-}
  reprToHask :: PlutusRepr PRedeemerHash
-> Either LiftError (AsHaskell PRedeemerHash)
reprToHask = RedeemerHash -> Either LiftError RedeemerHash
forall a b. b -> Either a b
Right (RedeemerHash -> Either LiftError RedeemerHash)
-> (ByteString -> RedeemerHash)
-> ByteString
-> Either LiftError RedeemerHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinByteString -> RedeemerHash
Plutus.RedeemerHash (BuiltinByteString -> RedeemerHash)
-> (ByteString -> BuiltinByteString) -> ByteString -> RedeemerHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> BuiltinByteString
PlutusTx.BuiltinByteString
  {-# INLINEABLE reprToPlut #-}
  reprToPlut :: forall (s :: S).
PlutusRepr PRedeemerHash -> PLifted s PRedeemerHash
reprToPlut = PlutusRepr PRedeemerHash -> PLifted s PRedeemerHash
forall (a :: S -> Type) (s :: S).
(PLiftable a, Includes DefaultUni (PlutusRepr a)) =>
PlutusRepr a -> PLifted s a
reprToPlutUni
  {-# INLINEABLE plutToRepr #-}
  plutToRepr :: (forall (s :: S). PLifted s PRedeemerHash)
-> Either LiftError (PlutusRepr PRedeemerHash)
plutToRepr = (forall (s :: S). PLifted s PRedeemerHash)
-> Either LiftError (PlutusRepr PRedeemerHash)
forall (a :: S -> Type).
(PLiftable a, Includes DefaultUni (PlutusRepr a)) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni