diff --git a/Plutarch/Api/V1/AssocMap.hs b/Plutarch/Api/V1/AssocMap.hs index 1e13f0bf6..29010c9aa 100644 --- a/Plutarch/Api/V1/AssocMap.hs +++ b/Plutarch/Api/V1/AssocMap.hs @@ -50,7 +50,6 @@ import qualified PlutusTx.Monoid as PlutusTx import qualified PlutusTx.Semigroup as PlutusTx import Plutarch.Builtin ( - Flip, pasMap, pdataImpl, pforgetData, @@ -85,6 +84,8 @@ data KeyGuarantees = Sorted | Unsorted type PBuiltinListOfPairs k v = PBuiltinList (PBuiltinPair (PAsData k) (PAsData v)) +newtype Flip f a b = Flip (f b a) deriving stock (Generic) + type role PMap nominal nominal nominal nominal newtype PMap (keysort :: KeyGuarantees) (k :: PType) (v :: PType) (s :: S) = PMap (Term s (PBuiltinList (PBuiltinPair (PAsData k) (PAsData v)))) deriving stock (Generic) diff --git a/Plutarch/Api/V1/Crypto.hs b/Plutarch/Api/V1/Crypto.hs index 9d15c9f23..1cc2acf46 100644 --- a/Plutarch/Api/V1/Crypto.hs +++ b/Plutarch/Api/V1/Crypto.hs @@ -12,7 +12,6 @@ import qualified PlutusLedgerApi.V1 as Plutus import Data.Coerce (coerce) import Plutarch.Api.Internal.Hashing (hashLedgerBytes) -import Plutarch.Builtin (Flip) import Plutarch.Lift ( DerivePConstantViaBuiltin (DerivePConstantViaBuiltin), PConstantDecl, @@ -45,5 +44,7 @@ instance PTryFrom PData (PAsData PPubKeyHash) where newtype PubKey = PubKey {getPubKey :: Plutus.LedgerBytes} deriving stock (Eq, Ord, Show) +newtype Flip f a b = Flip (f b a) deriving stock (Generic) + pubKeyHash :: PubKey -> Plutus.PubKeyHash pubKeyHash = coerce hashLedgerBytes diff --git a/Plutarch/Api/V1/Scripts.hs b/Plutarch/Api/V1/Scripts.hs index 2917083d9..b332ec649 100644 --- a/Plutarch/Api/V1/Scripts.hs +++ b/Plutarch/Api/V1/Scripts.hs @@ -16,7 +16,6 @@ module Plutarch.Api.V1.Scripts ( import qualified PlutusLedgerApi.V1 as Plutus import qualified PlutusLedgerApi.V1.Scripts as Plutus -import Plutarch.Builtin (Flip) import Plutarch.Lift ( DerivePConstantViaBuiltin (DerivePConstantViaBuiltin), PConstantDecl, @@ -113,3 +112,5 @@ deriving via (DerivePConstantViaBuiltin Plutus.ScriptHash PScriptHash PByteString) instance PConstantDecl Plutus.ScriptHash + +newtype Flip f a b = Flip (f b a) deriving stock (Generic) diff --git a/Plutarch/Api/V1/Time.hs b/Plutarch/Api/V1/Time.hs index f8be9fe47..fd169ba1b 100644 --- a/Plutarch/Api/V1/Time.hs +++ b/Plutarch/Api/V1/Time.hs @@ -11,7 +11,6 @@ import Plutarch.Num (PNum) import qualified PlutusLedgerApi.V1 as Plutus import Plutarch.Api.V1.Interval (PInterval) -import Plutarch.Builtin (Flip) import Plutarch.Lift ( DerivePConstantViaNewtype (DerivePConstantViaNewtype), PConstantDecl, @@ -36,6 +35,8 @@ deriving via type PPOSIXTimeRange = PInterval PPOSIXTime +newtype Flip f a b = Flip (f b a) deriving stock (Generic) + instance PTryFrom PData (PAsData PPOSIXTime) where type PTryFromExcess PData (PAsData PPOSIXTime) = Flip Term PPOSIXTime ptryFrom' opq = runTermCont $ do diff --git a/Plutarch/Api/V1/Tx.hs b/Plutarch/Api/V1/Tx.hs index 1b0bd0ca5..370ba7ca2 100644 --- a/Plutarch/Api/V1/Tx.hs +++ b/Plutarch/Api/V1/Tx.hs @@ -20,7 +20,7 @@ import Plutarch.Api.V1.Value ( KeyGuarantees (Sorted), PValue, ) -import Plutarch.Builtin (Flip, pasConstr) +import Plutarch.Builtin (pasConstr) import Plutarch.DataRepr ( DerivePConstantViaData (DerivePConstantViaData), PDataFields, @@ -34,6 +34,8 @@ import Plutarch.Prelude import Plutarch.TryFrom (PTryFrom (PTryFromExcess, ptryFrom')) import Plutarch.Unsafe (punsafeCoerce) +newtype Flip f a b = Flip (f b a) deriving stock (Generic) + newtype PTxId (s :: S) = PTxId (Term s (PDataRecord '["_0" ':= PByteString])) deriving stock (Generic) diff --git a/Plutarch/Api/V1/Value.hs b/Plutarch/Api/V1/Value.hs index 123d9ea2b..4cb776729 100644 --- a/Plutarch/Api/V1/Value.hs +++ b/Plutarch/Api/V1/Value.hs @@ -58,7 +58,6 @@ import qualified PlutusLedgerApi.V1 as Plutus import Plutarch.Api.V1.AssocMap (KeyGuarantees (Sorted, Unsorted), PMap (..)) import qualified Plutarch.Api.V1.AssocMap as AssocMap import Plutarch.Bool (pand', pif') -import Plutarch.Builtin (Flip) import Plutarch.Lift ( DerivePConstantViaBuiltin (DerivePConstantViaBuiltin), DerivePConstantViaNewtype (DerivePConstantViaNewtype), @@ -74,6 +73,8 @@ import qualified PlutusTx.Semigroup as PlutusTx import Plutarch.Prelude hiding (psingleton) +newtype Flip f a b = Flip (f b a) deriving stock (Generic) + newtype PTokenName (s :: S) = PTokenName (Term s PByteString) deriving stock (Generic) deriving anyclass (PlutusType, PIsData, PEq, PPartialOrd, POrd) diff --git a/Plutarch/Builtin.hs b/Plutarch/Builtin.hs index 080bdb710..b01ca4932 100644 --- a/Plutarch/Builtin.hs +++ b/Plutarch/Builtin.hs @@ -3,7 +3,6 @@ {-# OPTIONS_GHC -Wno-orphans #-} module Plutarch.Builtin ( - Flip, PData, pfstBuiltin, psndBuiltin,