{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-identities #-}
{-# OPTIONS_GHC -fno-ignore-interface-pragmas #-}
{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}
module PlutusLedgerApi.V1.Data.Time (
POSIXTime (..),
POSIXTimeRange,
DiffMilliSeconds (..),
fromMilliSeconds,
) where
import PlutusTx.Prelude
import Prelude qualified as Haskell
import Control.DeepSeq (NFData)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import PlutusLedgerApi.V1.Data.Interval (Interval)
import PlutusTx qualified
import PlutusTx.Blueprint.Class (HasBlueprintSchema (..))
import PlutusTx.Blueprint.Definition (HasBlueprintDefinition)
import PlutusTx.Blueprint.Schema (Schema (SchemaInteger), emptyIntegerSchema)
import PlutusTx.Blueprint.Schema.Annotation (SchemaInfo (..), emptySchemaInfo)
import PlutusTx.Lift (makeLift)
import Prettyprinter (Pretty (pretty), (<+>))
newtype DiffMilliSeconds = DiffMilliSeconds Integer
deriving stock (DiffMilliSeconds -> DiffMilliSeconds -> Bool
(DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> Eq DiffMilliSeconds
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
== :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c/= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
/= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
Haskell.Eq, Eq DiffMilliSeconds
Eq DiffMilliSeconds =>
(DiffMilliSeconds -> DiffMilliSeconds -> Ordering)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> Ord DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds -> Bool
DiffMilliSeconds -> DiffMilliSeconds -> Ordering
DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
compare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
$c< :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
< :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c<= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
<= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c> :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
> :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c>= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
>= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$cmax :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
max :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmin :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
min :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
Haskell.Ord, Int -> DiffMilliSeconds -> ShowS
[DiffMilliSeconds] -> ShowS
DiffMilliSeconds -> String
(Int -> DiffMilliSeconds -> ShowS)
-> (DiffMilliSeconds -> String)
-> ([DiffMilliSeconds] -> ShowS)
-> Show DiffMilliSeconds
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DiffMilliSeconds -> ShowS
showsPrec :: Int -> DiffMilliSeconds -> ShowS
$cshow :: DiffMilliSeconds -> String
show :: DiffMilliSeconds -> String
$cshowList :: [DiffMilliSeconds] -> ShowS
showList :: [DiffMilliSeconds] -> ShowS
Haskell.Show, (forall x. DiffMilliSeconds -> Rep DiffMilliSeconds x)
-> (forall x. Rep DiffMilliSeconds x -> DiffMilliSeconds)
-> Generic DiffMilliSeconds
forall x. Rep DiffMilliSeconds x -> DiffMilliSeconds
forall x. DiffMilliSeconds -> Rep DiffMilliSeconds x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DiffMilliSeconds -> Rep DiffMilliSeconds x
from :: forall x. DiffMilliSeconds -> Rep DiffMilliSeconds x
$cto :: forall x. Rep DiffMilliSeconds x -> DiffMilliSeconds
to :: forall x. Rep DiffMilliSeconds x -> DiffMilliSeconds
Generic, Typeable)
deriving anyclass (DiffMilliSeconds -> ()
(DiffMilliSeconds -> ()) -> NFData DiffMilliSeconds
forall a. (a -> ()) -> NFData a
$crnf :: DiffMilliSeconds -> ()
rnf :: DiffMilliSeconds -> ()
NFData, DefinitionId
DefinitionId -> HasBlueprintDefinition DiffMilliSeconds
forall t. DefinitionId -> HasBlueprintDefinition t
$cdefinitionId :: DefinitionId
definitionId :: DefinitionId
HasBlueprintDefinition)
deriving newtype
( Integer -> DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
(DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds)
-> (Integer -> DiffMilliSeconds)
-> Num DiffMilliSeconds
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c* :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
* :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cnegate :: DiffMilliSeconds -> DiffMilliSeconds
negate :: DiffMilliSeconds -> DiffMilliSeconds
$cabs :: DiffMilliSeconds -> DiffMilliSeconds
abs :: DiffMilliSeconds -> DiffMilliSeconds
$csignum :: DiffMilliSeconds -> DiffMilliSeconds
signum :: DiffMilliSeconds -> DiffMilliSeconds
$cfromInteger :: Integer -> DiffMilliSeconds
fromInteger :: Integer -> DiffMilliSeconds
Haskell.Num
, DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
(DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> AdditiveSemigroup DiffMilliSeconds
forall a. (a -> a -> a) -> AdditiveSemigroup a
$c+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
AdditiveSemigroup
, AdditiveSemigroup DiffMilliSeconds
DiffMilliSeconds
AdditiveSemigroup DiffMilliSeconds =>
DiffMilliSeconds -> AdditiveMonoid DiffMilliSeconds
forall a. AdditiveSemigroup a => a -> AdditiveMonoid a
$czero :: DiffMilliSeconds
zero :: DiffMilliSeconds
AdditiveMonoid
, AdditiveMonoid DiffMilliSeconds
AdditiveMonoid DiffMilliSeconds =>
(DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> AdditiveGroup DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
forall a. AdditiveMonoid a => (a -> a -> a) -> AdditiveGroup a
$c- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
AdditiveGroup
, Int -> DiffMilliSeconds
DiffMilliSeconds -> Int
DiffMilliSeconds -> [DiffMilliSeconds]
DiffMilliSeconds -> DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
DiffMilliSeconds
-> DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
(DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds)
-> (Int -> DiffMilliSeconds)
-> (DiffMilliSeconds -> Int)
-> (DiffMilliSeconds -> [DiffMilliSeconds])
-> (DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds])
-> (DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds])
-> (DiffMilliSeconds
-> DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds])
-> Enum DiffMilliSeconds
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: DiffMilliSeconds -> DiffMilliSeconds
succ :: DiffMilliSeconds -> DiffMilliSeconds
$cpred :: DiffMilliSeconds -> DiffMilliSeconds
pred :: DiffMilliSeconds -> DiffMilliSeconds
$ctoEnum :: Int -> DiffMilliSeconds
toEnum :: Int -> DiffMilliSeconds
$cfromEnum :: DiffMilliSeconds -> Int
fromEnum :: DiffMilliSeconds -> Int
$cenumFrom :: DiffMilliSeconds -> [DiffMilliSeconds]
enumFrom :: DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFromThen :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
enumFromThen :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFromTo :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
enumFromTo :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFromThenTo :: DiffMilliSeconds
-> DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
enumFromThenTo :: DiffMilliSeconds
-> DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
Haskell.Enum
, DiffMilliSeconds -> DiffMilliSeconds -> Bool
(DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> Eq DiffMilliSeconds
forall a. (a -> a -> Bool) -> Eq a
$c== :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
== :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
Eq
, Eq DiffMilliSeconds
Eq DiffMilliSeconds =>
(DiffMilliSeconds -> DiffMilliSeconds -> Ordering)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> Ord DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds -> Bool
DiffMilliSeconds -> DiffMilliSeconds -> Ordering
DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
compare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
$c< :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
< :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c<= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
<= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c> :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
> :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c>= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
>= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$cmax :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
max :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmin :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
min :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
Ord
, Num DiffMilliSeconds
Ord DiffMilliSeconds
(Num DiffMilliSeconds, Ord DiffMilliSeconds) =>
(DiffMilliSeconds -> Rational) -> Real DiffMilliSeconds
DiffMilliSeconds -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: DiffMilliSeconds -> Rational
toRational :: DiffMilliSeconds -> Rational
Haskell.Real
, Enum DiffMilliSeconds
Real DiffMilliSeconds
(Real DiffMilliSeconds, Enum DiffMilliSeconds) =>
(DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> (DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds))
-> (DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds))
-> (DiffMilliSeconds -> Integer)
-> Integral DiffMilliSeconds
DiffMilliSeconds -> Integer
DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
forall a.
(Real a, Enum a) =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
$cquot :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
quot :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$crem :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
rem :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cdiv :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
div :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmod :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
mod :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cquotRem :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
quotRem :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
$cdivMod :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
divMod :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
$ctoInteger :: DiffMilliSeconds -> Integer
toInteger :: DiffMilliSeconds -> Integer
Haskell.Integral
, DiffMilliSeconds -> BuiltinData
(DiffMilliSeconds -> BuiltinData) -> ToData DiffMilliSeconds
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: DiffMilliSeconds -> BuiltinData
toBuiltinData :: DiffMilliSeconds -> BuiltinData
PlutusTx.ToData
, BuiltinData -> Maybe DiffMilliSeconds
(BuiltinData -> Maybe DiffMilliSeconds)
-> FromData DiffMilliSeconds
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe DiffMilliSeconds
fromBuiltinData :: BuiltinData -> Maybe DiffMilliSeconds
PlutusTx.FromData
, BuiltinData -> DiffMilliSeconds
(BuiltinData -> DiffMilliSeconds)
-> UnsafeFromData DiffMilliSeconds
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> DiffMilliSeconds
unsafeFromBuiltinData :: BuiltinData -> DiffMilliSeconds
PlutusTx.UnsafeFromData
)
instance HasBlueprintSchema DiffMilliSeconds referencedTypes where
schema :: Schema referencedTypes
schema = SchemaInfo -> IntegerSchema -> Schema referencedTypes
forall (referencedTypes :: [*]).
SchemaInfo -> IntegerSchema -> Schema referencedTypes
SchemaInteger SchemaInfo
emptySchemaInfo{title = Just "DiffMilliSeconds"} IntegerSchema
emptyIntegerSchema
newtype POSIXTime = POSIXTime {POSIXTime -> Integer
getPOSIXTime :: Integer}
deriving stock (POSIXTime -> POSIXTime -> Bool
(POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool) -> Eq POSIXTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: POSIXTime -> POSIXTime -> Bool
== :: POSIXTime -> POSIXTime -> Bool
$c/= :: POSIXTime -> POSIXTime -> Bool
/= :: POSIXTime -> POSIXTime -> Bool
Haskell.Eq, Eq POSIXTime
Eq POSIXTime =>
(POSIXTime -> POSIXTime -> Ordering)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> Ord POSIXTime
POSIXTime -> POSIXTime -> Bool
POSIXTime -> POSIXTime -> Ordering
POSIXTime -> POSIXTime -> POSIXTime
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: POSIXTime -> POSIXTime -> Ordering
compare :: POSIXTime -> POSIXTime -> Ordering
$c< :: POSIXTime -> POSIXTime -> Bool
< :: POSIXTime -> POSIXTime -> Bool
$c<= :: POSIXTime -> POSIXTime -> Bool
<= :: POSIXTime -> POSIXTime -> Bool
$c> :: POSIXTime -> POSIXTime -> Bool
> :: POSIXTime -> POSIXTime -> Bool
$c>= :: POSIXTime -> POSIXTime -> Bool
>= :: POSIXTime -> POSIXTime -> Bool
$cmax :: POSIXTime -> POSIXTime -> POSIXTime
max :: POSIXTime -> POSIXTime -> POSIXTime
$cmin :: POSIXTime -> POSIXTime -> POSIXTime
min :: POSIXTime -> POSIXTime -> POSIXTime
Haskell.Ord, Int -> POSIXTime -> ShowS
[POSIXTime] -> ShowS
POSIXTime -> String
(Int -> POSIXTime -> ShowS)
-> (POSIXTime -> String)
-> ([POSIXTime] -> ShowS)
-> Show POSIXTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> POSIXTime -> ShowS
showsPrec :: Int -> POSIXTime -> ShowS
$cshow :: POSIXTime -> String
show :: POSIXTime -> String
$cshowList :: [POSIXTime] -> ShowS
showList :: [POSIXTime] -> ShowS
Haskell.Show, (forall x. POSIXTime -> Rep POSIXTime x)
-> (forall x. Rep POSIXTime x -> POSIXTime) -> Generic POSIXTime
forall x. Rep POSIXTime x -> POSIXTime
forall x. POSIXTime -> Rep POSIXTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. POSIXTime -> Rep POSIXTime x
from :: forall x. POSIXTime -> Rep POSIXTime x
$cto :: forall x. Rep POSIXTime x -> POSIXTime
to :: forall x. Rep POSIXTime x -> POSIXTime
Generic, Typeable)
deriving anyclass (POSIXTime -> ()
(POSIXTime -> ()) -> NFData POSIXTime
forall a. (a -> ()) -> NFData a
$crnf :: POSIXTime -> ()
rnf :: POSIXTime -> ()
NFData, DefinitionId
DefinitionId -> HasBlueprintDefinition POSIXTime
forall t. DefinitionId -> HasBlueprintDefinition t
$cdefinitionId :: DefinitionId
definitionId :: DefinitionId
HasBlueprintDefinition)
deriving newtype
( POSIXTime -> POSIXTime -> POSIXTime
(POSIXTime -> POSIXTime -> POSIXTime)
-> AdditiveSemigroup POSIXTime
forall a. (a -> a -> a) -> AdditiveSemigroup a
$c+ :: POSIXTime -> POSIXTime -> POSIXTime
+ :: POSIXTime -> POSIXTime -> POSIXTime
AdditiveSemigroup
, AdditiveSemigroup POSIXTime
POSIXTime
AdditiveSemigroup POSIXTime =>
POSIXTime -> AdditiveMonoid POSIXTime
forall a. AdditiveSemigroup a => a -> AdditiveMonoid a
$czero :: POSIXTime
zero :: POSIXTime
AdditiveMonoid
, AdditiveMonoid POSIXTime
AdditiveMonoid POSIXTime =>
(POSIXTime -> POSIXTime -> POSIXTime) -> AdditiveGroup POSIXTime
POSIXTime -> POSIXTime -> POSIXTime
forall a. AdditiveMonoid a => (a -> a -> a) -> AdditiveGroup a
$c- :: POSIXTime -> POSIXTime -> POSIXTime
- :: POSIXTime -> POSIXTime -> POSIXTime
AdditiveGroup
, POSIXTime -> POSIXTime -> Bool
(POSIXTime -> POSIXTime -> Bool) -> Eq POSIXTime
forall a. (a -> a -> Bool) -> Eq a
$c== :: POSIXTime -> POSIXTime -> Bool
== :: POSIXTime -> POSIXTime -> Bool
Eq
, Eq POSIXTime
Eq POSIXTime =>
(POSIXTime -> POSIXTime -> Ordering)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> Bool)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> Ord POSIXTime
POSIXTime -> POSIXTime -> Bool
POSIXTime -> POSIXTime -> Ordering
POSIXTime -> POSIXTime -> POSIXTime
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: POSIXTime -> POSIXTime -> Ordering
compare :: POSIXTime -> POSIXTime -> Ordering
$c< :: POSIXTime -> POSIXTime -> Bool
< :: POSIXTime -> POSIXTime -> Bool
$c<= :: POSIXTime -> POSIXTime -> Bool
<= :: POSIXTime -> POSIXTime -> Bool
$c> :: POSIXTime -> POSIXTime -> Bool
> :: POSIXTime -> POSIXTime -> Bool
$c>= :: POSIXTime -> POSIXTime -> Bool
>= :: POSIXTime -> POSIXTime -> Bool
$cmax :: POSIXTime -> POSIXTime -> POSIXTime
max :: POSIXTime -> POSIXTime -> POSIXTime
$cmin :: POSIXTime -> POSIXTime -> POSIXTime
min :: POSIXTime -> POSIXTime -> POSIXTime
Ord
, Integer -> POSIXTime
POSIXTime -> Integer
POSIXTime -> POSIXTime
POSIXTime -> POSIXTime -> [POSIXTime]
POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
(POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime)
-> (Integer -> POSIXTime)
-> (POSIXTime -> Integer)
-> (POSIXTime -> POSIXTime -> [POSIXTime])
-> (POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime])
-> Enum POSIXTime
forall a.
(a -> a)
-> (a -> a)
-> (Integer -> a)
-> (a -> Integer)
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: POSIXTime -> POSIXTime
succ :: POSIXTime -> POSIXTime
$cpred :: POSIXTime -> POSIXTime
pred :: POSIXTime -> POSIXTime
$ctoEnum :: Integer -> POSIXTime
toEnum :: Integer -> POSIXTime
$cfromEnum :: POSIXTime -> Integer
fromEnum :: POSIXTime -> Integer
$cenumFromTo :: POSIXTime -> POSIXTime -> [POSIXTime]
enumFromTo :: POSIXTime -> POSIXTime -> [POSIXTime]
$cenumFromThenTo :: POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
enumFromThenTo :: POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
Enum
, POSIXTime -> BuiltinData
(POSIXTime -> BuiltinData) -> ToData POSIXTime
forall a. (a -> BuiltinData) -> ToData a
$ctoBuiltinData :: POSIXTime -> BuiltinData
toBuiltinData :: POSIXTime -> BuiltinData
PlutusTx.ToData
, BuiltinData -> Maybe POSIXTime
(BuiltinData -> Maybe POSIXTime) -> FromData POSIXTime
forall a. (BuiltinData -> Maybe a) -> FromData a
$cfromBuiltinData :: BuiltinData -> Maybe POSIXTime
fromBuiltinData :: BuiltinData -> Maybe POSIXTime
PlutusTx.FromData
, BuiltinData -> POSIXTime
(BuiltinData -> POSIXTime) -> UnsafeFromData POSIXTime
forall a. (BuiltinData -> a) -> UnsafeFromData a
$cunsafeFromBuiltinData :: BuiltinData -> POSIXTime
unsafeFromBuiltinData :: BuiltinData -> POSIXTime
PlutusTx.UnsafeFromData
, Integer -> POSIXTime
POSIXTime -> POSIXTime
POSIXTime -> POSIXTime -> POSIXTime
(POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime)
-> (Integer -> POSIXTime)
-> Num POSIXTime
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: POSIXTime -> POSIXTime -> POSIXTime
+ :: POSIXTime -> POSIXTime -> POSIXTime
$c- :: POSIXTime -> POSIXTime -> POSIXTime
- :: POSIXTime -> POSIXTime -> POSIXTime
$c* :: POSIXTime -> POSIXTime -> POSIXTime
* :: POSIXTime -> POSIXTime -> POSIXTime
$cnegate :: POSIXTime -> POSIXTime
negate :: POSIXTime -> POSIXTime
$cabs :: POSIXTime -> POSIXTime
abs :: POSIXTime -> POSIXTime
$csignum :: POSIXTime -> POSIXTime
signum :: POSIXTime -> POSIXTime
$cfromInteger :: Integer -> POSIXTime
fromInteger :: Integer -> POSIXTime
Haskell.Num
, Int -> POSIXTime
POSIXTime -> Int
POSIXTime -> [POSIXTime]
POSIXTime -> POSIXTime
POSIXTime -> POSIXTime -> [POSIXTime]
POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
(POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime)
-> (Int -> POSIXTime)
-> (POSIXTime -> Int)
-> (POSIXTime -> [POSIXTime])
-> (POSIXTime -> POSIXTime -> [POSIXTime])
-> (POSIXTime -> POSIXTime -> [POSIXTime])
-> (POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime])
-> Enum POSIXTime
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: POSIXTime -> POSIXTime
succ :: POSIXTime -> POSIXTime
$cpred :: POSIXTime -> POSIXTime
pred :: POSIXTime -> POSIXTime
$ctoEnum :: Int -> POSIXTime
toEnum :: Int -> POSIXTime
$cfromEnum :: POSIXTime -> Int
fromEnum :: POSIXTime -> Int
$cenumFrom :: POSIXTime -> [POSIXTime]
enumFrom :: POSIXTime -> [POSIXTime]
$cenumFromThen :: POSIXTime -> POSIXTime -> [POSIXTime]
enumFromThen :: POSIXTime -> POSIXTime -> [POSIXTime]
$cenumFromTo :: POSIXTime -> POSIXTime -> [POSIXTime]
enumFromTo :: POSIXTime -> POSIXTime -> [POSIXTime]
$cenumFromThenTo :: POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
enumFromThenTo :: POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
Haskell.Enum
, Num POSIXTime
Ord POSIXTime
(Num POSIXTime, Ord POSIXTime) =>
(POSIXTime -> Rational) -> Real POSIXTime
POSIXTime -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: POSIXTime -> Rational
toRational :: POSIXTime -> Rational
Haskell.Real
, Enum POSIXTime
Real POSIXTime
(Real POSIXTime, Enum POSIXTime) =>
(POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime))
-> (POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime))
-> (POSIXTime -> Integer)
-> Integral POSIXTime
POSIXTime -> Integer
POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
POSIXTime -> POSIXTime -> POSIXTime
forall a.
(Real a, Enum a) =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
$cquot :: POSIXTime -> POSIXTime -> POSIXTime
quot :: POSIXTime -> POSIXTime -> POSIXTime
$crem :: POSIXTime -> POSIXTime -> POSIXTime
rem :: POSIXTime -> POSIXTime -> POSIXTime
$cdiv :: POSIXTime -> POSIXTime -> POSIXTime
div :: POSIXTime -> POSIXTime -> POSIXTime
$cmod :: POSIXTime -> POSIXTime -> POSIXTime
mod :: POSIXTime -> POSIXTime -> POSIXTime
$cquotRem :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
quotRem :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
$cdivMod :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
divMod :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
$ctoInteger :: POSIXTime -> Integer
toInteger :: POSIXTime -> Integer
Haskell.Integral
)
instance HasBlueprintSchema POSIXTime referencedTypes where
schema :: Schema referencedTypes
schema = SchemaInfo -> IntegerSchema -> Schema referencedTypes
forall (referencedTypes :: [*]).
SchemaInfo -> IntegerSchema -> Schema referencedTypes
SchemaInteger SchemaInfo
emptySchemaInfo{title = Just "POSIXTime"} IntegerSchema
emptyIntegerSchema
instance Pretty POSIXTime where
pretty :: forall ann. POSIXTime -> Doc ann
pretty (POSIXTime Integer
i) = Doc ann
"POSIXTime" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Integer -> Doc ann
forall ann. Integer -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Integer
i
type POSIXTimeRange = Interval POSIXTime
fromMilliSeconds :: DiffMilliSeconds -> POSIXTime
fromMilliSeconds :: DiffMilliSeconds -> POSIXTime
fromMilliSeconds (DiffMilliSeconds Integer
s) = Integer -> POSIXTime
POSIXTime Integer
s
{-# INLINEABLE fromMilliSeconds #-}
$(makeLift ''DiffMilliSeconds)
$(makeLift ''POSIXTime)