-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Convert values from one type into another.
--   
--   Witch converts values from one type into another.
@package witch
@version 1.3.0.6

module Witch.Encoding

-- | <a>https://en.wikipedia.org/wiki/ISO/IEC_8859-1</a>
type ISO_8859_1 = Tagged "ISO-8859-1"

-- | The <a>ISO_8859_1</a> encoding for strict <a>ByteString</a>s.
type Latin1S = ISO_8859_1 ByteString

-- | The <a>ISO_8859_1</a> encoding for lazy <a>ByteString</a>s.
type Latin1L = ISO_8859_1 ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-8</a>
type UTF_8 = Tagged "UTF-8"

-- | The <a>UTF_8</a> encoding for strict <a>ByteString</a>s.
type Utf8S = UTF_8 ByteString

-- | The <a>UTF_8</a> encoding for lazy <a>ByteString</a>s.
type Utf8L = UTF_8 ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-16</a>
type UTF_16LE = Tagged "UTF-16LE"

-- | The <a>UTF_16LE</a> encoding for strict <a>ByteString</a>s.
type Utf16LS = UTF_16LE ByteString

-- | The <a>UTF_16LE</a> encoding for lazy <a>ByteString</a>s.
type Utf16LL = UTF_16LE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-16</a>
type UTF_16BE = Tagged "UTF-16BE"

-- | The <a>UTF_16BE</a> encoding for strict <a>ByteString</a>s.
type Utf16BS = UTF_16BE ByteString

-- | The <a>UTF_16BE</a> encoding for lazy <a>ByteString</a>s.
type Utf16BL = UTF_16BE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-32</a>
type UTF_32LE = Tagged "UTF-32LE"

-- | The <a>UTF_32LE</a> encoding for strict <a>ByteString</a>s.
type Utf32LS = UTF_32LE ByteString

-- | The <a>UTF_32LE</a> encoding for lazy <a>ByteString</a>s.
type Utf32LL = UTF_32LE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-32</a>
type UTF_32BE = Tagged "UTF-32BE"

-- | The <a>UTF_32BE</a> encoding for strict <a>ByteString</a>s.
type Utf32BS = UTF_32BE ByteString

-- | The <a>UTF_32BE</a> encoding for lazy <a>ByteString</a>s.
type Utf32BL = UTF_32BE ByteString

module Witch.From

-- | This type class is for converting values from some <tt>source</tt>
--   type into some other <tt>target</tt> type. The constraint
--   <tt><a>From</a> source target</tt> means that you can convert from a
--   value of type <tt>source</tt> into a value of type <tt>target</tt>.
--   
--   This type class is for conversions that always succeed. If your
--   conversion sometimes fails, consider implementing <tt>TryFrom</tt>
--   instead.
class From source target

-- | This method implements the conversion of a value between types. At
--   call sites you may prefer to use <tt>into</tt> instead.
--   
--   <pre>
--   -- Avoid this:
--   from (x :: s)
--   
--   -- Prefer this (using [@TypeApplications@](https://downloads.haskell.org/ghc/9.6.1/docs/users_guide/exts/type_applications.html) language extension):
--   from @s x
--   </pre>
--   
--   The default implementation of this method simply calls <a>coerce</a>,
--   which works for types that have the same runtime representation. This
--   means that for <tt>newtype</tt>s you do not need to implement this
--   method at all. For example:
--   
--   <pre>
--   &gt;&gt;&gt; newtype Name = Name String
--   
--   &gt;&gt;&gt; instance From Name String
--   
--   &gt;&gt;&gt; instance From String Name
--   </pre>
from :: From source target => source -> target
($dmfrom) :: (From source target, Coercible source target) => source -> target

module Witch.Generic

-- | This type class is used to implement generic conversions using the
--   <a>Generically</a> helper. This is an advanced use case. Most users
--   will not need to know about this type class. And even for those that
--   want to derive <a>Generically</a>, this type class should be an
--   implementation detail.
--   
--   This type class can convert between any two types as long as they have
--   <a>Generic</a> instances and they are structurally similar. For
--   example, if you define your own empty type you could convert it to the
--   typical <a>Void</a> type:
--   
--   <pre>
--   data Empty deriving Generic
--   deriving via Generically Void instance From Empty Void
--   </pre>
--   
--   Or your own unit type:
--   
--   <pre>
--   data Unit = MkUnit deriving Generic
--   deriving via Generically () instance From Unit ()
--   </pre>
--   
--   Note that this looks superficially similar to <tt>newtype Unit =
--   MkUnit ()</tt> together with <tt>instance From Unit ()</tt>, but that
--   goes through <a>Coercible</a> and requires the types to be
--   representationally equal. This approach (with <a>Generically</a>) only
--   requires the types to be <i>structurally</i> equal. In this case,
--   <tt>Unit</tt> is structurally equal to <tt>()</tt> since they both
--   have a single constructor with no arguments.
--   
--   This also works with arbitrary product types, like a custom pair type:
--   
--   <pre>
--   data Pair a b = MkPair a b deriving Generic
--   deriving via Generically (Pair c d)
--     instance (From a c, From b d) =&gt; From (a, b) (Pair c d)
--   </pre>
--   
--   Note that this can also convert the type variables as long as they
--   have <a>From</a> instances as well. This allows converting from
--   <tt>(Int, Int)</tt> to <tt>Pair Integer Integer</tt> in one step, for
--   example.
--   
--   And this works with arbitrary sum types as well:
--   
--   <pre>
--   data Result a b = Failure a | Success b deriving Generic
--   deriving via Generically (Result c d)
--     instance (From a c, From b d) =&gt; From (Either a b) (Result c d)
--   </pre>
--   
--   Note that these conversions are all <i>structural</i> not semantic.
--   That means if you had defined <tt>Result</tt> as <tt>Success b |
--   Failure a</tt>, then converting from <a>Either</a> would be "wrong".
--   <a>Left</a> would convert into <tt>Success</tt> and <a>Right</a> would
--   convert into <tt>Failure</tt>.
class GFrom (s :: Type -> Type) (t :: Type -> Type)
gFrom :: GFrom s t => s x -> t x
instance (GHC.Internal.Generics.Generic s, GHC.Internal.Generics.Generic t, Witch.Generic.GFrom (GHC.Internal.Generics.Rep s) (GHC.Internal.Generics.Rep t)) => Witch.From.From s (GHC.Internal.Generics.Generically t)
instance (Witch.Generic.GFrom s1 t1, Witch.Generic.GFrom s2 t2) => Witch.Generic.GFrom (s1 GHC.Internal.Generics.:*: s2) (t1 GHC.Internal.Generics.:*: t2)
instance (Witch.Generic.GFrom s1 t1, Witch.Generic.GFrom s2 t2) => Witch.Generic.GFrom (s1 GHC.Internal.Generics.:+: s2) (t1 GHC.Internal.Generics.:+: t2)
instance Witch.From.From s t => Witch.Generic.GFrom (GHC.Internal.Generics.K1 a s) (GHC.Internal.Generics.K1 b t)
instance Witch.Generic.GFrom s t => Witch.Generic.GFrom (GHC.Internal.Generics.M1 a b s) (GHC.Internal.Generics.M1 c d t)
instance Witch.Generic.GFrom GHC.Internal.Generics.U1 GHC.Internal.Generics.U1
instance Witch.Generic.GFrom GHC.Internal.Generics.V1 GHC.Internal.Generics.V1

module Witch.TryFromException

-- | This exception is thrown when a <tt>TryFrom</tt> conversion fails. It
--   has the original <tt>source</tt> value that caused the failure and it
--   knows the <tt>target</tt> type it was trying to convert into. It also
--   has an optional <a>SomeException</a> for communicating what went wrong
--   while converting.
data TryFromException source target
TryFromException :: source -> Maybe SomeException -> TryFromException source target
instance (GHC.Internal.Show.Show source, GHC.Internal.Data.Typeable.Internal.Typeable source, GHC.Internal.Data.Typeable.Internal.Typeable target) => GHC.Internal.Exception.Type.Exception (Witch.TryFromException.TryFromException source target)
instance (GHC.Internal.Show.Show source, GHC.Internal.Data.Typeable.Internal.Typeable source, GHC.Internal.Data.Typeable.Internal.Typeable target) => GHC.Internal.Show.Show (Witch.TryFromException.TryFromException source target)

module Witch.TryFrom

-- | This type class is for converting values from some <tt>source</tt>
--   type into some other <tt>target</tt> type. The constraint
--   <tt><a>TryFrom</a> source target</tt> means that you may be able to
--   convert from a value of type <tt>source</tt> into a value of type
--   <tt>target</tt>, but that conversion may fail at runtime.
--   
--   This type class is for conversions that can sometimes fail. If your
--   conversion always succeeds, consider implementing <tt>From</tt>
--   instead.
class TryFrom source target

-- | This method implements the conversion of a value between types. At
--   call sites you may want to use <tt>tryInto</tt> instead.
--   
--   <pre>
--   -- Avoid this:
--   tryFrom (x :: s)
--   
--   -- Prefer this:
--   tryFrom @s
--   </pre>
--   
--   Consider using <tt>maybeTryFrom</tt> or <tt>eitherTryFrom</tt> to
--   implement this method.
tryFrom :: TryFrom source target => source -> Either (TryFromException source target) target

module Witch.Utility

-- | This is the same as <a>id</a>. This can be an ergonomic way to pin
--   down a polymorphic type in a function pipeline. For example:
--   
--   <pre>
--   -- Avoid this:
--   f . (\ x -&gt; x :: Int) . g
--   
--   -- Prefer this:
--   f . as @Int . g
--   </pre>
as :: source -> source

-- | This is the same as <a>from</a> except that the type variables are in
--   the opposite order.
--   
--   <pre>
--   -- Avoid this:
--   from x :: t
--   
--   -- Prefer this:
--   into @t x
--   </pre>
into :: forall target source. From source target => source -> target

-- | This function converts from some <tt>source</tt> type into some
--   <tt>target</tt> type, applies the given function, then converts back
--   into the <tt>source</tt> type. This is useful when you have two types
--   that are isomorphic but some function that only works with one of
--   them.
--   
--   <pre>
--   -- Avoid this:
--   from @t . f . into @t
--   
--   -- Prefer this:
--   over @t f
--   </pre>
over :: forall target source. (From source target, From target source) => (target -> target) -> source -> source

-- | This function first converts from some <tt>source</tt> type into some
--   <tt>through</tt> type, and then converts that into some
--   <tt>target</tt> type. Usually this is used when writing <a>From</a>
--   instances. Sometimes this can be used to work around the lack of an
--   instance that should probably exist.
--   
--   <pre>
--   -- Avoid this:
--   from @u . into @u
--   
--   -- Prefer this:
--   via @u
--   </pre>
via :: forall through source target. (From source through, From through target) => source -> target

-- | This is the same as <a>tryFrom</a> except that the type variables are
--   in the opposite order.
--   
--   <pre>
--   -- Avoid this:
--   tryFrom x :: Either (TryFromException s t) t
--   
--   -- Prefer this:
--   tryInto @t x
--   </pre>
tryInto :: forall target source. TryFrom source target => source -> Either (TryFromException source target) target

-- | This is similar to <a>via</a> except that it works with <a>TryFrom</a>
--   instances instead. This function is especially convenient because
--   juggling the types in the <a>TryFromException</a> can be tedious.
--   
--   <pre>
--   -- Avoid this:
--   case tryInto @u x of
--     Left (TryFromException _ e) -&gt; Left $ TryFromException x e
--     Right y -&gt; case tryFrom @u y of
--       Left (TryFromException _ e) -&gt; Left $ TryFromException x e
--       Right z -&gt; Right z
--   
--   -- Prefer this:
--   tryVia @u
--   </pre>
tryVia :: forall through source target. (TryFrom source through, TryFrom through target) => source -> Either (TryFromException source target) target

-- | This function can be used to implement <a>tryFrom</a> with a function
--   that returns <a>Maybe</a>. For example:
--   
--   <pre>
--   -- Avoid this:
--   tryFrom s = case f s of
--     Nothing -&gt; Left $ TryFromException s Nothing
--     Just t -&gt; Right t
--   
--   -- Prefer this:
--   tryFrom = maybeTryFrom f
--   </pre>
maybeTryFrom :: (source -> Maybe target) -> source -> Either (TryFromException source target) target

-- | This function can be used to implement <a>tryFrom</a> with a function
--   that returns <a>Either</a>. For example:
--   
--   <pre>
--   -- Avoid this:
--   tryFrom s = case f s of
--     Left e -&gt; Left . TryFromException s . Just $ toException e
--     Right t -&gt; Right t
--   
--   -- Prefer this:
--   tryFrom = eitherTryFrom f
--   </pre>
eitherTryFrom :: Exception exception => (source -> Either exception target) -> source -> Either (TryFromException source target) target

-- | This function is like <a>tryFrom</a> except that it will throw an
--   impure exception if the conversion fails.
--   
--   <pre>
--   -- Avoid this:
--   either throw id . tryFrom @s
--   
--   -- Prefer this:
--   unsafeFrom @s
--   </pre>
unsafeFrom :: (HasCallStack, TryFrom source target, Show source, Typeable source, Typeable target) => source -> target

-- | This function is like <a>tryInto</a> except that it will throw an
--   impure exception if the conversion fails.
--   
--   <pre>
--   -- Avoid this:
--   either throw id . tryInto @t
--   
--   -- Prefer this:
--   unsafeInto @t
--   </pre>
unsafeInto :: forall target source. (HasCallStack, TryFrom source target, Show source, Typeable source, Typeable target) => source -> target
withSource :: newSource -> TryFromException oldSource target -> TryFromException newSource target
withTarget :: forall newTarget source oldTarget. TryFromException source oldTarget -> TryFromException source newTarget

module Witch.Lift

-- | This is like <a>unsafeFrom</a> except that it works at compile time
--   rather than runtime.
--   
--   <pre>
--   -- Avoid this:
--   unsafeFrom @s "some literal"
--   
--   -- Prefer this:
--   $$(liftedFrom @s "some literal")
--   </pre>
liftedFrom :: forall source target (m :: Type -> Type). (TryFrom source target, Lift target, Show source, Typeable source, Typeable target, Quote m) => source -> Code m target

-- | This is like <a>unsafeInto</a> except that it works at compile time
--   rather than runtime.
--   
--   <pre>
--   -- Avoid this:
--   unsafeInto @t "some literal"
--   
--   -- Prefer this:
--   $$(liftedInto @t "some literal")
--   </pre>
liftedInto :: forall target source (m :: Type -> Type). (TryFrom source target, Lift target, Show source, Typeable source, Typeable target, Quote m) => source -> Code m target

module Witch.Instances
realFloatToRational :: RealFloat s => s -> Either ArithException Rational
overPositive :: (Eq a, Num a, Num b) => (a -> b) -> a -> b
fromDigits :: [Int] -> Int -> (Integer, Integer)
makeRational :: Integer -> Integer -> Rational
fromNonNegativeIntegral :: (Integral s, Num t) => s -> Either ArithException t

-- | The maximum integral value that can be unambiguously represented as a
--   <a>Float</a>. Equal to 16,777,215.
maxFloat :: Num a => a

-- | The maximum integral value that can be unambiguously represented as a
--   <a>Double</a>. Equal to 9,007,199,254,740,991.
maxDouble :: Num a => a
tryEvaluate :: Exception e => a -> Either e a
instance Witch.From.From Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Internal.Type.ByteString
instance Witch.From.From Data.ByteString.Lazy.Internal.ByteString [GHC.Internal.Word.Word8]
instance Witch.From.From Data.ByteString.Internal.Type.ByteString Data.ByteString.Lazy.Internal.ByteString
instance Witch.From.From Data.ByteString.Internal.Type.ByteString [GHC.Internal.Word.Word8]
instance Witch.From.From Data.ByteString.Internal.Type.ByteString Data.ByteString.Short.Internal.ShortByteString
instance Witch.From.From Data.Time.Calendar.CalendarDiffDays.CalendarDiffDays Data.Time.LocalTime.Internal.CalendarDiffTime.CalendarDiffTime
instance Witch.From.From Data.Time.Calendar.Days.Day Data.Time.Calendar.Week.DayOfWeek
instance Witch.From.From Data.Time.Calendar.Days.Day GHC.Num.Integer.Integer
instance Witch.From.From Data.Time.Clock.Internal.DiffTime.DiffTime Data.Fixed.Pico
instance Witch.From.From Data.Time.Clock.Internal.DiffTime.DiffTime Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance Witch.From.From GHC.Types.Double GHC.Types.Float
instance Witch.From.From Data.Fixed.Pico Data.Time.Clock.Internal.DiffTime.DiffTime
instance Witch.From.From Data.Fixed.Pico Data.Time.Clock.Internal.NominalDiffTime.NominalDiffTime
instance forall k (a :: k). Data.Fixed.HasResolution a => Witch.From.From (Data.Fixed.Fixed a) GHC.Internal.Real.Rational
instance Witch.From.From GHC.Types.Float GHC.Types.Double
instance Witch.From.From GHC.Internal.Int.Int16 GHC.Types.Double
instance Witch.From.From GHC.Internal.Int.Int16 GHC.Types.Float
instance Witch.From.From GHC.Internal.Int.Int16 GHC.Types.Int
instance Witch.From.From GHC.Internal.Int.Int16 GHC.Internal.Int.Int32
instance Witch.From.From GHC.Internal.Int.Int16 GHC.Internal.Int.Int64
instance Witch.From.From GHC.Internal.Int.Int16 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Int.Int32 GHC.Types.Double
instance Witch.From.From GHC.Internal.Int.Int32 GHC.Internal.Int.Int64
instance Witch.From.From GHC.Internal.Int.Int32 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Int.Int64 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Types.Double
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Types.Float
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Types.Int
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Internal.Int.Int16
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Internal.Int.Int32
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Internal.Int.Int64
instance Witch.From.From GHC.Internal.Int.Int8 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Types.Int GHC.Internal.Int.Int64
instance Witch.From.From GHC.Types.Int GHC.Num.Integer.Integer
instance Witch.From.From (Data.IntMap.Internal.IntMap v) [(GHC.Types.Int, v)]
instance Witch.From.From Data.IntSet.Internal.IntSet [GHC.Types.Int]
instance Witch.From.From GHC.Num.Integer.Integer Data.Time.Calendar.Days.Day
instance forall k (a :: k). Data.Fixed.HasResolution a => Witch.From.From GHC.Num.Integer.Integer (Data.Fixed.Fixed a)
instance Witch.From.From [GHC.Internal.Word.Word8] Data.ByteString.Lazy.Internal.ByteString
instance Witch.From.From [GHC.Internal.Word.Word8] Data.ByteString.Internal.Type.ByteString
instance Witch.From.From [(GHC.Types.Int, v)] (Data.IntMap.Internal.IntMap v)
instance Witch.From.From [GHC.Types.Int] Data.IntSet.Internal.IntSet
instance GHC.Classes.Ord k => Witch.From.From [(k, v)] (Data.Map.Internal.Map k v)
instance Witch.From.From [a] (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord a => Witch.From.From [a] (Data.Set.Internal.Set a)
instance Witch.From.From [GHC.Internal.Word.Word8] Data.ByteString.Short.Internal.ShortByteString
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf8S
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf8L
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf16LS
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf16LL
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf16BS
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf16BL
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf32LS
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf32LL
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf32BS
instance Witch.From.From GHC.Internal.Base.String Witch.Encoding.Utf32BL
instance Witch.From.From GHC.Internal.Base.String Data.Text.Internal.Lazy.Text
instance Witch.From.From GHC.Internal.Base.String Data.Text.Internal.Text
instance Witch.From.From (Data.Map.Internal.Map k v) [(k, v)]
instance Witch.From.From GHC.Num.Natural.Natural GHC.Num.Integer.Integer
instance Witch.From.From Data.Time.Clock.Internal.NominalDiffTime.NominalDiffTime Data.Time.LocalTime.Internal.CalendarDiffTime.CalendarDiffTime
instance Witch.From.From Data.Time.Clock.Internal.NominalDiffTime.NominalDiffTime Data.Fixed.Pico
instance Witch.From.From Data.Time.Clock.Internal.POSIXTime.POSIXTime Data.Time.Clock.Internal.UTCTime.UTCTime
instance Witch.From.From (GHC.Internal.Base.NonEmpty a) [a]
instance Witch.From.From GHC.Internal.Real.Rational GHC.Types.Double
instance Witch.From.From GHC.Internal.Real.Rational GHC.Types.Float
instance Witch.From.From GHC.Internal.Real.Rational Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance Witch.From.From GHC.Internal.Real.Rational Data.Time.Clock.Internal.UniversalTime.UniversalTime
instance Witch.From.From (Data.Sequence.Internal.Seq a) [a]
instance Witch.From.From (Data.Set.Internal.Set a) [a]
instance Witch.From.From Data.ByteString.Short.Internal.ShortByteString Data.ByteString.Internal.Type.ByteString
instance Witch.From.From Data.ByteString.Short.Internal.ShortByteString [GHC.Internal.Word.Word8]
instance Witch.From.From Data.Time.Clock.Internal.SystemTime.SystemTime Data.Time.Clock.Internal.AbsoluteTime.AbsoluteTime
instance Witch.From.From Data.Time.Clock.Internal.SystemTime.SystemTime Data.Time.Clock.Internal.POSIXTime.POSIXTime
instance Witch.From.From Data.Time.Clock.Internal.SystemTime.SystemTime Data.Time.Clock.Internal.UTCTime.UTCTime
instance Witch.From.From Witch.Encoding.Latin1S GHC.Internal.Base.String
instance Witch.From.From Witch.Encoding.Latin1L GHC.Internal.Base.String
instance forall k1 k2 (t :: k1) a (u :: k2). Witch.From.From (Data.Tagged.Tagged t a) (Data.Tagged.Tagged u a)
instance Witch.From.From Witch.Encoding.Latin1S Data.Text.Internal.Lazy.Text
instance Witch.From.From Witch.Encoding.Latin1L Data.Text.Internal.Lazy.Text
instance Witch.From.From Witch.Encoding.Latin1S Data.Text.Internal.Text
instance Witch.From.From Witch.Encoding.Latin1L Data.Text.Internal.Text
instance forall k (t :: k) a. Witch.From.From (Data.Tagged.Tagged t a) a
instance Witch.From.From Data.Text.Internal.Lazy.Text GHC.Internal.Base.String
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf16BL
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf16BS
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf32LL
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf32LS
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf8L
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf8S
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf16LL
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf16LS
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf32BL
instance Witch.From.From Data.Text.Internal.Lazy.Text Witch.Encoding.Utf32BS
instance Witch.From.From Data.Text.Internal.Lazy.Text Data.Text.Internal.Text
instance Witch.From.From Data.Text.Internal.Text GHC.Internal.Base.String
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf16BL
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf32LS
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf32LL
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf32BS
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf8S
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf8L
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf16LS
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf16LL
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf16BS
instance Witch.From.From Data.Text.Internal.Text Witch.Encoding.Utf32BL
instance Witch.From.From Data.Text.Internal.Text Data.Text.Internal.Lazy.Text
instance Witch.From.From Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay Data.Time.Clock.Internal.DiffTime.DiffTime
instance Witch.From.From Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay GHC.Internal.Real.Rational
instance Witch.From.From (Witch.TryFromException.TryFromException source oldTarget) (Witch.TryFromException.TryFromException source newTarget)
instance Witch.From.From Data.Time.Clock.Internal.UTCTime.UTCTime Data.Time.Clock.Internal.POSIXTime.POSIXTime
instance Witch.From.From Data.Time.Clock.Internal.UTCTime.UTCTime Data.Time.Clock.Internal.SystemTime.SystemTime
instance Witch.From.From Data.Time.Clock.Internal.UniversalTime.UniversalTime GHC.Internal.Real.Rational
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Types.Double
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Types.Float
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Types.Int
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Internal.Int.Int32
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Internal.Int.Int64
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Num.Natural.Natural
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Types.Word
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Internal.Word.Word32
instance Witch.From.From GHC.Internal.Word.Word16 GHC.Internal.Word.Word64
instance Witch.From.From GHC.Internal.Word.Word32 GHC.Types.Double
instance Witch.From.From GHC.Internal.Word.Word32 GHC.Internal.Int.Int64
instance Witch.From.From GHC.Internal.Word.Word32 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Word.Word32 GHC.Num.Natural.Natural
instance Witch.From.From GHC.Internal.Word.Word32 GHC.Internal.Word.Word64
instance Witch.From.From GHC.Internal.Word.Word64 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Word.Word64 GHC.Num.Natural.Natural
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Types.Double
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Types.Float
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Types.Int
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Internal.Int.Int16
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Internal.Int.Int32
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Internal.Int.Int64
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Num.Integer.Integer
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Num.Natural.Natural
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Types.Word
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Internal.Word.Word16
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Internal.Word.Word32
instance Witch.From.From GHC.Internal.Word.Word8 GHC.Internal.Word.Word64
instance Witch.From.From GHC.Types.Word GHC.Num.Integer.Integer
instance Witch.From.From GHC.Types.Word GHC.Num.Natural.Natural
instance Witch.From.From GHC.Types.Word GHC.Internal.Word.Word64
instance Witch.From.From Data.Time.LocalTime.Internal.ZonedTime.ZonedTime Data.Time.Clock.Internal.UTCTime.UTCTime
instance GHC.Internal.Num.Num a => Witch.From.From a (Data.Complex.Complex a)
instance GHC.Internal.Real.Integral a => Witch.From.From a (GHC.Internal.Real.Ratio a)
instance forall k a (t :: k). Witch.From.From a (Data.Tagged.Tagged t a)
instance Witch.From.From a a
instance (GHC.Classes.Eq a, GHC.Internal.Num.Num a) => Witch.TryFrom.TryFrom (Data.Complex.Complex a) a
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Int.Int64
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Num.Integer.Integer
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Real.Rational
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Types.Double GHC.Internal.Word.Word8
instance forall k1 k2 (s :: k1) (t :: k2). (Data.Fixed.HasResolution s, Data.Fixed.HasResolution t) => Witch.TryFrom.TryFrom (Data.Fixed.Fixed s) (Data.Fixed.Fixed t)
instance forall k (a :: k). Data.Fixed.HasResolution a => Witch.TryFrom.TryFrom (Data.Fixed.Fixed a) GHC.Num.Integer.Integer
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Int.Int64
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Num.Integer.Integer
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Real.Rational
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Types.Float GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int16 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int32 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Types.Double
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int64 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int8 GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int8 GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int8 GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int8 GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int8 GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Internal.Int.Int8 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Types.Double
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Types.Int GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Types.Double
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Int.Int64
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Num.Natural.Natural
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Num.Integer.Integer GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom [a] (GHC.Internal.Base.NonEmpty a)
instance Witch.TryFrom.TryFrom GHC.Internal.Base.String Witch.Encoding.Latin1S
instance Witch.TryFrom.TryFrom GHC.Internal.Base.String Witch.Encoding.Latin1L
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Types.Double
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Int.Int64
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Word.Word64
instance Witch.TryFrom.TryFrom GHC.Num.Natural.Natural GHC.Internal.Word.Word8
instance forall k (a :: k). Data.Fixed.HasResolution a => Witch.TryFrom.TryFrom GHC.Internal.Real.Rational (Data.Fixed.Fixed a)
instance (GHC.Classes.Eq a, GHC.Internal.Num.Num a) => Witch.TryFrom.TryFrom (GHC.Internal.Real.Ratio a) a
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf8S GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf8L GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16LS GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16LL GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16BS GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16BL GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32LS GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32LL GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32BS GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32BL GHC.Internal.Base.String
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16BL Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32LS Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32LL Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32BS Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf8S Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf8L Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16LS Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16LL Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16BS Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32BL Data.Text.Internal.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16BS Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16BL Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32LS Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32LL Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf8S Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf8L Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16LS Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf16LL Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32BS Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Witch.Encoding.Utf32BL Data.Text.Internal.Lazy.Text
instance Witch.TryFrom.TryFrom Data.Text.Internal.Lazy.Text Witch.Encoding.Latin1L
instance Witch.TryFrom.TryFrom Data.Text.Internal.Lazy.Text Witch.Encoding.Latin1S
instance Witch.TryFrom.TryFrom Data.Text.Internal.Text Witch.Encoding.Latin1S
instance Witch.TryFrom.TryFrom Data.Text.Internal.Text Witch.Encoding.Latin1L
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word16 GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word16 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word16 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word32 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Types.Double
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Int.Int64
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Types.Word
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word64 GHC.Internal.Word.Word8
instance Witch.TryFrom.TryFrom GHC.Internal.Word.Word8 GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Types.Double
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Types.Float
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Types.Int
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Int.Int16
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Int.Int32
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Int.Int64
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Int.Int8
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Word.Word16
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Word.Word32
instance Witch.TryFrom.TryFrom GHC.Types.Word GHC.Internal.Word.Word8


-- | The Witch package is a library that allows you to confidently convert
--   values between various types. This module exports everything you need
--   to perform conversions or define your own. It is designed to be
--   imported unqualified, so getting started is as easy as:
--   
--   <pre>
--   &gt;&gt;&gt; import Witch
--   </pre>
--   
--   In typical usage, the functions that you will use most often are
--   <a>into</a> for conversions that always succeed and <a>tryInto</a> for
--   conversions that sometimes fail.
--   
--   Please consider reading the blog post that announces this library:
--   <a>https://taylor.fausak.me/2021/07/13/witch/</a>
module Witch

-- | This type class is for converting values from some <tt>source</tt>
--   type into some other <tt>target</tt> type. The constraint
--   <tt><a>From</a> source target</tt> means that you can convert from a
--   value of type <tt>source</tt> into a value of type <tt>target</tt>.
--   
--   This type class is for conversions that always succeed. If your
--   conversion sometimes fails, consider implementing <tt>TryFrom</tt>
--   instead.
class From source target

-- | This method implements the conversion of a value between types. At
--   call sites you may prefer to use <tt>into</tt> instead.
--   
--   <pre>
--   -- Avoid this:
--   from (x :: s)
--   
--   -- Prefer this (using [@TypeApplications@](https://downloads.haskell.org/ghc/9.6.1/docs/users_guide/exts/type_applications.html) language extension):
--   from @s x
--   </pre>
--   
--   The default implementation of this method simply calls <a>coerce</a>,
--   which works for types that have the same runtime representation. This
--   means that for <tt>newtype</tt>s you do not need to implement this
--   method at all. For example:
--   
--   <pre>
--   &gt;&gt;&gt; newtype Name = Name String
--   
--   &gt;&gt;&gt; instance From Name String
--   
--   &gt;&gt;&gt; instance From String Name
--   </pre>
from :: From source target => source -> target
($dmfrom) :: (From source target, Coercible source target) => source -> target

-- | This is the same as <a>from</a> except that the type variables are in
--   the opposite order.
--   
--   <pre>
--   -- Avoid this:
--   from x :: t
--   
--   -- Prefer this:
--   into @t x
--   </pre>
into :: forall target source. From source target => source -> target

-- | This type class is for converting values from some <tt>source</tt>
--   type into some other <tt>target</tt> type. The constraint
--   <tt><a>TryFrom</a> source target</tt> means that you may be able to
--   convert from a value of type <tt>source</tt> into a value of type
--   <tt>target</tt>, but that conversion may fail at runtime.
--   
--   This type class is for conversions that can sometimes fail. If your
--   conversion always succeeds, consider implementing <tt>From</tt>
--   instead.
class TryFrom source target

-- | This method implements the conversion of a value between types. At
--   call sites you may want to use <tt>tryInto</tt> instead.
--   
--   <pre>
--   -- Avoid this:
--   tryFrom (x :: s)
--   
--   -- Prefer this:
--   tryFrom @s
--   </pre>
--   
--   Consider using <tt>maybeTryFrom</tt> or <tt>eitherTryFrom</tt> to
--   implement this method.
tryFrom :: TryFrom source target => source -> Either (TryFromException source target) target

-- | This is the same as <a>tryFrom</a> except that the type variables are
--   in the opposite order.
--   
--   <pre>
--   -- Avoid this:
--   tryFrom x :: Either (TryFromException s t) t
--   
--   -- Prefer this:
--   tryInto @t x
--   </pre>
tryInto :: forall target source. TryFrom source target => source -> Either (TryFromException source target) target

-- | This exception is thrown when a <tt>TryFrom</tt> conversion fails. It
--   has the original <tt>source</tt> value that caused the failure and it
--   knows the <tt>target</tt> type it was trying to convert into. It also
--   has an optional <a>SomeException</a> for communicating what went wrong
--   while converting.
data TryFromException source target
TryFromException :: source -> Maybe SomeException -> TryFromException source target

-- | The <a>ISO_8859_1</a> encoding for strict <a>ByteString</a>s.
type Latin1S = ISO_8859_1 ByteString

-- | The <a>ISO_8859_1</a> encoding for lazy <a>ByteString</a>s.
type Latin1L = ISO_8859_1 ByteString

-- | <a>https://en.wikipedia.org/wiki/ISO/IEC_8859-1</a>
type ISO_8859_1 = Tagged "ISO-8859-1"

-- | The <a>UTF_8</a> encoding for strict <a>ByteString</a>s.
type Utf8S = UTF_8 ByteString

-- | The <a>UTF_8</a> encoding for lazy <a>ByteString</a>s.
type Utf8L = UTF_8 ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-8</a>
type UTF_8 = Tagged "UTF-8"

-- | The <a>UTF_16LE</a> encoding for strict <a>ByteString</a>s.
type Utf16LS = UTF_16LE ByteString

-- | The <a>UTF_16LE</a> encoding for lazy <a>ByteString</a>s.
type Utf16LL = UTF_16LE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-16</a>
type UTF_16LE = Tagged "UTF-16LE"

-- | The <a>UTF_16BE</a> encoding for strict <a>ByteString</a>s.
type Utf16BS = UTF_16BE ByteString

-- | The <a>UTF_16BE</a> encoding for lazy <a>ByteString</a>s.
type Utf16BL = UTF_16BE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-16</a>
type UTF_16BE = Tagged "UTF-16BE"

-- | The <a>UTF_32LE</a> encoding for strict <a>ByteString</a>s.
type Utf32LS = UTF_32LE ByteString

-- | The <a>UTF_32LE</a> encoding for lazy <a>ByteString</a>s.
type Utf32LL = UTF_32LE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-32</a>
type UTF_32LE = Tagged "UTF-32LE"

-- | The <a>UTF_32BE</a> encoding for strict <a>ByteString</a>s.
type Utf32BS = UTF_32BE ByteString

-- | The <a>UTF_32BE</a> encoding for lazy <a>ByteString</a>s.
type Utf32BL = UTF_32BE ByteString

-- | <a>https://en.wikipedia.org/wiki/UTF-32</a>
type UTF_32BE = Tagged "UTF-32BE"

-- | This function first converts from some <tt>source</tt> type into some
--   <tt>through</tt> type, and then converts that into some
--   <tt>target</tt> type. Usually this is used when writing <a>From</a>
--   instances. Sometimes this can be used to work around the lack of an
--   instance that should probably exist.
--   
--   <pre>
--   -- Avoid this:
--   from @u . into @u
--   
--   -- Prefer this:
--   via @u
--   </pre>
via :: forall through source target. (From source through, From through target) => source -> target

-- | This is similar to <a>via</a> except that it works with <a>TryFrom</a>
--   instances instead. This function is especially convenient because
--   juggling the types in the <a>TryFromException</a> can be tedious.
--   
--   <pre>
--   -- Avoid this:
--   case tryInto @u x of
--     Left (TryFromException _ e) -&gt; Left $ TryFromException x e
--     Right y -&gt; case tryFrom @u y of
--       Left (TryFromException _ e) -&gt; Left $ TryFromException x e
--       Right z -&gt; Right z
--   
--   -- Prefer this:
--   tryVia @u
--   </pre>
tryVia :: forall through source target. (TryFrom source through, TryFrom through target) => source -> Either (TryFromException source target) target

-- | This function can be used to implement <a>tryFrom</a> with a function
--   that returns <a>Maybe</a>. For example:
--   
--   <pre>
--   -- Avoid this:
--   tryFrom s = case f s of
--     Nothing -&gt; Left $ TryFromException s Nothing
--     Just t -&gt; Right t
--   
--   -- Prefer this:
--   tryFrom = maybeTryFrom f
--   </pre>
maybeTryFrom :: (source -> Maybe target) -> source -> Either (TryFromException source target) target

-- | This function can be used to implement <a>tryFrom</a> with a function
--   that returns <a>Either</a>. For example:
--   
--   <pre>
--   -- Avoid this:
--   tryFrom s = case f s of
--     Left e -&gt; Left . TryFromException s . Just $ toException e
--     Right t -&gt; Right t
--   
--   -- Prefer this:
--   tryFrom = eitherTryFrom f
--   </pre>
eitherTryFrom :: Exception exception => (source -> Either exception target) -> source -> Either (TryFromException source target) target

-- | This function is like <a>tryFrom</a> except that it will throw an
--   impure exception if the conversion fails.
--   
--   <pre>
--   -- Avoid this:
--   either throw id . tryFrom @s
--   
--   -- Prefer this:
--   unsafeFrom @s
--   </pre>
unsafeFrom :: (HasCallStack, TryFrom source target, Show source, Typeable source, Typeable target) => source -> target

-- | This function is like <a>tryInto</a> except that it will throw an
--   impure exception if the conversion fails.
--   
--   <pre>
--   -- Avoid this:
--   either throw id . tryInto @t
--   
--   -- Prefer this:
--   unsafeInto @t
--   </pre>
unsafeInto :: forall target source. (HasCallStack, TryFrom source target, Show source, Typeable source, Typeable target) => source -> target

-- | This is like <a>unsafeFrom</a> except that it works at compile time
--   rather than runtime.
--   
--   <pre>
--   -- Avoid this:
--   unsafeFrom @s "some literal"
--   
--   -- Prefer this:
--   $$(liftedFrom @s "some literal")
--   </pre>
liftedFrom :: forall source target (m :: Type -> Type). (TryFrom source target, Lift target, Show source, Typeable source, Typeable target, Quote m) => source -> Code m target

-- | This is like <a>unsafeInto</a> except that it works at compile time
--   rather than runtime.
--   
--   <pre>
--   -- Avoid this:
--   unsafeInto @t "some literal"
--   
--   -- Prefer this:
--   $$(liftedInto @t "some literal")
--   </pre>
liftedInto :: forall target source (m :: Type -> Type). (TryFrom source target, Lift target, Show source, Typeable source, Typeable target, Quote m) => source -> Code m target
