hakaru-0.6.0: A probabilistic programming language

CopyrightCopyright (c) 2016 the Hakaru team
LicenseBSD3
Maintainerwren@community.haskell.org
Stabilityexperimental
PortabilityHaskell98 + CPP
Safe HaskellSafe
LanguageHaskell2010

Data.Number.Natural

Description

A data type for natural numbers (aka non-negative integers).

Synopsis

Documentation

data Natural Source #

Natural numbers, with unbounded-width à la Integer. N.B., the Num instance will throw errors on subtraction, negation, and fromInteger when the result is not a natural number.

Instances
Enum Natural Source # 
Instance details
Eq Natural Source # 
Instance details

Methods

(==) :: Natural -> Natural -> Bool #

(/=) :: Natural -> Natural -> Bool #

Integral Natural Source # 
Instance details
Num Natural Source # 
Instance details
Ord Natural Source # 
Instance details
Read Natural Source # 
Instance details
Real Natural Source # 
Instance details
Show Natural Source # 
Instance details
Interp HNat Natural Source # 
Instance details

Methods

reify :: ABT Term abt => Head abt HNat -> Natural Source #

reflect :: ABT Term abt => Natural -> Head abt HNat Source #

Interp HProb NonNegativeRational Source # 
Instance details

fromNatural :: Natural -> Integer Source #

Safely convert a natural number to an integer.

toNatural :: Integer -> Maybe Natural Source #

Safely convert an integer to a natural number. Returns Nothing if the integer is negative.

unsafeNatural :: Integer -> Natural Source #

Unsafely convert an integer to a natural number. Throws an error if the integer is negative.

fromNonNegativeRational :: NonNegativeRational -> Rational Source #

Safely convert a non-negative rational to a rational.

toNonNegativeRational :: Rational -> Maybe NonNegativeRational Source #

Safely convert a rational to a non-negative rational. Returns Nothing if the argument is negative.

unsafeNonNegativeRational :: Rational -> NonNegativeRational Source #

Unsafely convert a rational to a non-negative rational. Throws an error if the argument is negative.