Skip to content

Commit

Permalink
Remove Flip export and define inline everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
TotallyNotChase committed Jul 29, 2022
1 parent 7bfb370 commit 77bbe60
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Plutarch/Api/V1/AssocMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import qualified PlutusTx.Monoid as PlutusTx
import qualified PlutusTx.Semigroup as PlutusTx

import Plutarch.Builtin (
Flip,
pasMap,
pdataImpl,
pforgetData,
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Plutarch/Api/V1/Crypto.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion Plutarch/Api/V1/Scripts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
3 changes: 2 additions & 1 deletion Plutarch/Api/V1/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Plutarch/Api/V1/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Plutarch/Api/V1/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion Plutarch/Builtin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{-# OPTIONS_GHC -Wno-orphans #-}

module Plutarch.Builtin (
Flip,
PData,
pfstBuiltin,
psndBuiltin,
Expand Down

0 comments on commit 77bbe60

Please sign in to comment.