witch-1.3.0.6: Convert values from one type into another.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Witch.TryFrom

Synopsis

Documentation

class TryFrom source target where Source #

This type class is for converting values from some source type into some other target type. The constraint TryFrom source target means that you may be able to convert from a value of type source into a value of type target, but that conversion may fail at runtime.

This type class is for conversions that can sometimes fail. If your conversion always succeeds, consider implementing From instead.

Methods

tryFrom :: source -> Either (TryFromException source target) target Source #

This method implements the conversion of a value between types. At call sites you may want to use tryInto instead.

-- Avoid this:
tryFrom (x :: s)

-- Prefer this:
tryFrom @s

Consider using maybeTryFrom or eitherTryFrom to implement this method.

Instances

Instances details
TryFrom Int16 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Int8) Int8 Source #

TryFrom Int16 Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Word16) Word16 Source #

TryFrom Int16 Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Word32) Word32 Source #

TryFrom Int16 Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Word64) Word64 Source #

TryFrom Int16 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Word8) Word8 Source #

TryFrom Int16 Natural Source #

Uses fromIntegral when the input is not negative.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Natural) Natural Source #

TryFrom Int16 Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int16 -> Either (TryFromException Int16 Word) Word Source #

TryFrom Int32 Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Int16) Int16 Source #

TryFrom Int32 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Int8) Int8 Source #

TryFrom Int32 Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Word16) Word16 Source #

TryFrom Int32 Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Word32) Word32 Source #

TryFrom Int32 Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Word64) Word64 Source #

TryFrom Int32 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Word8) Word8 Source #

TryFrom Int32 Natural Source #

Uses fromIntegral when the input is not negative.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Natural) Natural Source #

TryFrom Int32 Float Source #

Uses fromIntegral when the input is between -16,777,215 and 16,777,215 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Float) Float Source #

TryFrom Int32 Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Int) Int Source #

TryFrom Int32 Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int32 -> Either (TryFromException Int32 Word) Word Source #

TryFrom Int64 Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Int16) Int16 Source #

TryFrom Int64 Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Int32) Int32 Source #

TryFrom Int64 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Int8) Int8 Source #

TryFrom Int64 Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Word16) Word16 Source #

TryFrom Int64 Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Word32) Word32 Source #

TryFrom Int64 Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Word64) Word64 Source #

TryFrom Int64 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Word8) Word8 Source #

TryFrom Int64 Natural Source #

Uses fromIntegral when the input is not negative.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Natural) Natural Source #

TryFrom Int64 Double Source #

Uses fromIntegral when the input is between -9,007,199,254,740,991 and 9,007,199,254,740,991 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Double) Double Source #

TryFrom Int64 Float Source #

Uses fromIntegral when the input is between -16,777,215 and 16,777,215 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Float) Float Source #

TryFrom Int64 Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Int) Int Source #

TryFrom Int64 Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int64 -> Either (TryFromException Int64 Word) Word Source #

TryFrom Int8 Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int8 -> Either (TryFromException Int8 Word16) Word16 Source #

TryFrom Int8 Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int8 -> Either (TryFromException Int8 Word32) Word32 Source #

TryFrom Int8 Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int8 -> Either (TryFromException Int8 Word64) Word64 Source #

TryFrom Int8 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int8 -> Either (TryFromException Int8 Word8) Word8 Source #

TryFrom Int8 Natural Source #

Uses fromIntegral when the input is not negative.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int8 -> Either (TryFromException Int8 Natural) Natural Source #

TryFrom Int8 Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int8 -> Either (TryFromException Int8 Word) Word Source #

TryFrom Word16 Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word16 -> Either (TryFromException Word16 Int16) Int16 Source #

TryFrom Word16 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word16 -> Either (TryFromException Word16 Int8) Int8 Source #

TryFrom Word16 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word16 -> Either (TryFromException Word16 Word8) Word8 Source #

TryFrom Word32 Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Int16) Int16 Source #

TryFrom Word32 Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Int32) Int32 Source #

TryFrom Word32 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Int8) Int8 Source #

TryFrom Word32 Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Word16) Word16 Source #

TryFrom Word32 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Word8) Word8 Source #

TryFrom Word32 Float Source #

Uses fromIntegral when the input is less than or equal to 16,777,215.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Float) Float Source #

TryFrom Word32 Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Int) Int Source #

TryFrom Word32 Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word32 -> Either (TryFromException Word32 Word) Word Source #

TryFrom Word64 Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Int16) Int16 Source #

TryFrom Word64 Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Int32) Int32 Source #

TryFrom Word64 Int64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Int64) Int64 Source #

TryFrom Word64 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Int8) Int8 Source #

TryFrom Word64 Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Word16) Word16 Source #

TryFrom Word64 Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Word32) Word32 Source #

TryFrom Word64 Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Word8) Word8 Source #

TryFrom Word64 Double Source #

Uses fromIntegral when the input is less than or equal to 9,007,199,254,740,991.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Double) Double Source #

TryFrom Word64 Float Source #

Uses fromIntegral when the input is less than or equal to 16,777,215.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Float) Float Source #

TryFrom Word64 Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Int) Int Source #

TryFrom Word64 Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word64 -> Either (TryFromException Word64 Word) Word Source #

TryFrom Word8 Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word8 -> Either (TryFromException Word8 Int8) Int8 Source #

TryFrom Text Latin1L Source #

Converts via String.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Text -> Either (TryFromException Text Latin1L) Latin1L Source #

TryFrom Text Latin1S Source #

Converts via String.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Text -> Either (TryFromException Text Latin1S) Latin1S Source #

TryFrom Text Latin1L Source #

Converts via String.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Text -> Either (TryFromException Text Latin1L) Latin1L Source #

TryFrom Text Latin1S Source #

Converts via String.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Text -> Either (TryFromException Text Latin1S) Latin1S Source #

TryFrom Utf16BL Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16BL -> Either (TryFromException Utf16BL Text) Text Source #

TryFrom Utf16BL Text Source #

Uses decodeUtf16BE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16BL -> Either (TryFromException Utf16BL Text) Text Source #

TryFrom Utf16BL String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16BL -> Either (TryFromException Utf16BL String) String Source #

TryFrom Utf16BS Text Source #

Uses decodeUtf16BE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16BS -> Either (TryFromException Utf16BS Text) Text Source #

TryFrom Utf16BS Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16BS -> Either (TryFromException Utf16BS Text) Text Source #

TryFrom Utf16BS String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16BS -> Either (TryFromException Utf16BS String) String Source #

TryFrom Utf16LL Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16LL -> Either (TryFromException Utf16LL Text) Text Source #

TryFrom Utf16LL Text Source #

Uses decodeUtf16LE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16LL -> Either (TryFromException Utf16LL Text) Text Source #

TryFrom Utf16LL String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16LL -> Either (TryFromException Utf16LL String) String Source #

TryFrom Utf16LS Text Source #

Uses decodeUtf16LE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16LS -> Either (TryFromException Utf16LS Text) Text Source #

TryFrom Utf16LS Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16LS -> Either (TryFromException Utf16LS Text) Text Source #

TryFrom Utf16LS String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf16LS -> Either (TryFromException Utf16LS String) String Source #

TryFrom Utf32BL Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32BL -> Either (TryFromException Utf32BL Text) Text Source #

TryFrom Utf32BL Text Source #

Uses decodeUtf32BE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32BL -> Either (TryFromException Utf32BL Text) Text Source #

TryFrom Utf32BL String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32BL -> Either (TryFromException Utf32BL String) String Source #

TryFrom Utf32BS Text Source #

Uses decodeUtf32BE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32BS -> Either (TryFromException Utf32BS Text) Text Source #

TryFrom Utf32BS Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32BS -> Either (TryFromException Utf32BS Text) Text Source #

TryFrom Utf32BS String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32BS -> Either (TryFromException Utf32BS String) String Source #

TryFrom Utf32LL Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32LL -> Either (TryFromException Utf32LL Text) Text Source #

TryFrom Utf32LL Text Source #

Uses decodeUtf32LE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32LL -> Either (TryFromException Utf32LL Text) Text Source #

TryFrom Utf32LL String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32LL -> Either (TryFromException Utf32LL String) String Source #

TryFrom Utf32LS Text Source #

Uses decodeUtf32LE.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32LS -> Either (TryFromException Utf32LS Text) Text Source #

TryFrom Utf32LS Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32LS -> Either (TryFromException Utf32LS Text) Text Source #

TryFrom Utf32LS String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf32LS -> Either (TryFromException Utf32LS String) String Source #

TryFrom Utf8L Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf8L -> Either (TryFromException Utf8L Text) Text Source #

TryFrom Utf8L Text Source #

Uses decodeUtf8'.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf8L -> Either (TryFromException Utf8L Text) Text Source #

TryFrom Utf8L String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf8L -> Either (TryFromException Utf8L String) String Source #

TryFrom Utf8S Text Source #

Uses decodeUtf8'.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf8S -> Either (TryFromException Utf8S Text) Text Source #

TryFrom Utf8S Text Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf8S -> Either (TryFromException Utf8S Text) Text Source #

TryFrom Utf8S String Source #

Converts via Text.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Utf8S -> Either (TryFromException Utf8S String) String Source #

TryFrom Integer Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Int16) Int16 Source #

TryFrom Integer Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Int32) Int32 Source #

TryFrom Integer Int64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Int64) Int64 Source #

TryFrom Integer Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Int8) Int8 Source #

TryFrom Integer Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Word16) Word16 Source #

TryFrom Integer Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Word32) Word32 Source #

TryFrom Integer Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Word64) Word64 Source #

TryFrom Integer Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Word8) Word8 Source #

TryFrom Integer Natural Source #

Uses fromInteger when the input is not negative.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Natural) Natural Source #

TryFrom Integer Double Source #

Uses fromIntegral when the input is between -9,007,199,254,740,991 and 9,007,199,254,740,991 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Double) Double Source #

TryFrom Integer Float Source #

Uses fromIntegral when the input is between -16,777,215 and 16,777,215 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Float) Float Source #

TryFrom Integer Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Int) Int Source #

TryFrom Integer Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Integer -> Either (TryFromException Integer Word) Word Source #

TryFrom Natural Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Int16) Int16 Source #

TryFrom Natural Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Int32) Int32 Source #

TryFrom Natural Int64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Int64) Int64 Source #

TryFrom Natural Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Int8) Int8 Source #

TryFrom Natural Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Word16) Word16 Source #

TryFrom Natural Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Word32) Word32 Source #

TryFrom Natural Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Word64) Word64 Source #

TryFrom Natural Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Word8) Word8 Source #

TryFrom Natural Double Source #

Uses fromIntegral when the input is less than or equal to 9,007,199,254,740,991.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Double) Double Source #

TryFrom Natural Float Source #

Uses fromIntegral when the input is less than or equal to 16,777,215.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Float) Float Source #

TryFrom Natural Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Int) Int Source #

TryFrom Natural Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Natural -> Either (TryFromException Natural Word) Word Source #

TryFrom String Latin1L Source #

Uses pack when each character isLatin1.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: String -> Either (TryFromException String Latin1L) Latin1L Source #

TryFrom String Latin1S Source #

Uses pack when each character isLatin1.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: String -> Either (TryFromException String Latin1S) Latin1S Source #

TryFrom Double Int16 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Int16) Int16 Source #

TryFrom Double Int32 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Int32) Int32 Source #

TryFrom Double Int64 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Int64) Int64 Source #

TryFrom Double Int8 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Int8) Int8 Source #

TryFrom Double Rational Source #

Uses floatToDigits when the input is not NaN or infinity.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Rational) Rational Source #

TryFrom Double Word16 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Word16) Word16 Source #

TryFrom Double Word32 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Word32) Word32 Source #

TryFrom Double Word64 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Word64) Word64 Source #

TryFrom Double Word8 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Word8) Word8 Source #

TryFrom Double Integer Source #

Converts via Rational when the input is between -9,007,199,254,740,991 and 9,007,199,254,740,991 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Integer) Integer Source #

TryFrom Double Natural Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Natural) Natural Source #

TryFrom Double Int Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Int) Int Source #

TryFrom Double Word Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Double -> Either (TryFromException Double Word) Word Source #

TryFrom Float Int16 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Int16) Int16 Source #

TryFrom Float Int32 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Int32) Int32 Source #

TryFrom Float Int64 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Int64) Int64 Source #

TryFrom Float Int8 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Int8) Int8 Source #

TryFrom Float Rational Source #

Uses floatToDigits when the input is not NaN or infinity.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Rational) Rational Source #

TryFrom Float Word16 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Word16) Word16 Source #

TryFrom Float Word32 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Word32) Word32 Source #

TryFrom Float Word64 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Word64) Word64 Source #

TryFrom Float Word8 Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Word8) Word8 Source #

TryFrom Float Integer Source #

Converts via Rational when the input is between -16,777,215 and 16,777,215 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Integer) Integer Source #

TryFrom Float Natural Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Natural) Natural Source #

TryFrom Float Int Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Int) Int Source #

TryFrom Float Word Source #

Converts via Integer.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Float -> Either (TryFromException Float Word) Word Source #

TryFrom Int Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Int16) Int16 Source #

TryFrom Int Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Int32) Int32 Source #

TryFrom Int Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Int8) Int8 Source #

TryFrom Int Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Word16) Word16 Source #

TryFrom Int Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Word32) Word32 Source #

TryFrom Int Word64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Word64) Word64 Source #

TryFrom Int Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Word8) Word8 Source #

TryFrom Int Natural Source #

Uses fromIntegral when the input is not negative.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Natural) Natural Source #

TryFrom Int Double Source #

Uses fromIntegral when the input is between -9,007,199,254,740,991 and 9,007,199,254,740,991 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Double) Double Source #

TryFrom Int Float Source #

Uses fromIntegral when the input is between -16,777,215 and 16,777,215 inclusive.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Float) Float Source #

TryFrom Int Word Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Int -> Either (TryFromException Int Word) Word Source #

TryFrom Word Int16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Int16) Int16 Source #

TryFrom Word Int32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Int32) Int32 Source #

TryFrom Word Int64 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Int64) Int64 Source #

TryFrom Word Int8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Int8) Int8 Source #

TryFrom Word Word16 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Word16) Word16 Source #

TryFrom Word Word32 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Word32) Word32 Source #

TryFrom Word Word8 Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Word8) Word8 Source #

TryFrom Word Double Source #

Uses fromIntegral when the input is less than or equal to 9,007,199,254,740,991.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Double) Double Source #

TryFrom Word Float Source #

Uses fromIntegral when the input is less than or equal to 16,777,215.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Float) Float Source #

TryFrom Word Int Source #

Uses toIntegralSized.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Word -> Either (TryFromException Word Int) Int Source #

HasResolution a => TryFrom Rational (Fixed a) Source #

Uses fromRational as long as there isn't a loss of precision.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Rational -> Either (TryFromException Rational (Fixed a)) (Fixed a) Source #

(Eq a, Num a) => TryFrom (Complex a) a Source #

Uses realPart when the imaginary part is 0.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Complex a -> Either (TryFromException (Complex a) a) a Source #

(Eq a, Num a) => TryFrom (Ratio a) a Source #

Uses numerator when the denominator is 1.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Ratio a -> Either (TryFromException (Ratio a) a) a Source #

TryFrom [a] (NonEmpty a) Source #

Uses nonEmpty.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: [a] -> Either (TryFromException [a] (NonEmpty a)) (NonEmpty a) Source #

HasResolution a => TryFrom (Fixed a) Integer Source #

Converts via Rational when there is no fractional part. This means tryFrom @Centi @Integer 2.00 is Right 2 and tryFrom @Centi @Integer 0.02 will fail.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Fixed a -> Either (TryFromException (Fixed a) Integer) Integer Source #

(HasResolution s, HasResolution t) => TryFrom (Fixed s) (Fixed t) Source #

Converts via Rational.

Instance details

Defined in Witch.Instances

Methods

tryFrom :: Fixed s -> Either (TryFromException (Fixed s) (Fixed t)) (Fixed t) Source #