algebra-simple-0.1: An alternative mathematical interface to Num.
Safe HaskellNone
LanguageHaskell2010

Numeric.Convert.Rational

Description

Provides the FromRational and 'ToRational typeclasses.

Since: 0.1

Synopsis

Documentation

class FromInteger a => FromRational a where Source #

Replaces base's fromRational functionality for when we do not have a Fractional instance.

5.5 :: Fractional a => a

-- becomes

fromQ 5.5 :: FromRational a => a

Note that fromRational's deficiencies are inherited e.g. Natural is partial, bounded types have over/underflow issues.

Since: 0.1

Methods

fromQ :: Rational -> a Source #

Since: 0.1

Instances

Instances details
FromRational Double Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

FromRational Float Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

fromQ :: Rational -> Float Source #

RealFloat a => FromRational (Complex a) Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

fromQ :: Rational -> Complex a Source #

FromRational (Ratio Integer) Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

FromRational (Ratio Natural) Source #

WARNING: Partial

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

fromℚ :: (FromRational a, HasCallStack) => Rational -> a Source #

Unicode alias for fromQ, with U+211A.

Since: 0.1

class ToReal a => ToRational a where Source #

Rational embedding.

Since: 0.1

Methods

toQ :: a -> Rational Source #

Since: 0.1

Instances

Instances details
ToRational Int16 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Int16 -> Rational Source #

ToRational Int32 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Int32 -> Rational Source #

ToRational Int64 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Int64 -> Rational Source #

ToRational Int8 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Int8 -> Rational Source #

ToRational Word16 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Word16 -> Rational Source #

ToRational Word32 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Word32 -> Rational Source #

ToRational Word64 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Word64 -> Rational Source #

ToRational Word8 Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Word8 -> Rational Source #

ToRational Integer Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Integer -> Rational Source #

ToRational Natural Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Natural -> Rational Source #

ToRational Double Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Double -> Rational Source #

ToRational Float Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Float -> Rational Source #

ToRational Int Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Int -> Rational Source #

ToRational Word Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

Methods

toQ :: Word -> Rational Source #

ToRational (Ratio Integer) Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

ToRational (Ratio Natural) Source #

Since: 0.1

Instance details

Defined in Numeric.Convert.Internal

toℚ :: (HasCallStack, ToRational a) => a -> Rational Source #

Unicode alias for toQ, with U+211A.

Since: 0.1