hakaru-0.7.0: A probabilistic programming language
CopyrightCopyright (c) 2016 the Hakaru team
LicenseBSD3
Maintainerwren@community.haskell.org
Stabilityexperimental
PortabilityHaskell98 + CPP
Safe HaskellSafe-Inferred
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

Instances details
Enum Natural Source # 
Instance details

Defined in Data.Number.Natural

Eq Natural Source # 
Instance details

Defined in Data.Number.Natural

Methods

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

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

Integral Natural Source # 
Instance details

Defined in Data.Number.Natural

Num Natural Source # 
Instance details

Defined in Data.Number.Natural

Ord Natural Source # 
Instance details

Defined in Data.Number.Natural

Read Natural Source # 
Instance details

Defined in Data.Number.Natural

Real Natural Source # 
Instance details

Defined in Data.Number.Natural

Show Natural Source # 
Instance details

Defined in Data.Number.Natural

Interp 'HNat Natural Source # 
Instance details

Defined in Language.Hakaru.Evaluation.Lazy

Methods

reify :: forall (abt :: [Hakaru] -> Hakaru -> Type). ABT Term abt => Head abt 'HNat -> Natural Source #

reflect :: forall (abt :: [Hakaru] -> Hakaru -> Type). ABT Term abt => Natural -> Head abt 'HNat Source #

Interp 'HProb NonNegativeRational Source # 
Instance details

Defined in Language.Hakaru.Evaluation.Lazy

Methods

reify :: forall (abt :: [Hakaru] -> Hakaru -> Type). ABT Term abt => Head abt 'HProb -> NonNegativeRational Source #

reflect :: forall (abt :: [Hakaru] -> Hakaru -> Type). ABT Term abt => NonNegativeRational -> Head abt 'HProb Source #

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.

newtype MaxNatural Source #

Constructors

MaxNatural 

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.