{-# 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 from 'SomeOAlgException'.
data ArithmeticException
  = NotAddable
  | NotMultiplicable
  | NotInvertible
  | UndefinedScalarproduct
  | NotExponential
  | NotEndo
  | NotTransformable
  | NoMinusOne
  | NotApplicable
  deriving (ArithmeticException -> ArithmeticException -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArithmeticException -> ArithmeticException -> Bool
$c/= :: ArithmeticException -> ArithmeticException -> Bool
== :: ArithmeticException -> ArithmeticException -> Bool
$c== :: ArithmeticException -> ArithmeticException -> Bool
Eq,Int -> ArithmeticException -> ShowS
[ArithmeticException] -> ShowS
ArithmeticException -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArithmeticException] -> ShowS
$cshowList :: [ArithmeticException] -> ShowS
show :: ArithmeticException -> String
$cshow :: ArithmeticException -> String
showsPrec :: Int -> ArithmeticException -> ShowS
$cshowsPrec :: Int -> ArithmeticException -> ShowS
Show)

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