non-negative-0.0.5.1: Non-negative numbersSource codeContentsIndex
Numeric.NonNegative.Wrapper
PortabilityHaskell 98
Stabilitystable
Maintainerhaskell@henning-thielemann.de
Description
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 Numeric.NonNegative.Class.C.
Synopsis
data T a
fromNumber :: (Ord a, Num a) => a -> T a
fromNumberMsg :: (Ord a, Num a) => String -> a -> T a
fromNumberClip :: (Ord a, Num 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 (Ratio a)
type Rational = T Rational
Documentation
data T a Source
fromNumber :: (Ord a, Num a) => a -> T aSource
Convert a number to a non-negative number. If a negative number is given, an error is raised.
fromNumberMsgSource
:: (Ord a, Num a)
=> String
-> a
-> T a
fromNumberClip :: (Ord a, Num a) => a -> T aSource
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 aSource
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.
toNumber :: T a -> aSource
type Int = T IntSource
type Integer = T IntegerSource
type Float = T FloatSource
type Double = T DoubleSource
type Ratio a = T (Ratio a)Source
type Rational = T RationalSource
Produced by Haddock version 2.6.0