Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides the FromRational
typeclass.
Since: 0.1
Synopsis
- class FromRational a where
- afromRational :: HasCallStack => Rational -> a
Documentation
class FromRational a where Source #
Replaces base's fromRational
functionality for when we do not have a
Fractional
instance.
5.5 :: Fractional a => a -- becomes afromRational 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
afromRational :: HasCallStack => Rational -> a Source #
Since: 0.1
Instances
FromRational Double Source # | Since: 0.1 |
Defined in Numeric.Literal.Rational afromRational :: Rational -> Double Source # | |
FromRational Float Source # | Since: 0.1 |
Defined in Numeric.Literal.Rational afromRational :: Rational -> Float Source # | |
RealFloat a => FromRational (Complex a) Source # | Since: 0.1 |
Defined in Numeric.Literal.Rational afromRational :: Rational -> Complex a Source # | |
FromRational (Ratio Integer) Source # | Since: 0.1 |
Defined in Numeric.Literal.Rational | |
FromRational (Ratio Natural) Source # | WARNING: Partial Since: 0.1 |
Defined in Numeric.Literal.Rational |