plutus-ledger-api-1.60.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusLedgerApi.V1.Data.Interval

Description

A type for intervals and associated functions.

Synopsis

Documentation

data Interval a #

An interval of as.

The interval may be either closed or open at either end, meaning that the endpoints may or may not be included in the interval.

The interval can also be unbounded on either side.

The Eq instance gives equality of the intervals, not structural equality. There is no Enum in order to handle non-inclusive endpoints. For this reason, it may not be safe to use Intervals with non-inclusive endpoints on types whose Enum instances have partial methods.

Instances

Instances details
Ord a, ToData a, UnsafeFromData a) => a -> Interval a -> Bool #

Check whether a value is in an interval.

interval :: (ToData a, UnsafeFromData a) => a -> a -> Interval a #

interval a b includes all values that are greater than or equal to a and smaller than or equal to b. Therefore it includes a and b. In math. notation: [a,b]

from :: (ToData a, UnsafeFromData a) => a -> Interval a #

from a is an Interval that includes all values that are greater than or equal to a. In math. notation: [a,+∞]

to :: (ToData a, UnsafeFromData a) => a -> Interval a #

to a is an Interval that includes all values that are smaller than or equal to a. In math. notation: [-∞,a]

always :: (ToData a, UnsafeFromData a) => Interval a #

An Interval that covers every slot. In math. notation [-∞,+∞]

never :: (ToData a, UnsafeFromData a) => Interval a #

An Interval that is empty. There can be many empty intervals, see isEmpty. The empty interval never is arbitrarily set to [+∞,-∞].

singleton :: (ToData a, UnsafeFromData a) => a -> Interval a #

Create an interval that includes just a single concrete point a, i.e. having the same non-strict lower and upper bounds. In math.notation: [a,a]

hull :: (Ord a, ToData a, UnsafeFromData a) => Interval a -> Interval a -> Interval a #

'intersection a b' is the largest interval that is contained in a and in b, if it exists.

overlaps :: (Ord a, ToData a, UnsafeFromData a) => Interval a -> Interval a -> Bool #

Check whether two intervals overlap, that is, whether there is a value that is a member of both intervals.

contains :: (Ord a, ToData a, UnsafeFromData a) => Interval a -> Interval a -> Bool #

a contains b is true if the Interval b is entirely contained in a. That is, a contains b if for every entry s, if member s b then member s a.

isEmpty :: (Ord a, ToData a, UnsafeFromData a) => a -> Interval a -> Bool #

Check if a value is later than the end of an Interval.

lowerBound :: (ToData a, UnsafeFromData a) => a -> LowerBound a #

Construct a lower bound from a value. The resulting bound includes all values that are equal or greater than the input value.

upperBound :: (ToData a, UnsafeFromData a) => a -> UpperBound a #

Construct an upper bound from a value. The resulting bound includes all values that are equal or smaller than the input value.

strictLowerBound :: (ToData a, UnsafeFromData a) => a -> LowerBound a #

Construct a strict lower bound from a value. The resulting bound includes all values that are (strictly) greater than the input value.

strictUpperBound :: (ToData a, UnsafeFromData a) => a -> UpperBound a #

Construct a strict upper bound from a value. The resulting bound includes all values that are (strictly) smaller than the input value.

mapInterval :: (ToData a1, ToData a2, UnsafeFromData a1, UnsafeFromData a2) => (a1 -> a2) -> Interval a1 -> Interval a2 #