convertible-1.1.1.1: Typeclasses and instances for converting between types
CopyrightCopyright (C) 2009-2011 John Goerzen
LicenseBSD3
MaintainerJohn Goerzen <jgoerzen@complete.org>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Convertible.Instances.Num

Description

Numeric instances for Convertible.

Copyright (C) 2009-2011 John Goerzen jgoerzen@complete.org

All rights reserved.

For license and copyright information, see the file LICENSE

These instances perform conversion between numeric types such as Double, Int, Integer, Rational, and the like. Here are some notes about the conversion process:

Conversions from floating-point types such as Double to integral types are done via the truncate function. This is a somewhat arbitrary decision; if you need different behavior, you will have to write your own instance or manually perform the conversion.

All conversions perform bounds checking. If a value is too large for its destination type, you will get a ConvertError informing you of this. Note that this behavior differs from functions in the Haskell standard libraries, which will perform the conversion without error, but give you garbage in the end.

Conversions do not perform precision checking; loss of precision is implied with certain conversions (for instance, Double to Float) and this is not an error.

Orphan instances

Convertible Char Int Source # 
Instance details

Convertible Char Int8 Source # 
Instance details

Convertible Char Int16 Source # 
Instance details

Convertible Char Int32 Source # 
Instance details

Convertible Char Int64 Source # 
Instance details

Convertible Char Integer Source # 
Instance details

Convertible Char Word Source # 
Instance details

Convertible Char Word8 Source # 
Instance details

Convertible Char Word16 Source # 
Instance details

Convertible Char Word32 Source # 
Instance details

Convertible Char Word64 Source # 
Instance details

Convertible Double Float Source # 
Instance details

Convertible Double Int Source # 
Instance details

Convertible Double Int8 Source # 
Instance details

Convertible Double Int16 Source # 
Instance details

Convertible Double Int32 Source # 
Instance details

Convertible Double Int64 Source # 
Instance details

Convertible Double Integer Source # 
Instance details

Convertible Double Rational Source # 
Instance details

Convertible Double Word Source # 
Instance details

Convertible Double Word8 Source # 
Instance details

Convertible Double Word16 Source # 
Instance details

Convertible Double Word32 Source # 
Instance details

Convertible Double Word64 Source # 
Instance details

Convertible Float Double Source # 
Instance details

Convertible Float Int Source # 
Instance details

Convertible Float Int8 Source # 
Instance details

Convertible Float Int16 Source # 
Instance details

Convertible Float Int32 Source # 
Instance details

Convertible Float Int64 Source # 
Instance details

Convertible Float Integer Source # 
Instance details

Convertible Float Rational Source # 
Instance details

Convertible Float Word Source # 
Instance details

Convertible Float Word8 Source # 
Instance details

Convertible Float Word16 Source # 
Instance details

Convertible Float Word32 Source # 
Instance details

Convertible Float Word64 Source # 
Instance details

Convertible Int Char Source # 
Instance details

Convertible Int Double Source # 
Instance details

Convertible Int Float Source # 
Instance details

Convertible Int Int8 Source # 
Instance details

Convertible Int Int16 Source # 
Instance details

Convertible Int Int32 Source # 
Instance details

Convertible Int Int64 Source # 
Instance details

Convertible Int Integer Source # 
Instance details

Convertible Int Rational Source # 
Instance details

Convertible Int Word Source # 
Instance details

Convertible Int Word8 Source # 
Instance details

Convertible Int Word16 Source # 
Instance details

Convertible Int Word32 Source # 
Instance details

Convertible Int Word64 Source # 
Instance details

Convertible Int8 Char Source # 
Instance details

Convertible Int8 Double Source # 
Instance details

Convertible Int8 Float Source # 
Instance details

Convertible Int8 Int Source # 
Instance details

Convertible Int8 Int16 Source # 
Instance details

Convertible Int8 Int32 Source # 
Instance details

Convertible Int8 Int64 Source # 
Instance details

Convertible Int8 Integer Source # 
Instance details

Convertible Int8 Rational Source # 
Instance details

Convertible Int8 Word Source # 
Instance details

Convertible Int8 Word8 Source # 
Instance details

Convertible Int8 Word16 Source # 
Instance details

Convertible Int8 Word32 Source # 
Instance details

Convertible Int8 Word64 Source # 
Instance details

Convertible Int16 Char Source # 
Instance details

Convertible Int16 Double Source # 
Instance details

Convertible Int16 Float Source # 
Instance details

Convertible Int16 Int Source # 
Instance details

Convertible Int16 Int8 Source # 
Instance details

Convertible Int16 Int32 Source # 
Instance details

Convertible Int16 Int64 Source # 
Instance details

Convertible Int16 Integer Source # 
Instance details

Convertible Int16 Rational Source # 
Instance details

Convertible Int16 Word Source # 
Instance details

Convertible Int16 Word8 Source # 
Instance details

Convertible Int16 Word16 Source # 
Instance details

Convertible Int16 Word32 Source # 
Instance details

Convertible Int16 Word64 Source # 
Instance details

Convertible Int32 Char Source # 
Instance details

Convertible Int32 Double Source # 
Instance details

Convertible Int32 Float Source # 
Instance details

Convertible Int32 Int Source # 
Instance details

Convertible Int32 Int8 Source # 
Instance details

Convertible Int32 Int16 Source # 
Instance details

Convertible Int32 Int64 Source # 
Instance details

Convertible Int32 Integer Source # 
Instance details

Convertible Int32 Rational Source # 
Instance details

Convertible Int32 Word Source # 
Instance details

Convertible Int32 Word8 Source # 
Instance details

Convertible Int32 Word16 Source # 
Instance details

Convertible Int32 Word32 Source # 
Instance details

Convertible Int32 Word64 Source # 
Instance details

Convertible Int64 Char Source # 
Instance details

Convertible Int64 Double Source # 
Instance details

Convertible Int64 Float Source # 
Instance details

Convertible Int64 Int Source # 
Instance details

Convertible Int64 Int8 Source # 
Instance details

Convertible Int64 Int16 Source # 
Instance details

Convertible Int64 Int32 Source # 
Instance details

Convertible Int64 Integer Source # 
Instance details

Convertible Int64 Rational Source # 
Instance details

Convertible Int64 Word Source # 
Instance details

Convertible Int64 Word8 Source # 
Instance details

Convertible Int64 Word16 Source # 
Instance details

Convertible Int64 Word32 Source # 
Instance details

Convertible Int64 Word64 Source # 
Instance details

Convertible Integer Char Source # 
Instance details

Convertible Integer Double Source # 
Instance details

Convertible Integer Float Source # 
Instance details

Convertible Integer Int Source # 
Instance details

Convertible Integer Int8 Source # 
Instance details

Convertible Integer Int16 Source # 
Instance details

Convertible Integer Int32 Source # 
Instance details

Convertible Integer Int64 Source # 
Instance details

Convertible Integer Integer Source # 
Instance details

Convertible Integer Rational Source # 
Instance details

Convertible Integer Word Source # 
Instance details

Convertible Integer Word8 Source # 
Instance details

Convertible Integer Word16 Source # 
Instance details

Convertible Integer Word32 Source # 
Instance details

Convertible Integer Word64 Source # 
Instance details

Convertible Rational Double Source # 
Instance details

Convertible Rational Float Source # 
Instance details

Convertible Rational Int Source # 
Instance details

Convertible Rational Int8 Source # 
Instance details

Convertible Rational Int16 Source # 
Instance details

Convertible Rational Int32 Source # 
Instance details

Convertible Rational Int64 Source # 
Instance details

Convertible Rational Integer Source # 
Instance details

Convertible Rational Word Source # 
Instance details

Convertible Rational Word8 Source # 
Instance details

Convertible Rational Word16 Source # 
Instance details

Convertible Rational Word32 Source # 
Instance details

Convertible Rational Word64 Source # 
Instance details

Convertible Word Char Source # 
Instance details

Convertible Word Double Source # 
Instance details

Convertible Word Float Source # 
Instance details

Convertible Word Int Source # 
Instance details

Convertible Word Int8 Source # 
Instance details

Convertible Word Int16 Source # 
Instance details

Convertible Word Int32 Source # 
Instance details

Convertible Word Int64 Source # 
Instance details

Convertible Word Integer Source # 
Instance details

Convertible Word Rational Source # 
Instance details

Convertible Word Word8 Source # 
Instance details

Convertible Word Word16 Source # 
Instance details

Convertible Word Word32 Source # 
Instance details

Convertible Word Word64 Source # 
Instance details

Convertible Word8 Char Source # 
Instance details

Convertible Word8 Double Source # 
Instance details

Convertible Word8 Float Source # 
Instance details

Convertible Word8 Int Source # 
Instance details

Convertible Word8 Int8 Source # 
Instance details

Convertible Word8 Int16 Source # 
Instance details

Convertible Word8 Int32 Source # 
Instance details

Convertible Word8 Int64 Source # 
Instance details

Convertible Word8 Integer Source # 
Instance details

Convertible Word8 Rational Source # 
Instance details

Convertible Word8 Word Source # 
Instance details

Convertible Word8 Word16 Source # 
Instance details

Convertible Word8 Word32 Source # 
Instance details

Convertible Word8 Word64 Source # 
Instance details

Convertible Word16 Char Source # 
Instance details

Convertible Word16 Double Source # 
Instance details

Convertible Word16 Float Source # 
Instance details

Convertible Word16 Int Source # 
Instance details

Convertible Word16 Int8 Source # 
Instance details

Convertible Word16 Int16 Source # 
Instance details

Convertible Word16 Int32 Source # 
Instance details

Convertible Word16 Int64 Source # 
Instance details

Convertible Word16 Integer Source # 
Instance details

Convertible Word16 Rational Source # 
Instance details

Convertible Word16 Word Source # 
Instance details

Convertible Word16 Word8 Source # 
Instance details

Convertible Word16 Word32 Source # 
Instance details

Convertible Word16 Word64 Source # 
Instance details

Convertible Word32 Char Source # 
Instance details

Convertible Word32 Double Source # 
Instance details

Convertible Word32 Float Source # 
Instance details

Convertible Word32 Int Source # 
Instance details

Convertible Word32 Int8 Source # 
Instance details

Convertible Word32 Int16 Source # 
Instance details

Convertible Word32 Int32 Source # 
Instance details

Convertible Word32 Int64 Source # 
Instance details

Convertible Word32 Integer Source # 
Instance details

Convertible Word32 Rational Source # 
Instance details

Convertible Word32 Word Source # 
Instance details

Convertible Word32 Word8 Source # 
Instance details

Convertible Word32 Word16 Source # 
Instance details

Convertible Word32 Word64 Source # 
Instance details

Convertible Word64 Char Source # 
Instance details

Convertible Word64 Double Source # 
Instance details

Convertible Word64 Float Source # 
Instance details

Convertible Word64 Int Source # 
Instance details

Convertible Word64 Int8 Source # 
Instance details

Convertible Word64 Int16 Source # 
Instance details

Convertible Word64 Int32 Source # 
Instance details

Convertible Word64 Int64 Source # 
Instance details

Convertible Word64 Integer Source # 
Instance details

Convertible Word64 Rational Source # 
Instance details

Convertible Word64 Word Source # 
Instance details

Convertible Word64 Word8 Source # 
Instance details

Convertible Word64 Word16 Source # 
Instance details

Convertible Word64 Word32 Source # 
Instance details