Logo GenPRES

MinMax Module

Creates, validates, combines and formats a range with an optional minimum and an optional maximum, each inclusive or exclusive.

Nested modules

Modules Description

Calculator

Checks with given comparison functions whether a minimum lies above a maximum, and formats a minimum and a maximum in symbols or in Dutch.

Dto

Holds the Dto of a range and converts a range to and from the Dto. Returns None for a Dto with an invalid ValueUnit or an invalid range.

Optics

Holds the getters and setters for the minimum and the maximum of a range. A setter returns the range unchanged when the result is invalid.

Functions and values

Function or value Description

(<=?)

Full Usage: (<=?)

Returns: ValueUnit -> ValueUnit -> bool
Returns: ValueUnit -> ValueUnit -> bool

(

Full Usage: (

Returns: ValueUnit -> ValueUnit -> bool
Returns: ValueUnit -> ValueUnit -> bool

(>=?)

Full Usage: (>=?)

Returns: ValueUnit -> ValueUnit -> bool
Returns: ValueUnit -> ValueUnit -> bool

l >>= r

Full Usage: l >>= r

Parameters:
Returns: ValueUnit
l : ValueUnit
r : Unit
Returns: ValueUnit

(>?)

Full Usage: (>?)

Returns: ValueUnit -> ValueUnit -> bool
Returns: ValueUnit -> ValueUnit -> bool

apply f mm

Full Usage: apply f mm

Parameters:
Returns: MinMax
f : ValueUnit -> ValueUnit
mm : MinMax
Returns: MinMax

calc op mm1 mm2

Full Usage: calc op mm1 mm2

Parameters:
Returns: MinMax

Applies op to the minimums and to the maximums of two ranges. A limit that is missing in either range is missing in the result.

op : Limit -> Limit -> Limit
mm1 : MinMax
mm2 : MinMax
Returns: MinMax

calcLimit op v1 v2

Full Usage: calcLimit op v1 v2

Parameters:
Returns: Limit

Applies op to two limits. The result is inclusive only when both limits are inclusive.

op : ValueUnit -> ValueUnit -> ValueUnit
v1 : Limit
v2 : Limit
Returns: Limit

canMeet a b

Full Usage: canMeet a b

Parameters:
Returns: bool

Checks whether one value can lie in both ranges. An empty range restricts nothing. A range with its minimum above its maximum holds no value, so it meets no range.

a : MinMax
b : MinMax
Returns: bool

convertTo u mm

Full Usage: convertTo u mm

Parameters:
Returns: MinMax

Convert the units of the ValueUnit values in a MinMax mm to unit u.

u : Unit
mm : MinMax
Returns: MinMax

create min max

Full Usage: create min max

Parameters:
Returns: MinMax
min : Limit option
max : Limit option
Returns: MinMax

createExact vu

Full Usage: createExact vu

Parameters:
Returns: MinMax
vu : ValueUnit
Returns: MinMax

createInclIncl min max

Full Usage: createInclIncl min max

Parameters:
Returns: MinMax
min : ValueUnit
max : ValueUnit
Returns: MinMax

empty

Full Usage: empty

Returns: MinMax
Returns: MinMax

foldCond minCond maxCond mms

Full Usage: foldCond minCond maxCond mms

Parameters:
Returns: MinMax

Folds a list of ranges into one range, starting from the empty range. A minimum replaces the current minimum when minCond holds, a maximum the current maximum when maxCond holds. A missing limit leaves the current limit unchanged.

minCond : Limit -> Limit -> bool
maxCond : Limit -> Limit -> bool
mms : MinMax list
Returns: MinMax

foldMaximize

Full Usage: foldMaximize

Returns: MinMax list -> MinMax

Folds a list of ranges into the widest range, with the smallest minimum and the largest maximum.

Returns: MinMax list -> MinMax

foldMinimize

Full Usage: foldMinimize

Returns: MinMax list -> MinMax

Folds a list of ranges into the narrowest range, with the largest minimum and the smallest maximum.

Returns: MinMax list -> MinMax

getUnit mm

Full Usage: getUnit mm

Parameters:
Returns: Unit option
mm : MinMax
Returns: Unit option

inRange v mm

Full Usage: inRange v mm

Parameters:
Returns: bool

Checks whether the value v lies in the range mm. An empty range contains every value.

v : ValueUnit
mm : MinMax
Returns: bool

intersect mm1 mm2

Full Usage: intersect mm1 mm2

Parameters:
Returns: MinMax
mm1 : MinMax
mm2 : MinMax
Returns: MinMax

isEmpty mm

Full Usage: isEmpty mm

Parameters:
Returns: bool
mm : MinMax
Returns: bool

one u

Full Usage: one u

Parameters:
Returns: MinMax

Returns the range from 1 to 1 in unit u, both limits inclusive. It is the neutral value for multiplication and division.

u : Unit
Returns: MinMax

setMax max mm

Full Usage: setMax max mm

Parameters:
Returns: MinMax
max : Limit option
mm : MinMax
Returns: MinMax

setMaxCond cond max mm

Full Usage: setMaxCond cond max mm

Parameters:
Returns: MinMax

Sets the maximum of mm to max when mm has no maximum or when cond max holds for the current maximum. Returns mm unchanged when the new range is invalid.

cond : Limit -> Limit -> bool
max : Limit
mm : MinMax
Returns: MinMax

setMin min mm

Full Usage: setMin min mm

Parameters:
Returns: MinMax
min : Limit option
mm : MinMax
Returns: MinMax

setMinCond cond min mm

Full Usage: setMinCond cond min mm

Parameters:
Returns: MinMax

Sets the minimum of mm to min when mm has no minimum or when cond min holds for the current minimum. Returns mm unchanged when the new range is invalid.

cond : Limit -> Limit -> bool
min : Limit
mm : MinMax
Returns: MinMax

toString vuToStr valToStr minInclStr minExclStr maxInclStr maxExclStr arg7

Full Usage: toString vuToStr valToStr minInclStr minExclStr maxInclStr maxExclStr arg7

Parameters:
    vuToStr : ValueUnit -> string
    valToStr : ValueUnit -> string
    minInclStr : 'a
    minExclStr : 'b
    maxInclStr : 'c
    maxExclStr : 'd
    arg6 : MinMax

Returns: string
Type parameters: 'a, 'b, 'c, 'd

Formats a range. A range with one limit starts with minInclStr, minExclStr, maxInclStr or maxExclStr. A range with two limits shows as min - max, and two equal inclusive limits as one value. An empty range gives an empty string.

vuToStr : ValueUnit -> string
valToStr : ValueUnit -> string
minInclStr : 'a
minExclStr : 'b
maxInclStr : 'c
maxExclStr : 'd
arg6 : MinMax
Returns: string

toTuple mm

Full Usage: toTuple mm

Parameters:
Returns: Limit option * Limit option
mm : MinMax
Returns: Limit option * Limit option

toValueTuple mm

Full Usage: toValueTuple mm

Parameters:
Returns: BigRational option * BigRational option
mm : MinMax
Returns: BigRational option * BigRational option

validate arg1

Full Usage: validate arg1

Parameters:
Returns: Result<MinMax, Msg<Limit, 'a>>
Type parameters: 'a
arg0 : MinMax
Returns: Result<MinMax, Msg<Limit, 'a>>

withUnit u mm

Full Usage: withUnit u mm

Parameters:
Returns: MinMax

Sets the unit of both limits of mm to u without converting the values.

u : Unit
mm : MinMax
Returns: MinMax

Type extensions

Type extension Description

Limit.Exclusive_()

Full Usage: Limit.Exclusive_()

Parameters:
    () : unit

Returns: (Limit -> ValueUnit option) * (ValueUnit -> Limit -> Limit)

Extended Type: Limit

() : unit
Returns: (Limit -> ValueUnit option) * (ValueUnit -> Limit -> Limit)

Limit.Inclusive_()

Full Usage: Limit.Inclusive_()

Parameters:
    () : unit

Returns: (Limit -> ValueUnit option) * (ValueUnit -> Limit -> Limit)

Extended Type: Limit

() : unit
Returns: (Limit -> ValueUnit option) * (ValueUnit -> Limit -> Limit)

Type something to start searching.