numeric-prelude-0.4.3: An experimental alternative hierarchy of numeric type classes

Copyright(c) Henning Thielemann 2007
Maintainerhaskell@henning-thielemann.de
Stabilitystable
PortabilityHaskell 98
Safe HaskellNone
LanguageHaskell98

Number.NonNegative

Contents

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 C.

Synopsis

Documentation

data T a :: * -> * #

Instances

(Ord a, Num a, Bounded a) => Bounded (T a) 

Methods

minBound :: T a #

maxBound :: T a #

(Ord a, Num a, Enum a) => Enum (T a) 

Methods

succ :: T a -> T a #

pred :: T a -> T a #

toEnum :: Int -> T a #

fromEnum :: T a -> Int #

enumFrom :: T a -> [T a] #

enumFromThen :: T a -> T a -> [T a] #

enumFromTo :: T a -> T a -> [T a] #

enumFromThenTo :: T a -> T a -> T a -> [T a] #

Eq a => Eq (T a) 

Methods

(==) :: T a -> T a -> Bool #

(/=) :: T a -> T a -> Bool #

(Ord a, Floating a) => Floating (T a) 

Methods

pi :: T a #

exp :: T a -> T a #

log :: T a -> T a #

sqrt :: T a -> T a #

(**) :: T a -> T a -> T a #

logBase :: T a -> T a -> T a #

sin :: T a -> T a #

cos :: T a -> T a #

tan :: T a -> T a #

asin :: T a -> T a #

acos :: T a -> T a #

atan :: T a -> T a #

sinh :: T a -> T a #

cosh :: T a -> T a #

tanh :: T a -> T a #

asinh :: T a -> T a #

acosh :: T a -> T a #

atanh :: T a -> T a #

log1p :: T a -> T a #

expm1 :: T a -> T a #

log1pexp :: T a -> T a #

log1mexp :: T a -> T a #

(Ord a, Fractional a) => Fractional (T a) 

Methods

(/) :: T a -> T a -> T a #

recip :: T a -> T a #

fromRational :: Rational -> T a #

Integral a => Integral (T a) 

Methods

quot :: T a -> T a -> T a #

rem :: T a -> T a -> T a #

div :: T a -> T a -> T a #

mod :: T a -> T a -> T a #

quotRem :: T a -> T a -> (T a, T a) #

divMod :: T a -> T a -> (T a, T a) #

toInteger :: T a -> Integer #

(Ord a, Num a) => Num (T a) 

Methods

(+) :: T a -> T a -> T a #

(-) :: T a -> T a -> T a #

(*) :: T a -> T a -> T a #

negate :: T a -> T a #

abs :: T a -> T a #

signum :: T a -> T a #

fromInteger :: Integer -> T a #

Ord a => Ord (T a) 

Methods

compare :: T a -> T a -> Ordering #

(<) :: T a -> T a -> Bool #

(<=) :: T a -> T a -> Bool #

(>) :: T a -> T a -> Bool #

(>=) :: T a -> T a -> Bool #

max :: T a -> T a -> T a #

min :: T a -> T a -> T a #

Real a => Real (T a) 

Methods

toRational :: T a -> Rational #

RealFrac a => RealFrac (T a) 

Methods

properFraction :: Integral b => T a -> (b, T a) #

truncate :: Integral b => T a -> b #

round :: Integral b => T a -> b #

ceiling :: Integral b => T a -> b #

floor :: Integral b => T a -> b #

Show a => Show (T a) 

Methods

showsPrec :: Int -> T a -> ShowS #

show :: T a -> String #

showList :: [T a] -> ShowS #

Num a => Semigroup (T a) 

Methods

(<>) :: T a -> T a -> T a #

sconcat :: NonEmpty (T a) -> T a #

stimes :: Integral b => b -> T a -> T a #

Num a => Monoid (T a) 

Methods

mempty :: T a #

mappend :: T a -> T a -> T a #

mconcat :: [T a] -> T a #

(Num a, Arbitrary a) => Arbitrary (T a) 

Methods

arbitrary :: Gen (T a) #

shrink :: T a -> [T a] #

(Ord a, Num a) => C (T a) 

Methods

split :: T a -> T a -> (T a, (Bool, T a)) #

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.

fromNumberMsg Source #

Arguments

:: (Ord a, C a) 
=> String

name of the calling function to be used in the error message

-> a 
-> T a 

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.

toNumber :: T a -> a #

type Int = T Int #

type Float = T Float #

type Double = T Double #

type Ratio a = T (T a) Source #

Orphan instances

(Ord a, C a) => C (T a) Source # 

Methods

zero :: T a Source #

(+) :: T a -> T a -> T a Source #

(-) :: T a -> T a -> T a Source #

negate :: T a -> T a Source #

C a => C (T a) Source # 

Methods

isZero :: T a -> Bool Source #

(Ord a, C a) => C (T a) Source # 

Methods

(*) :: T a -> T a -> T a Source #

one :: T a Source #

fromInteger :: Integer -> T a Source #

(^) :: T a -> Integer -> T a Source #

C a => C (T a) Source # 

Methods

idt :: T a Source #

(<*>) :: T a -> T a -> T a Source #

cumulate :: [T a] -> T a Source #

(Ord a, C a) => C (T a) Source # 

Methods

split :: T a -> T a -> (T a, (Bool, T a)) Source #

(Ord a, C a) => C (T a) Source # 

Methods

div :: T a -> T a -> T a Source #

mod :: T a -> T a -> T a Source #

divMod :: T a -> T a -> (T a, T a) Source #

(C a, Ord a, C a) => C (T a) Source # 

Methods

abs :: T a -> T a Source #

signum :: T a -> T a Source #

(Ord a, C a) => C (T a) Source # 

Methods

(/) :: T a -> T a -> T a Source #

recip :: T a -> T a Source #

fromRational' :: Rational -> T a Source #

(^-) :: T a -> Integer -> T a Source #

(Ord a, C a) => C (T a) Source # 

Methods

toRational :: T a -> Rational Source #

C a => C (T a) Source # 

Methods

quot :: T a -> T a -> T a Source #

rem :: T a -> T a -> T a Source #

quotRem :: T a -> T a -> (T a, T a) Source #

C a => C (T a) Source # 

Methods

toInteger :: T a -> Integer Source #

(Ord a, C a) => C (T a) Source # 

Methods

sqrt :: T a -> T a Source #

root :: Integer -> T a -> T a Source #

(^/) :: T a -> Rational -> T a Source #

(Ord a, C a) => C (T a) Source # 

Methods

pi :: T a Source #

exp :: T a -> T a Source #

log :: T a -> T a Source #

logBase :: T a -> T a -> T a Source #

(**) :: T a -> T a -> T a Source #

sin :: T a -> T a Source #

cos :: T a -> T a Source #

tan :: T a -> T a Source #

asin :: T a -> T a Source #

acos :: T a -> T a Source #

atan :: T a -> T a Source #

sinh :: T a -> T a Source #

cosh :: T a -> T a Source #

tanh :: T a -> T a Source #

asinh :: T a -> T a Source #

acosh :: T a -> T a Source #

atanh :: T a -> T a Source #

(C a, C a) => C (T a) Source # 

Methods

splitFraction :: C b => T a -> (b, T a) Source #

fraction :: T a -> T a Source #

ceiling :: C b => T a -> b Source #

floor :: C b => T a -> b Source #

truncate :: C b => T a -> b Source #

round :: C b => T a -> b Source #