| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unwitch.Convert.Double
Description
Conversions from Double.
Synopsis
- toFloat :: Double -> Float
- toFixed :: HasResolution a => Double -> Either RationalErrors (Fixed a)
- toRational :: Double -> Either RationalErrors Rational
- toInteger :: Double -> Either IntegerErrors Integer
- toInt8 :: Double -> Either ViaIntegerErrors Int8
- toInt16 :: Double -> Either ViaIntegerErrors Int16
- toInt32 :: Double -> Either ViaIntegerErrors Int32
- toInt64 :: Double -> Either ViaIntegerErrors Int64
- toInt :: Double -> Either ViaIntegerErrors Int
- toWord8 :: Double -> Either ViaIntegerErrors Word8
- toWord16 :: Double -> Either ViaIntegerErrors Word16
- toWord32 :: Double -> Either ViaIntegerErrors Word32
- toWord64 :: Double -> Either ViaIntegerErrors Word64
- toWord :: Double -> Either ViaIntegerErrors Word
- toNatural :: Double -> Either ViaIntegerErrors Natural
- toCInt :: Double -> Either ViaIntegerErrors CInt
- data ViaIntegerErrors
- data IntegerErrors
- data RationalErrors
Documentation
toFixed :: HasResolution a => Double -> Either RationalErrors (Fixed a) Source #
Converts a Double to a Fixed value. Rejects NaN and infinities.
toInteger :: Double -> Either IntegerErrors Integer Source #
Converts to Integer, fails if NaN, infinite, or has a fractional part.
toInt8 :: Double -> Either ViaIntegerErrors Int8 Source #
Converts via Integer, fails if not a whole number or out of range.
toInt16 :: Double -> Either ViaIntegerErrors Int16 Source #
Converts via Integer, fails if not a whole number or out of range.
toInt32 :: Double -> Either ViaIntegerErrors Int32 Source #
Converts via Integer, fails if not a whole number or out of range.
toInt64 :: Double -> Either ViaIntegerErrors Int64 Source #
Converts via Integer, fails if not a whole number or out of range.
toInt :: Double -> Either ViaIntegerErrors Int Source #
Converts via Integer, fails if not a whole number or out of range.
toWord8 :: Double -> Either ViaIntegerErrors Word8 Source #
Converts via Integer, fails if not a whole number or out of range.
toWord16 :: Double -> Either ViaIntegerErrors Word16 Source #
Converts via Integer, fails if not a whole number or out of range.
toWord32 :: Double -> Either ViaIntegerErrors Word32 Source #
Converts via Integer, fails if not a whole number or out of range.
toWord64 :: Double -> Either ViaIntegerErrors Word64 Source #
Converts via Integer, fails if not a whole number or out of range.
toWord :: Double -> Either ViaIntegerErrors Word Source #
Converts via Integer, fails if not a whole number or out of range.
toNatural :: Double -> Either ViaIntegerErrors Natural Source #
Converts via Integer, fails if not a whole number, out of range, or negative.
toCInt :: Double -> Either ViaIntegerErrors CInt Source #
Converts via Integer, fails if not a whole number or out of range.
data ViaIntegerErrors Source #
Constructors
| MkInteger IntegerErrors | |
| BitConversionFailed Integer |
Instances
| Show ViaIntegerErrors Source # | |
Defined in Unwitch.Convert.Double Methods showsPrec :: Int -> ViaIntegerErrors -> ShowS # show :: ViaIntegerErrors -> String # showList :: [ViaIntegerErrors] -> ShowS # | |
| Eq ViaIntegerErrors Source # | |
Defined in Unwitch.Convert.Double Methods (==) :: ViaIntegerErrors -> ViaIntegerErrors -> Bool # (/=) :: ViaIntegerErrors -> ViaIntegerErrors -> Bool # | |
data IntegerErrors Source #
Instances
| Show IntegerErrors Source # | |
Defined in Unwitch.Convert.Double Methods showsPrec :: Int -> IntegerErrors -> ShowS # show :: IntegerErrors -> String # showList :: [IntegerErrors] -> ShowS # | |
| Eq IntegerErrors Source # | |
Defined in Unwitch.Convert.Double Methods (==) :: IntegerErrors -> IntegerErrors -> Bool # (/=) :: IntegerErrors -> IntegerErrors -> Bool # | |
data RationalErrors Source #
Instances
| Show RationalErrors Source # | |
Defined in Unwitch.Convert.Double Methods showsPrec :: Int -> RationalErrors -> ShowS # show :: RationalErrors -> String # showList :: [RationalErrors] -> ShowS # | |
| Eq RationalErrors Source # | |
Defined in Unwitch.Convert.Double Methods (==) :: RationalErrors -> RationalErrors -> Bool # (/=) :: RationalErrors -> RationalErrors -> Bool # | |