Module

Ctl.Internal.Types.Rational

#Rational

newtype Rational

Rational is a newtype over Ratio with a smart constructor reduce that allows to create a Rational safely. The constructor is not exposed. Rational also enforces the denominator to always be positive.

Instances

#RationalComponent

class RationalComponent (t :: Type)  where

Members

Instances

#(%)

Operator alias for Ctl.Internal.Types.Rational.reduce (left-associative / precedence 7)

#recip

recip :: Rational -> Maybe Rational

Gives the reciprocal of a Rational. Returns Nothing if applied to zero since the reciprocal of zero is mathematically undefined.

#numerator

numerator :: Rational -> BigInt

Get the numerator of a Rational as BigInt.

#denominator

denominator :: Rational -> BigInt

Get the denominator of a Rational as BigInt.

#fromNumber

Modules