Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Plutarch.Extra.Time
Synopsis
- data PFullyBoundedTimeRange (s :: S) = PFullyBoundedTimeRange (Term s PPOSIXTime) (Term s PPOSIXTime)
- pgetFullyBoundedTimeRange :: forall (s :: S). Term s (PPOSIXTimeRange :--> PMaybe PFullyBoundedTimeRange)
- fullyBoundedTimeRangeFromValidRange :: forall r (s :: S). HasField "validRange" r (Term s PPOSIXTimeRange) => r -> Term s (PMaybe PFullyBoundedTimeRange)
- passertFullyBoundedTimeRange :: forall (s :: S). Term s (PString :--> (PPOSIXTimeRange :--> PFullyBoundedTimeRange))
- pisWithinTimeRange :: forall (s :: S). Term s (PPOSIXTime :--> (PFullyBoundedTimeRange :--> PBool))
- pisTimeRangeWithin :: forall (s :: S). Term s (PPOSIXTime :--> (PPOSIXTime :--> (PFullyBoundedTimeRange :--> PBool)))
- ptimeRangeDuration :: forall (s :: S). Term s (PFullyBoundedTimeRange :--> PPOSIXTime)
Documentation
data PFullyBoundedTimeRange (s :: S) Source #
Represent a fully bounded time range.
Note: PFullyBoundedTimeRange
doesn't need a Haskell-level equivalent
because it is only used in scripts, and does not go in datums. It is also
Scott-encoded.
Since: 3.3.0
Constructors
PFullyBoundedTimeRange | |
Fields
|
Instances
pgetFullyBoundedTimeRange :: forall (s :: S). Term s (PPOSIXTimeRange :--> PMaybe PFullyBoundedTimeRange) Source #
Get the current time, given a PPOSIXTimeRange
.
If it's impossible to get a full-bounded time (for example, either end of
the PPOSIXTimeRange
is an infinity), then we return PNothing
.
Since: 3.3.0
fullyBoundedTimeRangeFromValidRange :: forall r (s :: S). HasField "validRange" r (Term s PPOSIXTimeRange) => r -> Term s (PMaybe PFullyBoundedTimeRange) Source #
Calculate the current time by providing the validRange
field,
which typically comes from PTxInfo
.
Since: 3.3.0
passertFullyBoundedTimeRange :: forall (s :: S). Term s (PString :--> (PPOSIXTimeRange :--> PFullyBoundedTimeRange)) Source #
Calculate the current time, and error out with the given message if we can't get it.
Since: 3.3.0
pisWithinTimeRange :: forall (s :: S). Term s (PPOSIXTime :--> (PFullyBoundedTimeRange :--> PBool)) Source #
Retutn PTrue
if a PPOSIXTime
is in the current time range.
Since: 3.3.0
pisTimeRangeWithin :: forall (s :: S). Term s (PPOSIXTime :--> (PPOSIXTime :--> (PFullyBoundedTimeRange :--> PBool))) Source #
Return PTrue
if current time is within the given time range.
Note that the first argument is the lower bound of said time range, and the second is the upper bound.
Since: 3.3.0
ptimeRangeDuration :: forall (s :: S). Term s (PFullyBoundedTimeRange :--> PPOSIXTime) Source #
Return the duration of current time.
Since: 3.14.1