aiken_design_patterns/validity_range_normalization
The datatype that models validity range in Cardano currently allows for values that are either meaningless, or can have more than one representations. For example, since the values are integers, the inclusive flag for each end is redundant and can be omitted in favor of a predefined convention (e.g. a value should always be considered inclusive).
In this module we present a custom datatype that essentially reduces the value domain of the original validity range to a smaller one that eliminates meaningless instances and redundancies.
Types
Datatype for eliminating meaningless ranges, without the redundant inclusiveness flag (instead all range values are inclusive).
Constructors
-
ClosedRange { lower: Int, upper: Int }
-
FromNegInf { upper: Int }
-
ToPosInf { lower: Int }
-
Always