-- | Error types for fallible numeric conversions.
module Unwitch.Errors
  ( Overflows(..)
  )
where

-- | Indicates that a numeric conversion failed because the source
-- value is outside the representable range of the target type.
data Overflows
  = Overflow   -- ^ The source value is above the target's upper bound.
  | Underflow  -- ^ The source value is below the target's lower bound.
  deriving (Int -> Overflows -> ShowS
[Overflows] -> ShowS
Overflows -> String
(Int -> Overflows -> ShowS)
-> (Overflows -> String)
-> ([Overflows] -> ShowS)
-> Show Overflows
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Overflows -> ShowS
showsPrec :: Int -> Overflows -> ShowS
$cshow :: Overflows -> String
show :: Overflows -> String
$cshowList :: [Overflows] -> ShowS
showList :: [Overflows] -> ShowS
Show, Overflows -> Overflows -> Bool
(Overflows -> Overflows -> Bool)
-> (Overflows -> Overflows -> Bool) -> Eq Overflows
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Overflows -> Overflows -> Bool
== :: Overflows -> Overflows -> Bool
$c/= :: Overflows -> Overflows -> Bool
/= :: Overflows -> Overflows -> Bool
Eq)