Copyright | (c) Henning Thielemann 2007 |
---|---|
Maintainer | haskell@henning-thielemann.de |
Stability | stable |
Portability | Haskell 98 |
Safe Haskell | None |
Language | Haskell98 |
A type for non-negative numbers.
It performs a run-time check at construction time (i.e. at run-time)
and is a member of the non-negative number type class
C
.
Synopsis
- data T a
- fromNumber :: (Ord a, C a) => a -> T a
- fromNumberMsg :: (Ord a, C a) => String -> a -> T a
- fromNumberClip :: (Ord a, C a) => a -> T a
- fromNumberUnsafe :: a -> T a
- toNumber :: T a -> a
- type Int = T Int
- type Integer = T Integer
- type Float = T Float
- type Double = T Double
- type Ratio a = T (T a)
- type Rational = T Rational
Documentation
Instances
(Ord a, Num a, Bounded a) => Bounded (T a) | |
(Ord a, Num a, Enum a) => Enum (T a) | |
Eq a => Eq (T a) | |
(Ord a, Floating a) => Floating (T a) | |
(Ord a, Fractional a) => Fractional (T a) | |
Integral a => Integral (T a) | |
(Ord a, Num a) => Num (T a) | |
Ord a => Ord (T a) | |
Real a => Real (T a) | |
Defined in Numeric.NonNegative.Wrapper toRational :: T a -> Rational # | |
RealFrac a => RealFrac (T a) | |
Show a => Show (T a) | |
Num a => Semigroup (T a) | |
Num a => Monoid (T a) | |
(Num a, Arbitrary a) => Arbitrary (T a) | |
(Ord a, Num a) => C (T a) | |
(Ord a, C a) => C (T a) Source # | |
C a => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
C a => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(C a, Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
Defined in Number.NonNegative toRational :: T a -> Rational Source # | |
C a => C (T a) Source # | |
C a => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(C a, C a) => C (T a) Source # | |
fromNumber :: (Ord a, C a) => a -> T a Source #
Convert a number to a non-negative number. If a negative number is given, an error is raised.
fromNumberClip :: (Ord a, C a) => a -> T a Source #
Convert a number to a non-negative number. A negative number will be replaced by zero. Use this function with care since it may hide bugs.
fromNumberUnsafe :: a -> T a #
Wrap a number into a non-negative number without doing checks. This routine exists entirely for efficiency reasons and must be used only in cases where you are absolutely sure, that the input number is non-negative.
Orphan instances
(Ord a, C a) => C (T a) Source # | |
C a => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
C a => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(C a, Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
toRational :: T a -> Rational Source # | |
C a => C (T a) Source # | |
C a => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(Ord a, C a) => C (T a) Source # | |
(C a, C a) => C (T a) Source # | |