{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-identities #-}
{-# OPTIONS_GHC -fno-ignore-interface-pragmas #-}
{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}
module Plutus.V1.Ledger.Time(
POSIXTime(..)
, POSIXTimeRange
, DiffMilliSeconds(..)
, fromMilliSeconds
) where
import Control.DeepSeq (NFData)
import GHC.Generics (Generic)
import Plutus.V1.Ledger.Interval
import PlutusTx qualified
import PlutusTx.Lift (makeLift)
import PlutusTx.Prelude
import Prelude qualified as Haskell
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
/= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c/= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
== :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c== :: 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
min :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmin :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
max :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmax :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
>= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$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
compare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
$ccompare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
$cp1Ord :: Eq 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
showList :: [DiffMilliSeconds] -> ShowS
$cshowList :: [DiffMilliSeconds] -> ShowS
show :: DiffMilliSeconds -> String
$cshow :: DiffMilliSeconds -> String
showsPrec :: Int -> DiffMilliSeconds -> ShowS
$cshowsPrec :: Int -> 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
$cto :: forall x. Rep DiffMilliSeconds x -> DiffMilliSeconds
$cfrom :: forall x. DiffMilliSeconds -> Rep DiffMilliSeconds x
Generic)
deriving anyclass (DiffMilliSeconds -> ()
(DiffMilliSeconds -> ()) -> NFData DiffMilliSeconds
forall a. (a -> ()) -> NFData a
rnf :: DiffMilliSeconds -> ()
$crnf :: DiffMilliSeconds -> ()
NFData)
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
fromInteger :: Integer -> DiffMilliSeconds
$cfromInteger :: Integer -> DiffMilliSeconds
signum :: DiffMilliSeconds -> DiffMilliSeconds
$csignum :: DiffMilliSeconds -> DiffMilliSeconds
abs :: DiffMilliSeconds -> DiffMilliSeconds
$cabs :: DiffMilliSeconds -> DiffMilliSeconds
negate :: DiffMilliSeconds -> DiffMilliSeconds
$cnegate :: DiffMilliSeconds -> DiffMilliSeconds
* :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c* :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
Haskell.Num, DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
(DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> AdditiveSemigroup DiffMilliSeconds
forall a. (a -> a -> a) -> AdditiveSemigroup a
+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c+ :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
AdditiveSemigroup, AdditiveSemigroup DiffMilliSeconds
DiffMilliSeconds
AdditiveSemigroup DiffMilliSeconds
-> DiffMilliSeconds -> AdditiveMonoid DiffMilliSeconds
forall a. AdditiveSemigroup a -> a -> AdditiveMonoid a
zero :: DiffMilliSeconds
$czero :: DiffMilliSeconds
$cp1AdditiveMonoid :: AdditiveSemigroup DiffMilliSeconds
AdditiveMonoid, AdditiveMonoid DiffMilliSeconds
AdditiveMonoid DiffMilliSeconds
-> (DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds)
-> AdditiveGroup DiffMilliSeconds
DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
forall a. AdditiveMonoid a -> (a -> a -> a) -> AdditiveGroup a
- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$c- :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cp1AdditiveGroup :: AdditiveMonoid 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
enumFromThenTo :: DiffMilliSeconds
-> DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFromThenTo :: DiffMilliSeconds
-> DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
enumFromTo :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFromTo :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
enumFromThen :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFromThen :: DiffMilliSeconds -> DiffMilliSeconds -> [DiffMilliSeconds]
enumFrom :: DiffMilliSeconds -> [DiffMilliSeconds]
$cenumFrom :: DiffMilliSeconds -> [DiffMilliSeconds]
fromEnum :: DiffMilliSeconds -> Int
$cfromEnum :: DiffMilliSeconds -> Int
toEnum :: Int -> DiffMilliSeconds
$ctoEnum :: Int -> DiffMilliSeconds
pred :: DiffMilliSeconds -> DiffMilliSeconds
$cpred :: DiffMilliSeconds -> DiffMilliSeconds
succ :: DiffMilliSeconds -> DiffMilliSeconds
$csucc :: DiffMilliSeconds -> DiffMilliSeconds
Haskell.Enum, DiffMilliSeconds -> DiffMilliSeconds -> Bool
(DiffMilliSeconds -> DiffMilliSeconds -> Bool)
-> Eq DiffMilliSeconds
forall a. (a -> a -> Bool) -> Eq a
== :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$c== :: 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
min :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmin :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
max :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmax :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
>= :: DiffMilliSeconds -> DiffMilliSeconds -> Bool
$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
compare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
$ccompare :: DiffMilliSeconds -> DiffMilliSeconds -> Ordering
$cp1Ord :: Eq 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
toRational :: DiffMilliSeconds -> Rational
$ctoRational :: DiffMilliSeconds -> Rational
$cp2Real :: Ord DiffMilliSeconds
$cp1Real :: Num DiffMilliSeconds
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
toInteger :: DiffMilliSeconds -> Integer
$ctoInteger :: DiffMilliSeconds -> Integer
divMod :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
$cdivMod :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
quotRem :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
$cquotRem :: DiffMilliSeconds
-> DiffMilliSeconds -> (DiffMilliSeconds, DiffMilliSeconds)
mod :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cmod :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
div :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cdiv :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
rem :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$crem :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
quot :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cquot :: DiffMilliSeconds -> DiffMilliSeconds -> DiffMilliSeconds
$cp2Integral :: Enum DiffMilliSeconds
$cp1Integral :: Real DiffMilliSeconds
Haskell.Integral, DiffMilliSeconds -> BuiltinData
(DiffMilliSeconds -> BuiltinData) -> ToData DiffMilliSeconds
forall a. (a -> BuiltinData) -> ToData a
toBuiltinData :: DiffMilliSeconds -> BuiltinData
$ctoBuiltinData :: DiffMilliSeconds -> BuiltinData
PlutusTx.ToData, BuiltinData -> Maybe DiffMilliSeconds
(BuiltinData -> Maybe DiffMilliSeconds)
-> FromData DiffMilliSeconds
forall a. (BuiltinData -> Maybe a) -> FromData a
fromBuiltinData :: BuiltinData -> Maybe DiffMilliSeconds
$cfromBuiltinData :: BuiltinData -> Maybe DiffMilliSeconds
PlutusTx.FromData, BuiltinData -> DiffMilliSeconds
(BuiltinData -> DiffMilliSeconds)
-> UnsafeFromData DiffMilliSeconds
forall a. (BuiltinData -> a) -> UnsafeFromData a
unsafeFromBuiltinData :: BuiltinData -> DiffMilliSeconds
$cunsafeFromBuiltinData :: BuiltinData -> DiffMilliSeconds
PlutusTx.UnsafeFromData)
makeLift ''DiffMilliSeconds
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
/= :: POSIXTime -> POSIXTime -> Bool
$c/= :: POSIXTime -> POSIXTime -> Bool
== :: POSIXTime -> POSIXTime -> Bool
$c== :: 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
min :: POSIXTime -> POSIXTime -> POSIXTime
$cmin :: POSIXTime -> POSIXTime -> POSIXTime
max :: POSIXTime -> POSIXTime -> POSIXTime
$cmax :: POSIXTime -> POSIXTime -> POSIXTime
>= :: POSIXTime -> POSIXTime -> Bool
$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
compare :: POSIXTime -> POSIXTime -> Ordering
$ccompare :: POSIXTime -> POSIXTime -> Ordering
$cp1Ord :: Eq 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
showList :: [POSIXTime] -> ShowS
$cshowList :: [POSIXTime] -> ShowS
show :: POSIXTime -> String
$cshow :: POSIXTime -> String
showsPrec :: Int -> POSIXTime -> ShowS
$cshowsPrec :: Int -> 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
$cto :: forall x. Rep POSIXTime x -> POSIXTime
$cfrom :: forall x. POSIXTime -> Rep POSIXTime x
Generic)
deriving anyclass (POSIXTime -> ()
(POSIXTime -> ()) -> NFData POSIXTime
forall a. (a -> ()) -> NFData a
rnf :: POSIXTime -> ()
$crnf :: POSIXTime -> ()
NFData)
deriving newtype (POSIXTime -> POSIXTime -> POSIXTime
(POSIXTime -> POSIXTime -> POSIXTime)
-> AdditiveSemigroup POSIXTime
forall a. (a -> a -> a) -> AdditiveSemigroup a
+ :: POSIXTime -> POSIXTime -> POSIXTime
$c+ :: POSIXTime -> POSIXTime -> POSIXTime
AdditiveSemigroup, AdditiveSemigroup POSIXTime
POSIXTime
AdditiveSemigroup POSIXTime
-> POSIXTime -> AdditiveMonoid POSIXTime
forall a. AdditiveSemigroup a -> a -> AdditiveMonoid a
zero :: POSIXTime
$czero :: POSIXTime
$cp1AdditiveMonoid :: AdditiveSemigroup POSIXTime
AdditiveMonoid, AdditiveMonoid POSIXTime
AdditiveMonoid POSIXTime
-> (POSIXTime -> POSIXTime -> POSIXTime) -> AdditiveGroup POSIXTime
POSIXTime -> POSIXTime -> POSIXTime
forall a. AdditiveMonoid a -> (a -> a -> a) -> AdditiveGroup a
- :: POSIXTime -> POSIXTime -> POSIXTime
$c- :: POSIXTime -> POSIXTime -> POSIXTime
$cp1AdditiveGroup :: AdditiveMonoid POSIXTime
AdditiveGroup, POSIXTime -> POSIXTime -> Bool
(POSIXTime -> POSIXTime -> Bool) -> Eq POSIXTime
forall a. (a -> a -> Bool) -> Eq a
== :: POSIXTime -> POSIXTime -> Bool
$c== :: 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
min :: POSIXTime -> POSIXTime -> POSIXTime
$cmin :: POSIXTime -> POSIXTime -> POSIXTime
max :: POSIXTime -> POSIXTime -> POSIXTime
$cmax :: POSIXTime -> POSIXTime -> POSIXTime
>= :: POSIXTime -> POSIXTime -> Bool
$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
compare :: POSIXTime -> POSIXTime -> Ordering
$ccompare :: POSIXTime -> POSIXTime -> Ordering
$cp1Ord :: Eq POSIXTime
Ord, Integer -> POSIXTime
POSIXTime -> Integer
POSIXTime -> POSIXTime
(POSIXTime -> POSIXTime)
-> (POSIXTime -> POSIXTime)
-> (Integer -> POSIXTime)
-> (POSIXTime -> Integer)
-> Enum POSIXTime
forall a.
(a -> a) -> (a -> a) -> (Integer -> a) -> (a -> Integer) -> Enum a
fromEnum :: POSIXTime -> Integer
$cfromEnum :: POSIXTime -> Integer
toEnum :: Integer -> POSIXTime
$ctoEnum :: Integer -> POSIXTime
pred :: POSIXTime -> POSIXTime
$cpred :: POSIXTime -> POSIXTime
succ :: POSIXTime -> POSIXTime
$csucc :: POSIXTime -> POSIXTime
Enum, POSIXTime -> BuiltinData
(POSIXTime -> BuiltinData) -> ToData POSIXTime
forall a. (a -> BuiltinData) -> ToData a
toBuiltinData :: POSIXTime -> BuiltinData
$ctoBuiltinData :: POSIXTime -> BuiltinData
PlutusTx.ToData, BuiltinData -> Maybe POSIXTime
(BuiltinData -> Maybe POSIXTime) -> FromData POSIXTime
forall a. (BuiltinData -> Maybe a) -> FromData a
fromBuiltinData :: BuiltinData -> Maybe POSIXTime
$cfromBuiltinData :: BuiltinData -> Maybe POSIXTime
PlutusTx.FromData, BuiltinData -> POSIXTime
(BuiltinData -> POSIXTime) -> UnsafeFromData POSIXTime
forall a. (BuiltinData -> a) -> UnsafeFromData a
unsafeFromBuiltinData :: BuiltinData -> POSIXTime
$cunsafeFromBuiltinData :: BuiltinData -> POSIXTime
PlutusTx.UnsafeFromData)
deriving newtype (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
fromInteger :: Integer -> POSIXTime
$cfromInteger :: Integer -> POSIXTime
signum :: POSIXTime -> POSIXTime
$csignum :: POSIXTime -> POSIXTime
abs :: POSIXTime -> POSIXTime
$cabs :: POSIXTime -> POSIXTime
negate :: POSIXTime -> POSIXTime
$cnegate :: POSIXTime -> POSIXTime
* :: POSIXTime -> POSIXTime -> POSIXTime
$c* :: POSIXTime -> POSIXTime -> POSIXTime
- :: POSIXTime -> POSIXTime -> POSIXTime
$c- :: POSIXTime -> POSIXTime -> POSIXTime
+ :: POSIXTime -> POSIXTime -> POSIXTime
$c+ :: POSIXTime -> POSIXTime -> 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
enumFromThenTo :: POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
$cenumFromThenTo :: POSIXTime -> POSIXTime -> POSIXTime -> [POSIXTime]
enumFromTo :: POSIXTime -> POSIXTime -> [POSIXTime]
$cenumFromTo :: POSIXTime -> POSIXTime -> [POSIXTime]
enumFromThen :: POSIXTime -> POSIXTime -> [POSIXTime]
$cenumFromThen :: POSIXTime -> POSIXTime -> [POSIXTime]
enumFrom :: POSIXTime -> [POSIXTime]
$cenumFrom :: POSIXTime -> [POSIXTime]
fromEnum :: POSIXTime -> Int
$cfromEnum :: POSIXTime -> Int
toEnum :: Int -> POSIXTime
$ctoEnum :: Int -> POSIXTime
pred :: POSIXTime -> POSIXTime
$cpred :: POSIXTime -> POSIXTime
succ :: POSIXTime -> POSIXTime
$csucc :: 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
toRational :: POSIXTime -> Rational
$ctoRational :: POSIXTime -> Rational
$cp2Real :: Ord POSIXTime
$cp1Real :: Num POSIXTime
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
toInteger :: POSIXTime -> Integer
$ctoInteger :: POSIXTime -> Integer
divMod :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
$cdivMod :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
quotRem :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
$cquotRem :: POSIXTime -> POSIXTime -> (POSIXTime, POSIXTime)
mod :: POSIXTime -> POSIXTime -> POSIXTime
$cmod :: POSIXTime -> POSIXTime -> POSIXTime
div :: POSIXTime -> POSIXTime -> POSIXTime
$cdiv :: POSIXTime -> POSIXTime -> POSIXTime
rem :: POSIXTime -> POSIXTime -> POSIXTime
$crem :: POSIXTime -> POSIXTime -> POSIXTime
quot :: POSIXTime -> POSIXTime -> POSIXTime
$cquot :: POSIXTime -> POSIXTime -> POSIXTime
$cp2Integral :: Enum POSIXTime
$cp1Integral :: Real POSIXTime
Haskell.Integral)
makeLift ''POSIXTime
instance Pretty POSIXTime where
pretty :: 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 a ann. Pretty a => a -> Doc ann
pretty Integer
i
type POSIXTimeRange = Interval POSIXTime
{-# INLINABLE fromMilliSeconds #-}
fromMilliSeconds :: DiffMilliSeconds -> POSIXTime
fromMilliSeconds :: DiffMilliSeconds -> POSIXTime
fromMilliSeconds (DiffMilliSeconds Integer
s) = Integer -> POSIXTime
POSIXTime Integer
s