Copyright | (c) Sam Stites 2017 |
---|---|
License | BSD3 |
Maintainer | sam@stites.io |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
ADTs to manage runtime boundaries
Synopsis
- data OpenUnit x
- openUnit :: (Ord x, Num x) => x -> Maybe (OpenUnit x)
- openUnitValue :: OpenUnit x -> x
- data ClosedUnit x
- closedUnit :: (Ord x, Num x) => x -> Maybe (ClosedUnit x)
- closedUnitValue :: ClosedUnit x -> x
- data Ord2Tuple x
- ord2Tuple :: (Ord x, Num x) => (x, x) -> Maybe (Ord2Tuple x)
- ord2TupleValue :: Ord2Tuple x -> (x, x)
- data Positive x
- positive :: (Ord x, Num x) => x -> Maybe (Positive x)
- positiveValue :: Positive x -> x
- data NonZero x
- nonZero :: (Ord x, Num x) => x -> Maybe (NonZero x)
- nonZeroValue :: NonZero x -> x
Documentation
Datatype to represent the open unit interval: 0 < x < 1
. Any OpenUnit
inhabitant
must satisfy being in the interval.
FIXME: replace with numhask.
Instances
Eq x => Eq (OpenUnit x) Source # | |
Ord x => Ord (OpenUnit x) Source # | |
Show x => Show (OpenUnit x) Source # | |
openUnit :: (Ord x, Num x) => x -> Maybe (OpenUnit x) Source #
smart constructor to place a number in the open unit interval.
openUnitValue :: OpenUnit x -> x Source #
Get a value from the open unit interval.
data ClosedUnit x Source #
Datatype to represent the closed unit interval: 0 =< x =< 1
. Any ClosedUnit
inhabitant must satisfy being in the interval.
FIXME: replace with numhask.
Instances
Eq x => Eq (ClosedUnit x) Source # | |
Defined in Torch.Types.Numeric (==) :: ClosedUnit x -> ClosedUnit x -> Bool # (/=) :: ClosedUnit x -> ClosedUnit x -> Bool # | |
Ord x => Ord (ClosedUnit x) Source # | |
Defined in Torch.Types.Numeric compare :: ClosedUnit x -> ClosedUnit x -> Ordering # (<) :: ClosedUnit x -> ClosedUnit x -> Bool # (<=) :: ClosedUnit x -> ClosedUnit x -> Bool # (>) :: ClosedUnit x -> ClosedUnit x -> Bool # (>=) :: ClosedUnit x -> ClosedUnit x -> Bool # max :: ClosedUnit x -> ClosedUnit x -> ClosedUnit x # min :: ClosedUnit x -> ClosedUnit x -> ClosedUnit x # | |
Show x => Show (ClosedUnit x) Source # | |
Defined in Torch.Types.Numeric showsPrec :: Int -> ClosedUnit x -> ShowS # show :: ClosedUnit x -> String # showList :: [ClosedUnit x] -> ShowS # |
closedUnit :: (Ord x, Num x) => x -> Maybe (ClosedUnit x) Source #
smart constructor to place a number in the closed unit interval.
closedUnitValue :: ClosedUnit x -> x Source #
Get a value from the closed unit interval.
Datatype to represent an ordered pair of numbers, (a, b)
, where a <= b
.
FIXME: replace with numhask.
ord2Tuple :: (Ord x, Num x) => (x, x) -> Maybe (Ord2Tuple x) Source #
smart constructor to place two values in an ordered tuple.
ord2TupleValue :: Ord2Tuple x -> (x, x) Source #
Get the values of an ordered tuple.
Datatype to represent a generic positive number: 0 =< x
.
FIXME: replace with numhask.
Instances
Eq x => Eq (Positive x) Source # | |
Ord x => Ord (Positive x) Source # | |
Show x => Show (Positive x) Source # | |
positive :: (Ord x, Num x) => x -> Maybe (Positive x) Source #
smart constructor to place a number in a positive bound.
positiveValue :: Positive x -> x Source #
Get a value from the positive bound.
Datatype to represent a number that is not zero: 0 /= x
.
FIXME: replace with numhask.
nonZero :: (Ord x, Num x) => x -> Maybe (NonZero x) Source #
smart constructor to place a number in a positive bound.
nonZeroValue :: NonZero x -> x Source #
Get a value from the positive bound.