{-# LANGUAGE NoImplicitPrelude #-}

-- |
-- Module      : OAlg.Structure.Exception
-- Description : arithmetic exceptions
-- Copyright   : (c) Erich Gut
-- License     : BSD3
-- Maintainer  : zerich.gut@gmail.com
--
-- arithmetic exceptions.
module OAlg.Structure.Exception
  ( ArithmeticException(..)
  )
  where

import OAlg.Prelude


--------------------------------------------------------------------------------
-- ArithmeticException -

-- | arithmetic exceptions which are sub exceptions of 'SomeOAlgException'.
data ArithmeticException
  = NotAddable
  | NotMultiplicable
  | NotInvertible
  | UndefinedScalarproduct
  | NotExponential
  | NotEndo
  | NotTransformable
  | NoMinusOne
  | NotApplicable
  deriving (ArithmeticException -> ArithmeticException -> Bool
(ArithmeticException -> ArithmeticException -> Bool)
-> (ArithmeticException -> ArithmeticException -> Bool)
-> Eq ArithmeticException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ArithmeticException -> ArithmeticException -> Bool
== :: ArithmeticException -> ArithmeticException -> Bool
$c/= :: ArithmeticException -> ArithmeticException -> Bool
/= :: ArithmeticException -> ArithmeticException -> Bool
Eq,Int -> ArithmeticException -> ShowS
[ArithmeticException] -> ShowS
ArithmeticException -> String
(Int -> ArithmeticException -> ShowS)
-> (ArithmeticException -> String)
-> ([ArithmeticException] -> ShowS)
-> Show ArithmeticException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ArithmeticException -> ShowS
showsPrec :: Int -> ArithmeticException -> ShowS
$cshow :: ArithmeticException -> String
show :: ArithmeticException -> String
$cshowList :: [ArithmeticException] -> ShowS
showList :: [ArithmeticException] -> ShowS
Show)

instance Exception ArithmeticException where
  toException :: ArithmeticException -> SomeException
toException   = ArithmeticException -> SomeException
forall e. Exception e => e -> SomeException
oalgExceptionToException
  fromException :: SomeException -> Maybe ArithmeticException
fromException = SomeException -> Maybe ArithmeticException
forall e. Exception e => SomeException -> Maybe e
oalgExceptionFromException