module Data.Convertible.Instances.Num()
where
import Data.Convertible.Base
import Data.Convertible.Utils
import Data.Int
import Data.Word
instance Convertible Double Int where
safeConvert :: Double -> ConvertResult Int
safeConvert = (Double -> ConvertResult Int) -> Double -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Double -> Int) -> Double -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Int
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int Double where
safeConvert :: Int -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Int -> Double) -> Int -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Int8 where
safeConvert :: Double -> ConvertResult Int8
safeConvert = (Double -> ConvertResult Int8) -> Double -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Double -> Int8) -> Double -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Int8
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int8 Double where
safeConvert :: Int8 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Int8 -> Double) -> Int8 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Int16 where
safeConvert :: Double -> ConvertResult Int16
safeConvert = (Double -> ConvertResult Int16) -> Double -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Double -> Int16) -> Double -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Int16
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int16 Double where
safeConvert :: Int16 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Int16 -> Double) -> Int16 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Int32 where
safeConvert :: Double -> ConvertResult Int32
safeConvert = (Double -> ConvertResult Int32) -> Double -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Double -> Int32) -> Double -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Int32
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int32 Double where
safeConvert :: Int32 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Int32 -> Double) -> Int32 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Int64 where
safeConvert :: Double -> ConvertResult Int64
safeConvert = (Double -> ConvertResult Int64) -> Double -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Double -> Int64) -> Double -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Int64
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int64 Double where
safeConvert :: Int64 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Int64 -> Double) -> Int64 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Word where
safeConvert :: Double -> ConvertResult Word
safeConvert = (Double -> ConvertResult Word) -> Double -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Double -> Word) -> Double -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Word
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word Double where
safeConvert :: Word -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Word -> Double) -> Word -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Word8 where
safeConvert :: Double -> ConvertResult Word8
safeConvert = (Double -> ConvertResult Word8) -> Double -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Double -> Word8) -> Double -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Word8
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word8 Double where
safeConvert :: Word8 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Word8 -> Double) -> Word8 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Word16 where
safeConvert :: Double -> ConvertResult Word16
safeConvert = (Double -> ConvertResult Word16) -> Double -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Double -> Word16) -> Double -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Word16
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word16 Double where
safeConvert :: Word16 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Word16 -> Double) -> Word16 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Word32 where
safeConvert :: Double -> ConvertResult Word32
safeConvert = (Double -> ConvertResult Word32) -> Double -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Double -> Word32) -> Double -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Word32
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word32 Double where
safeConvert :: Word32 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Word32 -> Double) -> Word32 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Word64 where
safeConvert :: Double -> ConvertResult Word64
safeConvert = (Double -> ConvertResult Word64) -> Double -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Double -> Word64) -> Double -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Word64
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word64 Double where
safeConvert :: Word64 -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Word64 -> Double) -> Word64 -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Int where
safeConvert :: Float -> ConvertResult Int
safeConvert = (Float -> ConvertResult Int) -> Float -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Float -> Int) -> Float -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Int
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int Float where
safeConvert :: Int -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Int -> Float) -> Int -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Int8 where
safeConvert :: Float -> ConvertResult Int8
safeConvert = (Float -> ConvertResult Int8) -> Float -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Float -> Int8) -> Float -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Int8
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int8 Float where
safeConvert :: Int8 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Int8 -> Float) -> Int8 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Int16 where
safeConvert :: Float -> ConvertResult Int16
safeConvert = (Float -> ConvertResult Int16) -> Float -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Float -> Int16) -> Float -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Int16
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int16 Float where
safeConvert :: Int16 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Int16 -> Float) -> Int16 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Int32 where
safeConvert :: Float -> ConvertResult Int32
safeConvert = (Float -> ConvertResult Int32) -> Float -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Float -> Int32) -> Float -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Int32
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int32 Float where
safeConvert :: Int32 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Int32 -> Float) -> Int32 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Int64 where
safeConvert :: Float -> ConvertResult Int64
safeConvert = (Float -> ConvertResult Int64) -> Float -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Float -> Int64) -> Float -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Int64
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int64 Float where
safeConvert :: Int64 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Int64 -> Float) -> Int64 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Word where
safeConvert :: Float -> ConvertResult Word
safeConvert = (Float -> ConvertResult Word) -> Float -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Float -> Word) -> Float -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Word
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word Float where
safeConvert :: Word -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Word -> Float) -> Word -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Word8 where
safeConvert :: Float -> ConvertResult Word8
safeConvert = (Float -> ConvertResult Word8) -> Float -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Float -> Word8) -> Float -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Word8
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word8 Float where
safeConvert :: Word8 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Word8 -> Float) -> Word8 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Word16 where
safeConvert :: Float -> ConvertResult Word16
safeConvert = (Float -> ConvertResult Word16) -> Float -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Float -> Word16) -> Float -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Word16
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word16 Float where
safeConvert :: Word16 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Word16 -> Float) -> Word16 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Word32 where
safeConvert :: Float -> ConvertResult Word32
safeConvert = (Float -> ConvertResult Word32) -> Float -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Float -> Word32) -> Float -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Word32
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word32 Float where
safeConvert :: Word32 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Word32 -> Float) -> Word32 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Float Word64 where
safeConvert :: Float -> ConvertResult Word64
safeConvert = (Float -> ConvertResult Word64) -> Float -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Float -> Word64) -> Float -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Word64
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word64 Float where
safeConvert :: Word64 -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Word64 -> Float) -> Word64 -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Int where
safeConvert :: Rational -> ConvertResult Int
safeConvert = (Rational -> ConvertResult Int) -> Rational -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Rational -> Int) -> Rational -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Int
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int Rational where
safeConvert :: Int -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Int -> Rational) -> Int -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Int8 where
safeConvert :: Rational -> ConvertResult Int8
safeConvert = (Rational -> ConvertResult Int8) -> Rational -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Rational -> Int8) -> Rational -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Int8
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int8 Rational where
safeConvert :: Int8 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Int8 -> Rational) -> Int8 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Int16 where
safeConvert :: Rational -> ConvertResult Int16
safeConvert = (Rational -> ConvertResult Int16)
-> Rational -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Rational -> Int16) -> Rational -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Int16
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int16 Rational where
safeConvert :: Int16 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Int16 -> Rational) -> Int16 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Int32 where
safeConvert :: Rational -> ConvertResult Int32
safeConvert = (Rational -> ConvertResult Int32)
-> Rational -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Rational -> Int32) -> Rational -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Int32
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int32 Rational where
safeConvert :: Int32 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Int32 -> Rational) -> Int32 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Int64 where
safeConvert :: Rational -> ConvertResult Int64
safeConvert = (Rational -> ConvertResult Int64)
-> Rational -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Rational -> Int64) -> Rational -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Int64
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Int64 Rational where
safeConvert :: Int64 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Int64 -> Rational) -> Int64 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Word where
safeConvert :: Rational -> ConvertResult Word
safeConvert = (Rational -> ConvertResult Word) -> Rational -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Rational -> Word) -> Rational -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Word
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word Rational where
safeConvert :: Word -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Word -> Rational) -> Word -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Word8 where
safeConvert :: Rational -> ConvertResult Word8
safeConvert = (Rational -> ConvertResult Word8)
-> Rational -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Rational -> Word8) -> Rational -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Word8
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word8 Rational where
safeConvert :: Word8 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Word8 -> Rational) -> Word8 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Word16 where
safeConvert :: Rational -> ConvertResult Word16
safeConvert = (Rational -> ConvertResult Word16)
-> Rational -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Rational -> Word16) -> Rational -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Word16
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word16 Rational where
safeConvert :: Word16 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Word16 -> Rational) -> Word16 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Word32 where
safeConvert :: Rational -> ConvertResult Word32
safeConvert = (Rational -> ConvertResult Word32)
-> Rational -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Rational -> Word32) -> Rational -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Word32
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word32 Rational where
safeConvert :: Word32 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Word32 -> Rational) -> Word32 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Rational Word64 where
safeConvert :: Rational -> ConvertResult Word64
safeConvert = (Rational -> ConvertResult Word64)
-> Rational -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Rational -> Word64) -> Rational -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Word64
forall a b. (RealFrac a, Integral b) => a -> b
truncate)
instance Convertible Word64 Rational where
safeConvert :: Word64 -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Word64 -> Rational) -> Word64 -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Int Int8 where
safeConvert :: Int -> ConvertResult Int8
safeConvert = (Int -> ConvertResult Int8) -> Int -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Int -> Int8) -> Int -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Int16 where
safeConvert :: Int -> ConvertResult Int16
safeConvert = (Int -> ConvertResult Int16) -> Int -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Int -> Int16) -> Int -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Int32 where
safeConvert :: Int -> ConvertResult Int32
safeConvert = (Int -> ConvertResult Int32) -> Int -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Int -> Int32) -> Int -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Int64 where
safeConvert :: Int -> ConvertResult Int64
safeConvert = (Int -> ConvertResult Int64) -> Int -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Int -> Int64) -> Int -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Word where
safeConvert :: Int -> ConvertResult Word
safeConvert = (Int -> ConvertResult Word) -> Int -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Int -> Word) -> Int -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Word8 where
safeConvert :: Int -> ConvertResult Word8
safeConvert = (Int -> ConvertResult Word8) -> Int -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Int -> Word8) -> Int -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Word16 where
safeConvert :: Int -> ConvertResult Word16
safeConvert = (Int -> ConvertResult Word16) -> Int -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Int -> Word16) -> Int -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Word32 where
safeConvert :: Int -> ConvertResult Word32
safeConvert = (Int -> ConvertResult Word32) -> Int -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Int -> Word32) -> Int -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Word64 where
safeConvert :: Int -> ConvertResult Word64
safeConvert = (Int -> ConvertResult Word64) -> Int -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Int -> Word64) -> Int -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Int where
safeConvert :: Int8 -> ConvertResult Int
safeConvert = (Int8 -> ConvertResult Int) -> Int8 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Int8 -> Int) -> Int8 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Int16 where
safeConvert :: Int8 -> ConvertResult Int16
safeConvert = (Int8 -> ConvertResult Int16) -> Int8 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Int8 -> Int16) -> Int8 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Int32 where
safeConvert :: Int8 -> ConvertResult Int32
safeConvert = (Int8 -> ConvertResult Int32) -> Int8 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Int8 -> Int32) -> Int8 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Int64 where
safeConvert :: Int8 -> ConvertResult Int64
safeConvert = (Int8 -> ConvertResult Int64) -> Int8 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Int8 -> Int64) -> Int8 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Word where
safeConvert :: Int8 -> ConvertResult Word
safeConvert = (Int8 -> ConvertResult Word) -> Int8 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Int8 -> Word) -> Int8 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Word8 where
safeConvert :: Int8 -> ConvertResult Word8
safeConvert = (Int8 -> ConvertResult Word8) -> Int8 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Int8 -> Word8) -> Int8 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Word16 where
safeConvert :: Int8 -> ConvertResult Word16
safeConvert = (Int8 -> ConvertResult Word16) -> Int8 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Int8 -> Word16) -> Int8 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Word32 where
safeConvert :: Int8 -> ConvertResult Word32
safeConvert = (Int8 -> ConvertResult Word32) -> Int8 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Int8 -> Word32) -> Int8 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Word64 where
safeConvert :: Int8 -> ConvertResult Word64
safeConvert = (Int8 -> ConvertResult Word64) -> Int8 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Int8 -> Word64) -> Int8 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Int where
safeConvert :: Int16 -> ConvertResult Int
safeConvert = (Int16 -> ConvertResult Int) -> Int16 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Int16 -> Int) -> Int16 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Int8 where
safeConvert :: Int16 -> ConvertResult Int8
safeConvert = (Int16 -> ConvertResult Int8) -> Int16 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Int16 -> Int8) -> Int16 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Int32 where
safeConvert :: Int16 -> ConvertResult Int32
safeConvert = (Int16 -> ConvertResult Int32) -> Int16 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Int16 -> Int32) -> Int16 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Int64 where
safeConvert :: Int16 -> ConvertResult Int64
safeConvert = (Int16 -> ConvertResult Int64) -> Int16 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Int16 -> Int64) -> Int16 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Word where
safeConvert :: Int16 -> ConvertResult Word
safeConvert = (Int16 -> ConvertResult Word) -> Int16 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Int16 -> Word) -> Int16 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Word8 where
safeConvert :: Int16 -> ConvertResult Word8
safeConvert = (Int16 -> ConvertResult Word8) -> Int16 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Int16 -> Word8) -> Int16 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Word16 where
safeConvert :: Int16 -> ConvertResult Word16
safeConvert = (Int16 -> ConvertResult Word16) -> Int16 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Int16 -> Word16) -> Int16 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Word32 where
safeConvert :: Int16 -> ConvertResult Word32
safeConvert = (Int16 -> ConvertResult Word32) -> Int16 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Int16 -> Word32) -> Int16 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Word64 where
safeConvert :: Int16 -> ConvertResult Word64
safeConvert = (Int16 -> ConvertResult Word64) -> Int16 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Int16 -> Word64) -> Int16 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Int where
safeConvert :: Int32 -> ConvertResult Int
safeConvert = (Int32 -> ConvertResult Int) -> Int32 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Int32 -> Int) -> Int32 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Int8 where
safeConvert :: Int32 -> ConvertResult Int8
safeConvert = (Int32 -> ConvertResult Int8) -> Int32 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Int32 -> Int8) -> Int32 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Int16 where
safeConvert :: Int32 -> ConvertResult Int16
safeConvert = (Int32 -> ConvertResult Int16) -> Int32 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Int32 -> Int16) -> Int32 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Int64 where
safeConvert :: Int32 -> ConvertResult Int64
safeConvert = (Int32 -> ConvertResult Int64) -> Int32 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Int32 -> Int64) -> Int32 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Word where
safeConvert :: Int32 -> ConvertResult Word
safeConvert = (Int32 -> ConvertResult Word) -> Int32 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Int32 -> Word) -> Int32 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Word8 where
safeConvert :: Int32 -> ConvertResult Word8
safeConvert = (Int32 -> ConvertResult Word8) -> Int32 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Int32 -> Word8) -> Int32 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Word16 where
safeConvert :: Int32 -> ConvertResult Word16
safeConvert = (Int32 -> ConvertResult Word16) -> Int32 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Int32 -> Word16) -> Int32 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Word32 where
safeConvert :: Int32 -> ConvertResult Word32
safeConvert = (Int32 -> ConvertResult Word32) -> Int32 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Int32 -> Word32) -> Int32 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Word64 where
safeConvert :: Int32 -> ConvertResult Word64
safeConvert = (Int32 -> ConvertResult Word64) -> Int32 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Int32 -> Word64) -> Int32 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Int where
safeConvert :: Int64 -> ConvertResult Int
safeConvert = (Int64 -> ConvertResult Int) -> Int64 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Int64 -> Int) -> Int64 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Int8 where
safeConvert :: Int64 -> ConvertResult Int8
safeConvert = (Int64 -> ConvertResult Int8) -> Int64 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Int64 -> Int8) -> Int64 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Int16 where
safeConvert :: Int64 -> ConvertResult Int16
safeConvert = (Int64 -> ConvertResult Int16) -> Int64 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Int64 -> Int16) -> Int64 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Int32 where
safeConvert :: Int64 -> ConvertResult Int32
safeConvert = (Int64 -> ConvertResult Int32) -> Int64 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Int64 -> Int32) -> Int64 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Word where
safeConvert :: Int64 -> ConvertResult Word
safeConvert = (Int64 -> ConvertResult Word) -> Int64 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Int64 -> Word) -> Int64 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Word8 where
safeConvert :: Int64 -> ConvertResult Word8
safeConvert = (Int64 -> ConvertResult Word8) -> Int64 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Int64 -> Word8) -> Int64 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Word16 where
safeConvert :: Int64 -> ConvertResult Word16
safeConvert = (Int64 -> ConvertResult Word16) -> Int64 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Int64 -> Word16) -> Int64 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Word32 where
safeConvert :: Int64 -> ConvertResult Word32
safeConvert = (Int64 -> ConvertResult Word32) -> Int64 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Int64 -> Word32) -> Int64 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Word64 where
safeConvert :: Int64 -> ConvertResult Word64
safeConvert = (Int64 -> ConvertResult Word64) -> Int64 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Int64 -> Word64) -> Int64 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Int where
safeConvert :: Word -> ConvertResult Int
safeConvert = (Word -> ConvertResult Int) -> Word -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Word -> Int) -> Word -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Int8 where
safeConvert :: Word -> ConvertResult Int8
safeConvert = (Word -> ConvertResult Int8) -> Word -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Word -> Int8) -> Word -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Int16 where
safeConvert :: Word -> ConvertResult Int16
safeConvert = (Word -> ConvertResult Int16) -> Word -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Word -> Int16) -> Word -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Int32 where
safeConvert :: Word -> ConvertResult Int32
safeConvert = (Word -> ConvertResult Int32) -> Word -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Word -> Int32) -> Word -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Int64 where
safeConvert :: Word -> ConvertResult Int64
safeConvert = (Word -> ConvertResult Int64) -> Word -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Word -> Int64) -> Word -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Word8 where
safeConvert :: Word -> ConvertResult Word8
safeConvert = (Word -> ConvertResult Word8) -> Word -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Word -> Word8) -> Word -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Word16 where
safeConvert :: Word -> ConvertResult Word16
safeConvert = (Word -> ConvertResult Word16) -> Word -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Word -> Word16) -> Word -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Word32 where
safeConvert :: Word -> ConvertResult Word32
safeConvert = (Word -> ConvertResult Word32) -> Word -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Word -> Word32) -> Word -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Word64 where
safeConvert :: Word -> ConvertResult Word64
safeConvert = (Word -> ConvertResult Word64) -> Word -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Word -> Word64) -> Word -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Int where
safeConvert :: Word8 -> ConvertResult Int
safeConvert = (Word8 -> ConvertResult Int) -> Word8 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Word8 -> Int) -> Word8 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Int8 where
safeConvert :: Word8 -> ConvertResult Int8
safeConvert = (Word8 -> ConvertResult Int8) -> Word8 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Word8 -> Int8) -> Word8 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Int16 where
safeConvert :: Word8 -> ConvertResult Int16
safeConvert = (Word8 -> ConvertResult Int16) -> Word8 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Word8 -> Int16) -> Word8 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Int32 where
safeConvert :: Word8 -> ConvertResult Int32
safeConvert = (Word8 -> ConvertResult Int32) -> Word8 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Word8 -> Int32) -> Word8 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Int64 where
safeConvert :: Word8 -> ConvertResult Int64
safeConvert = (Word8 -> ConvertResult Int64) -> Word8 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Word8 -> Int64) -> Word8 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Word where
safeConvert :: Word8 -> ConvertResult Word
safeConvert = (Word8 -> ConvertResult Word) -> Word8 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Word8 -> Word) -> Word8 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Word16 where
safeConvert :: Word8 -> ConvertResult Word16
safeConvert = (Word8 -> ConvertResult Word16) -> Word8 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Word8 -> Word16) -> Word8 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Word32 where
safeConvert :: Word8 -> ConvertResult Word32
safeConvert = (Word8 -> ConvertResult Word32) -> Word8 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Word8 -> Word32) -> Word8 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Word64 where
safeConvert :: Word8 -> ConvertResult Word64
safeConvert = (Word8 -> ConvertResult Word64) -> Word8 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Word8 -> Word64) -> Word8 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Int where
safeConvert :: Word16 -> ConvertResult Int
safeConvert = (Word16 -> ConvertResult Int) -> Word16 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Word16 -> Int) -> Word16 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Int8 where
safeConvert :: Word16 -> ConvertResult Int8
safeConvert = (Word16 -> ConvertResult Int8) -> Word16 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Word16 -> Int8) -> Word16 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Int16 where
safeConvert :: Word16 -> ConvertResult Int16
safeConvert = (Word16 -> ConvertResult Int16) -> Word16 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Word16 -> Int16) -> Word16 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Int32 where
safeConvert :: Word16 -> ConvertResult Int32
safeConvert = (Word16 -> ConvertResult Int32) -> Word16 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Word16 -> Int32) -> Word16 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Int64 where
safeConvert :: Word16 -> ConvertResult Int64
safeConvert = (Word16 -> ConvertResult Int64) -> Word16 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Word16 -> Int64) -> Word16 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Word where
safeConvert :: Word16 -> ConvertResult Word
safeConvert = (Word16 -> ConvertResult Word) -> Word16 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Word16 -> Word) -> Word16 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Word8 where
safeConvert :: Word16 -> ConvertResult Word8
safeConvert = (Word16 -> ConvertResult Word8) -> Word16 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Word16 -> Word8) -> Word16 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Word32 where
safeConvert :: Word16 -> ConvertResult Word32
safeConvert = (Word16 -> ConvertResult Word32) -> Word16 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Word16 -> Word32) -> Word16 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Word64 where
safeConvert :: Word16 -> ConvertResult Word64
safeConvert = (Word16 -> ConvertResult Word64) -> Word16 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Word16 -> Word64) -> Word16 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Int where
safeConvert :: Word32 -> ConvertResult Int
safeConvert = (Word32 -> ConvertResult Int) -> Word32 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Word32 -> Int) -> Word32 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Int8 where
safeConvert :: Word32 -> ConvertResult Int8
safeConvert = (Word32 -> ConvertResult Int8) -> Word32 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Word32 -> Int8) -> Word32 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Int16 where
safeConvert :: Word32 -> ConvertResult Int16
safeConvert = (Word32 -> ConvertResult Int16) -> Word32 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Word32 -> Int16) -> Word32 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Int32 where
safeConvert :: Word32 -> ConvertResult Int32
safeConvert = (Word32 -> ConvertResult Int32) -> Word32 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Word32 -> Int32) -> Word32 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Int64 where
safeConvert :: Word32 -> ConvertResult Int64
safeConvert = (Word32 -> ConvertResult Int64) -> Word32 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Word32 -> Int64) -> Word32 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Word where
safeConvert :: Word32 -> ConvertResult Word
safeConvert = (Word32 -> ConvertResult Word) -> Word32 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Word32 -> Word) -> Word32 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Word8 where
safeConvert :: Word32 -> ConvertResult Word8
safeConvert = (Word32 -> ConvertResult Word8) -> Word32 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Word32 -> Word8) -> Word32 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Word16 where
safeConvert :: Word32 -> ConvertResult Word16
safeConvert = (Word32 -> ConvertResult Word16) -> Word32 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Word32 -> Word16) -> Word32 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Word64 where
safeConvert :: Word32 -> ConvertResult Word64
safeConvert = (Word32 -> ConvertResult Word64) -> Word32 -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Word32 -> Word64) -> Word32 -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Int where
safeConvert :: Word64 -> ConvertResult Int
safeConvert = (Word64 -> ConvertResult Int) -> Word64 -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Word64 -> Int) -> Word64 -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Int8 where
safeConvert :: Word64 -> ConvertResult Int8
safeConvert = (Word64 -> ConvertResult Int8) -> Word64 -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Word64 -> Int8) -> Word64 -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Int16 where
safeConvert :: Word64 -> ConvertResult Int16
safeConvert = (Word64 -> ConvertResult Int16) -> Word64 -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Word64 -> Int16) -> Word64 -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Int32 where
safeConvert :: Word64 -> ConvertResult Int32
safeConvert = (Word64 -> ConvertResult Int32) -> Word64 -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Word64 -> Int32) -> Word64 -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Int64 where
safeConvert :: Word64 -> ConvertResult Int64
safeConvert = (Word64 -> ConvertResult Int64) -> Word64 -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Word64 -> Int64) -> Word64 -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Word where
safeConvert :: Word64 -> ConvertResult Word
safeConvert = (Word64 -> ConvertResult Word) -> Word64 -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Word64 -> Word) -> Word64 -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Word8 where
safeConvert :: Word64 -> ConvertResult Word8
safeConvert = (Word64 -> ConvertResult Word8) -> Word64 -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Word64 -> Word8) -> Word64 -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Word16 where
safeConvert :: Word64 -> ConvertResult Word16
safeConvert = (Word64 -> ConvertResult Word16) -> Word64 -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Word64 -> Word16) -> Word64 -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Word32 where
safeConvert :: Word64 -> ConvertResult Word32
safeConvert = (Word64 -> ConvertResult Word32) -> Word64 -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Word64 -> Word32) -> Word64 -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Integer Int where
safeConvert :: Integer -> ConvertResult Int
safeConvert = (Integer -> ConvertResult Int) -> Integer -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Integer -> Int) -> Integer -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int Integer where
safeConvert :: Int -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Int -> Integer) -> Int -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Int8 where
safeConvert :: Integer -> ConvertResult Int8
safeConvert = (Integer -> ConvertResult Int8) -> Integer -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Integer -> Int8) -> Integer -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int8 Integer where
safeConvert :: Int8 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Int8 -> Integer) -> Int8 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Int16 where
safeConvert :: Integer -> ConvertResult Int16
safeConvert = (Integer -> ConvertResult Int16) -> Integer -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Integer -> Int16) -> Integer -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int16 Integer where
safeConvert :: Int16 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Int16 -> Integer) -> Int16 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Int32 where
safeConvert :: Integer -> ConvertResult Int32
safeConvert = (Integer -> ConvertResult Int32) -> Integer -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Integer -> Int32) -> Integer -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int32 Integer where
safeConvert :: Int32 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Int32 -> Integer) -> Int32 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Int64 where
safeConvert :: Integer -> ConvertResult Int64
safeConvert = (Integer -> ConvertResult Int64) -> Integer -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Integer -> Int64) -> Integer -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Int64 Integer where
safeConvert :: Int64 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Int64 -> Integer) -> Int64 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Word where
safeConvert :: Integer -> ConvertResult Word
safeConvert = (Integer -> ConvertResult Word) -> Integer -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Integer -> Word) -> Integer -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word Integer where
safeConvert :: Word -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Word -> Integer) -> Word -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Word8 where
safeConvert :: Integer -> ConvertResult Word8
safeConvert = (Integer -> ConvertResult Word8) -> Integer -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Integer -> Word8) -> Integer -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word8 Integer where
safeConvert :: Word8 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Word8 -> Integer) -> Word8 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Word16 where
safeConvert :: Integer -> ConvertResult Word16
safeConvert = (Integer -> ConvertResult Word16)
-> Integer -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Integer -> Word16) -> Integer -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word16 Integer where
safeConvert :: Word16 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Word16 -> Integer) -> Word16 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Word32 where
safeConvert :: Integer -> ConvertResult Word32
safeConvert = (Integer -> ConvertResult Word32)
-> Integer -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Integer -> Word32) -> Integer -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word32 Integer where
safeConvert :: Word32 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Word32 -> Integer) -> Word32 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Word64 where
safeConvert :: Integer -> ConvertResult Word64
safeConvert = (Integer -> ConvertResult Word64)
-> Integer -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Integer -> Word64) -> Integer -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Word64 Integer where
safeConvert :: Word64 -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Word64 -> Integer) -> Word64 -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Double where
safeConvert :: Integer -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Integer -> Double) -> Integer -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Float where
safeConvert :: Integer -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Integer -> Float) -> Integer -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Integer Rational where
safeConvert :: Integer -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Integer -> Rational) -> Integer -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance Convertible Double Integer where
safeConvert :: Double -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Double -> Integer) -> Double -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate
instance Convertible Float Integer where
safeConvert :: Float -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Float -> Integer) -> Float -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate
instance Convertible Rational Integer where
safeConvert :: Rational -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Rational -> Integer) -> Rational -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate
instance Convertible Float Double where
safeConvert :: Float -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Float -> Double) -> Float -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac
instance Convertible Double Float where
safeConvert :: Double -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Double -> Float) -> Double -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac
instance Convertible Float Rational where
safeConvert :: Float -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Float -> Rational) -> Float -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Rational
forall a. Real a => a -> Rational
toRational
instance Convertible Rational Float where
safeConvert :: Rational -> ConvertResult Float
safeConvert = Float -> ConvertResult Float
forall (m :: * -> *) a. Monad m => a -> m a
return (Float -> ConvertResult Float)
-> (Rational -> Float) -> Rational -> ConvertResult Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Float
forall a. Fractional a => Rational -> a
fromRational
instance Convertible Double Rational where
safeConvert :: Double -> ConvertResult Rational
safeConvert = Rational -> ConvertResult Rational
forall (m :: * -> *) a. Monad m => a -> m a
return (Rational -> ConvertResult Rational)
-> (Double -> Rational) -> Double -> ConvertResult Rational
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> Rational
forall a. Real a => a -> Rational
toRational
instance Convertible Rational Double where
safeConvert :: Rational -> ConvertResult Double
safeConvert = Double -> ConvertResult Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> ConvertResult Double)
-> (Rational -> Double) -> Rational -> ConvertResult Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> Double
forall a. Fractional a => Rational -> a
fromRational
instance Convertible Char Integer where
safeConvert :: Char -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> ConvertResult Integer)
-> (Char -> Integer) -> Char -> ConvertResult Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Integer) -> (Char -> Int) -> Char -> Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum
instance Convertible Integer Char where
safeConvert :: Integer -> ConvertResult Char
safeConvert = (Integer -> ConvertResult Char) -> Integer -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Integer -> Char) -> Integer -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Integer -> Int) -> Integer -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Int where
safeConvert :: Char -> ConvertResult Int
safeConvert = (Char -> ConvertResult Int) -> Char -> ConvertResult Int
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int -> ConvertResult Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> ConvertResult Int)
-> (Char -> Int) -> Char -> ConvertResult Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Int Char where
safeConvert :: Int -> ConvertResult Char
safeConvert = (Int -> ConvertResult Char) -> Int -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Int -> Char) -> Int -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum)
instance Convertible Char Int8 where
safeConvert :: Char -> ConvertResult Int8
safeConvert = (Char -> ConvertResult Int8) -> Char -> ConvertResult Int8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int8 -> ConvertResult Int8
forall (m :: * -> *) a. Monad m => a -> m a
return (Int8 -> ConvertResult Int8)
-> (Char -> Int8) -> Char -> ConvertResult Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int8) -> (Char -> Int) -> Char -> Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Int8 Char where
safeConvert :: Int8 -> ConvertResult Char
safeConvert = (Int8 -> ConvertResult Char) -> Int8 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Int8 -> Char) -> Int8 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Int8 -> Int) -> Int8 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Int16 where
safeConvert :: Char -> ConvertResult Int16
safeConvert = (Char -> ConvertResult Int16) -> Char -> ConvertResult Int16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int16 -> ConvertResult Int16
forall (m :: * -> *) a. Monad m => a -> m a
return (Int16 -> ConvertResult Int16)
-> (Char -> Int16) -> Char -> ConvertResult Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int16) -> (Char -> Int) -> Char -> Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Int16 Char where
safeConvert :: Int16 -> ConvertResult Char
safeConvert = (Int16 -> ConvertResult Char) -> Int16 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Int16 -> Char) -> Int16 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Int16 -> Int) -> Int16 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Int32 where
safeConvert :: Char -> ConvertResult Int32
safeConvert = (Char -> ConvertResult Int32) -> Char -> ConvertResult Int32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int32 -> ConvertResult Int32
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32 -> ConvertResult Int32)
-> (Char -> Int32) -> Char -> ConvertResult Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> (Char -> Int) -> Char -> Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Int32 Char where
safeConvert :: Int32 -> ConvertResult Char
safeConvert = (Int32 -> ConvertResult Char) -> Int32 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Int32 -> Char) -> Int32 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Int32 -> Int) -> Int32 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Int64 where
safeConvert :: Char -> ConvertResult Int64
safeConvert = (Char -> ConvertResult Int64) -> Char -> ConvertResult Int64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Int64 -> ConvertResult Int64
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64 -> ConvertResult Int64)
-> (Char -> Int64) -> Char -> ConvertResult Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int64) -> (Char -> Int) -> Char -> Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Int64 Char where
safeConvert :: Int64 -> ConvertResult Char
safeConvert = (Int64 -> ConvertResult Char) -> Int64 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Int64 -> Char) -> Int64 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Int64 -> Int) -> Int64 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Word where
safeConvert :: Char -> ConvertResult Word
safeConvert = (Char -> ConvertResult Word) -> Char -> ConvertResult Word
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word -> ConvertResult Word
forall (m :: * -> *) a. Monad m => a -> m a
return (Word -> ConvertResult Word)
-> (Char -> Word) -> Char -> ConvertResult Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word) -> (Char -> Int) -> Char -> Word
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Word Char where
safeConvert :: Word -> ConvertResult Char
safeConvert = (Word -> ConvertResult Char) -> Word -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Word -> Char) -> Word -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Word -> Int) -> Word -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Word8 where
safeConvert :: Char -> ConvertResult Word8
safeConvert = (Char -> ConvertResult Word8) -> Char -> ConvertResult Word8
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word8 -> ConvertResult Word8
forall (m :: * -> *) a. Monad m => a -> m a
return (Word8 -> ConvertResult Word8)
-> (Char -> Word8) -> Char -> ConvertResult Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word8) -> (Char -> Int) -> Char -> Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Word8 Char where
safeConvert :: Word8 -> ConvertResult Char
safeConvert = (Word8 -> ConvertResult Char) -> Word8 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Word8 -> Char) -> Word8 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Word8 -> Int) -> Word8 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Word16 where
safeConvert :: Char -> ConvertResult Word16
safeConvert = (Char -> ConvertResult Word16) -> Char -> ConvertResult Word16
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word16 -> ConvertResult Word16
forall (m :: * -> *) a. Monad m => a -> m a
return (Word16 -> ConvertResult Word16)
-> (Char -> Word16) -> Char -> ConvertResult Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word16) -> (Char -> Int) -> Char -> Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Word16 Char where
safeConvert :: Word16 -> ConvertResult Char
safeConvert = (Word16 -> ConvertResult Char) -> Word16 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Word16 -> Char) -> Word16 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Word16 -> Int) -> Word16 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Word32 where
safeConvert :: Char -> ConvertResult Word32
safeConvert = (Char -> ConvertResult Word32) -> Char -> ConvertResult Word32
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word32 -> ConvertResult Word32
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32 -> ConvertResult Word32)
-> (Char -> Word32) -> Char -> ConvertResult Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> (Char -> Int) -> Char -> Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Word32 Char where
safeConvert :: Word32 -> ConvertResult Char
safeConvert = (Word32 -> ConvertResult Char) -> Word32 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Word32 -> Char) -> Word32 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Word32 -> Int) -> Word32 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Char Word64 where
safeConvert :: Char -> ConvertResult Word64
safeConvert = (Char -> ConvertResult Word64) -> Char -> ConvertResult Word64
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Word64 -> ConvertResult Word64
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64 -> ConvertResult Word64)
-> (Char -> Word64) -> Char -> ConvertResult Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> (Char -> Int) -> Char -> Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum)
instance Convertible Word64 Char where
safeConvert :: Word64 -> ConvertResult Char
safeConvert = (Word64 -> ConvertResult Char) -> Word64 -> ConvertResult Char
forall b a.
(Bounded b, Show a, Show b, Convertible a Integer,
Convertible b Integer, Typeable a, Typeable b) =>
(a -> ConvertResult b) -> a -> ConvertResult b
boundedConversion (Char -> ConvertResult Char
forall (m :: * -> *) a. Monad m => a -> m a
return (Char -> ConvertResult Char)
-> (Word64 -> Char) -> Word64 -> ConvertResult Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (Word64 -> Int) -> Word64 -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
instance Convertible Integer Integer where
safeConvert :: Integer -> ConvertResult Integer
safeConvert = Integer -> ConvertResult Integer
forall (m :: * -> *) a. Monad m => a -> m a
return