{-# OPTIONS_GHC -Wno-orphans #-}

-- Mirrors the equivalent V1 module in plutus-ledger-api
module Plutarch.LedgerApi.V1.Time (
  -- * Type
  PPosixTime (..),

  -- * Functions
  pposixTime,
  unPPosixTime,
) where

import GHC.Generics (Generic)
import Generics.SOP qualified as SOP
import Plutarch.Prelude
import PlutusLedgerApi.V1 qualified as Plutus

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

-- | @since 3.3.0
instance PCountable PPosixTime where
  {-# INLINEABLE psuccessor #-}
  psuccessor :: forall (s :: S). Term s (PPosixTime :--> PPosixTime)
psuccessor = (forall (s :: S). Term s (PPosixTime :--> PPosixTime))
-> Term s (PPosixTime :--> PPosixTime)
forall (a :: S -> Type) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S). Term s (PPosixTime :--> PPosixTime))
 -> Term s (PPosixTime :--> PPosixTime))
-> (forall (s :: S). Term s (PPosixTime :--> PPosixTime))
-> Term s (PPosixTime :--> PPosixTime)
forall a b. (a -> b) -> a -> b
$ (Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPosixTime :--> PPosixTime)
forall a (b :: S -> Type) (s :: S) (c :: S -> Type).
(PLamN a b s, HasCallStack) =>
(Term s c -> a) -> Term s (c :--> b)
forall (c :: S -> Type).
HasCallStack =>
(Term s c -> Term s PPosixTime) -> Term s (c :--> PPosixTime)
plam (\Term s PPosixTime
x -> Term s PPosixTime
x Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (s :: S).
Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (a :: S -> Type) (s :: S).
PAdditiveSemigroup a =>
Term s a -> Term s a -> Term s a
#+ Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime Term s PInteger
forall (s :: S). Term s PInteger
forall (a :: S -> Type) (s :: S).
PMultiplicativeMonoid a =>
Term s a
pone)
  {-# INLINEABLE psuccessorN #-}
  psuccessorN :: forall (s :: S).
Term s (PPositive :--> (PPosixTime :--> PPosixTime))
psuccessorN = (forall (s :: S).
 Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall (a :: S -> Type) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
  Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
 -> Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> (forall (s :: S).
    Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall a b. (a -> b) -> a -> b
$ (Term s PPositive -> Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall a (b :: S -> Type) (s :: S) (c :: S -> Type).
(PLamN a b s, HasCallStack) =>
(Term s c -> a) -> Term s (c :--> b)
forall (c :: S -> Type).
HasCallStack =>
(Term s c -> Term s PPosixTime -> Term s PPosixTime)
-> Term s (c :--> (PPosixTime :--> PPosixTime))
plam ((Term s PPositive -> Term s PPosixTime -> Term s PPosixTime)
 -> Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> (Term s PPositive -> Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall a b. (a -> b) -> a -> b
$ \Term s PPositive
p Term s PPosixTime
t ->
    let p' :: Term s PPosixTime
p' = PPosixTime s -> Term s PPosixTime
forall (a :: S -> Type) (s :: S). PlutusType a => a s -> Term s a
pcon (PPosixTime s -> Term s PPosixTime)
-> (Term s PPositive -> PPosixTime s)
-> Term s PPositive
-> Term s PPosixTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term s PInteger -> PPosixTime s
forall (s :: S). Term s PInteger -> PPosixTime s
PPosixTime (Term s PInteger -> PPosixTime s)
-> (Term s PPositive -> Term s PInteger)
-> Term s PPositive
-> PPosixTime s
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term s PPositive -> Term s PInteger
Term s PPositive -> Term s (PInner PPositive)
forall (s :: S) (a :: S -> Type). Term s a -> Term s (PInner a)
pto (Term s PPositive -> Term s PPosixTime)
-> Term s PPositive -> Term s PPosixTime
forall a b. (a -> b) -> a -> b
$ Term s PPositive
p
     in Term s PPosixTime
p' Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (s :: S).
Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (a :: S -> Type) (s :: S).
PAdditiveSemigroup a =>
Term s a -> Term s a -> Term s a
#+ Term s PPosixTime
t

-- | @since 3.3.0
instance PEnumerable PPosixTime where
  {-# INLINEABLE ppredecessor #-}
  ppredecessor :: forall (s :: S). Term s (PPosixTime :--> PPosixTime)
ppredecessor = (forall (s :: S). Term s (PPosixTime :--> PPosixTime))
-> Term s (PPosixTime :--> PPosixTime)
forall (a :: S -> Type) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S). Term s (PPosixTime :--> PPosixTime))
 -> Term s (PPosixTime :--> PPosixTime))
-> (forall (s :: S). Term s (PPosixTime :--> PPosixTime))
-> Term s (PPosixTime :--> PPosixTime)
forall a b. (a -> b) -> a -> b
$ (Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPosixTime :--> PPosixTime)
forall a (b :: S -> Type) (s :: S) (c :: S -> Type).
(PLamN a b s, HasCallStack) =>
(Term s c -> a) -> Term s (c :--> b)
forall (c :: S -> Type).
HasCallStack =>
(Term s c -> Term s PPosixTime) -> Term s (c :--> PPosixTime)
plam (\Term s PPosixTime
x -> Term s PPosixTime
x Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (s :: S).
Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (a :: S -> Type) (s :: S).
PAdditiveGroup a =>
Term s a -> Term s a -> Term s a
#- Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime Term s PInteger
forall (s :: S). Term s PInteger
forall (a :: S -> Type) (s :: S).
PMultiplicativeMonoid a =>
Term s a
pone)
  {-# INLINEABLE ppredecessorN #-}
  ppredecessorN :: forall (s :: S).
Term s (PPositive :--> (PPosixTime :--> PPosixTime))
ppredecessorN = (forall (s :: S).
 Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall (a :: S -> Type) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S).
  Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
 -> Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> (forall (s :: S).
    Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall a b. (a -> b) -> a -> b
$ (Term s PPositive -> Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall a (b :: S -> Type) (s :: S) (c :: S -> Type).
(PLamN a b s, HasCallStack) =>
(Term s c -> a) -> Term s (c :--> b)
forall (c :: S -> Type).
HasCallStack =>
(Term s c -> Term s PPosixTime -> Term s PPosixTime)
-> Term s (c :--> (PPosixTime :--> PPosixTime))
plam ((Term s PPositive -> Term s PPosixTime -> Term s PPosixTime)
 -> Term s (PPositive :--> (PPosixTime :--> PPosixTime)))
-> (Term s PPositive -> Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPositive :--> (PPosixTime :--> PPosixTime))
forall a b. (a -> b) -> a -> b
$ \Term s PPositive
p Term s PPosixTime
t ->
    let p' :: Term s PPosixTime
p' = PPosixTime s -> Term s PPosixTime
forall (a :: S -> Type) (s :: S). PlutusType a => a s -> Term s a
pcon (PPosixTime s -> Term s PPosixTime)
-> (Term s PPositive -> PPosixTime s)
-> Term s PPositive
-> Term s PPosixTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term s PInteger -> PPosixTime s
forall (s :: S). Term s PInteger -> PPosixTime s
PPosixTime (Term s PInteger -> PPosixTime s)
-> (Term s PPositive -> Term s PInteger)
-> Term s PPositive
-> PPosixTime s
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term s PPositive -> Term s PInteger
Term s PPositive -> Term s (PInner PPositive)
forall (s :: S) (a :: S -> Type). Term s a -> Term s (PInner a)
pto (Term s PPositive -> Term s PPosixTime)
-> Term s PPositive -> Term s PPosixTime
forall a b. (a -> b) -> a -> b
$ Term s PPositive
p
     in Term s PPosixTime
t Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (s :: S).
Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
forall (a :: S -> Type) (s :: S).
PAdditiveGroup a =>
Term s a -> Term s a -> Term s a
#- Term s PPosixTime
p'

-- | @since 3.3.0
instance PAdditiveSemigroup PPosixTime where
  {-# INLINEABLE (#+) #-}
  Term s PPosixTime
t1 #+ :: forall (s :: S).
Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
#+ Term s PPosixTime
t2 = Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime (Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t1 Term s PInteger -> Term s PInteger -> Term s PInteger
forall (s :: S).
Term s PInteger -> Term s PInteger -> Term s PInteger
forall (a :: S -> Type) (s :: S).
PAdditiveSemigroup a =>
Term s a -> Term s a -> Term s a
#+ Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t2)
  {-# INLINEABLE pscalePositive #-}
  pscalePositive :: forall (s :: S).
Term s PPosixTime -> Term s PPositive -> Term s PPosixTime
pscalePositive Term s PPosixTime
t Term s PPositive
p = Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime (Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t Term s PInteger -> Term s PInteger -> Term s PInteger
forall (s :: S).
Term s PInteger -> Term s PInteger -> Term s PInteger
forall (a :: S -> Type) (s :: S).
PMultiplicativeSemigroup a =>
Term s a -> Term s a -> Term s a
#* Term s PPositive -> Term s (PInner PPositive)
forall (s :: S) (a :: S -> Type). Term s a -> Term s (PInner a)
pto Term s PPositive
p)

-- | @since 3.3.0
instance PAdditiveMonoid PPosixTime where
  {-# INLINEABLE pzero #-}
  pzero :: forall (s :: S). Term s PPosixTime
pzero = Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime Term s PInteger
forall (s :: S). Term s PInteger
forall (a :: S -> Type) (s :: S). PAdditiveMonoid a => Term s a
pzero
  {-# INLINEABLE pscaleNatural #-}
  pscaleNatural :: forall (s :: S).
Term s PPosixTime -> Term s PNatural -> Term s PPosixTime
pscaleNatural Term s PPosixTime
t Term s PNatural
n = Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime (Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t Term s PInteger -> Term s PInteger -> Term s PInteger
forall (s :: S).
Term s PInteger -> Term s PInteger -> Term s PInteger
forall (a :: S -> Type) (s :: S).
PMultiplicativeSemigroup a =>
Term s a -> Term s a -> Term s a
#* Term s PNatural -> Term s (PInner PNatural)
forall (s :: S) (a :: S -> Type). Term s a -> Term s (PInner a)
pto Term s PNatural
n)

-- | @since 3.3.0
instance PAdditiveGroup PPosixTime where
  {-# INLINEABLE pnegate #-}
  pnegate :: forall (s :: S). Term s (PPosixTime :--> PPosixTime)
pnegate = (forall (s :: S). Term s (PPosixTime :--> PPosixTime))
-> Term s (PPosixTime :--> PPosixTime)
forall (a :: S -> Type) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic ((forall (s :: S). Term s (PPosixTime :--> PPosixTime))
 -> Term s (PPosixTime :--> PPosixTime))
-> (forall (s :: S). Term s (PPosixTime :--> PPosixTime))
-> Term s (PPosixTime :--> PPosixTime)
forall a b. (a -> b) -> a -> b
$ (Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPosixTime :--> PPosixTime)
forall a (b :: S -> Type) (s :: S) (c :: S -> Type).
(PLamN a b s, HasCallStack) =>
(Term s c -> a) -> Term s (c :--> b)
forall (c :: S -> Type).
HasCallStack =>
(Term s c -> Term s PPosixTime) -> Term s (c :--> PPosixTime)
plam ((Term s PPosixTime -> Term s PPosixTime)
 -> Term s (PPosixTime :--> PPosixTime))
-> (Term s PPosixTime -> Term s PPosixTime)
-> Term s (PPosixTime :--> PPosixTime)
forall a b. (a -> b) -> a -> b
$ \Term s PPosixTime
t -> Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime (Term s (PInteger :--> PInteger)
forall (s :: S). Term s (PInteger :--> PInteger)
forall (a :: S -> Type) (s :: S).
PAdditiveGroup a =>
Term s (a :--> a)
pnegate Term s (PInteger :--> PInteger)
-> Term s PInteger -> Term s PInteger
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t)
  {-# INLINEABLE (#-) #-}
  Term s PPosixTime
t1 #- :: forall (s :: S).
Term s PPosixTime -> Term s PPosixTime -> Term s PPosixTime
#- Term s PPosixTime
t2 = Term s PInteger -> Term s PPosixTime
forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime (Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t1 Term s PInteger -> Term s PInteger -> Term s PInteger
forall (s :: S).
Term s PInteger -> Term s PInteger -> Term s PInteger
forall (a :: S -> Type) (s :: S).
PAdditiveGroup a =>
Term s a -> Term s a -> Term s a
#- Term s PPosixTime -> Term s PInteger
forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime Term s PPosixTime
t2)

-- | @since 3.3.0
deriving via
  DeriveNewtypePLiftable PPosixTime Plutus.POSIXTime
  instance
    PLiftable PPosixTime

{- | Construct a 'PPosixTime' from a 'PInteger'. Same as using the constructor,
but a lot shorter.

@since 3.3.0
-}
pposixTime :: forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime :: forall (s :: S). Term s PInteger -> Term s PPosixTime
pposixTime = PPosixTime s -> Term s PPosixTime
forall (a :: S -> Type) (s :: S). PlutusType a => a s -> Term s a
pcon (PPosixTime s -> Term s PPosixTime)
-> (Term s PInteger -> PPosixTime s)
-> Term s PInteger
-> Term s PPosixTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term s PInteger -> PPosixTime s
forall (s :: S). Term s PInteger -> PPosixTime s
PPosixTime

{- | Unwrap a 'PPosixTime' to get a 'PInteger'. Same as using 'pmatch', but a
lot shorter. Also unwraps the @Data@ encoding.

@since 3.3.0
-}
unPPosixTime :: forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime :: forall (s :: S). Term s PPosixTime -> Term s PInteger
unPPosixTime = Term s PPosixTime -> Term s PInteger
Term s PPosixTime -> Term s (PInner PPosixTime)
forall (s :: S) (a :: S -> Type). Term s a -> Term s (PInner a)
pto