Haskellのthrowできる例外型と値コンストラクタ一覧
この記事の対象
 Control.Exceptionで定義されている例外型で、自分でもthrowできそうなもの。
例えばIOExceptionは値構築子(値コンストラクタ)が公開されていなさそうなので、一覧に含めない。
catchのためではなく、throwのための型をまとめる。
(規定の一般的な、より多くの例外型を見たければ上記のControl.Exceptionモジュールのページを見ればよい )
☆
現代のHaskellではControl.Exceptionよりも一般化されたモジュールであるControl.Monad.Catch
を利用することが一般的である(らしい)が、今回紹介する型はそちら側もだいたいインスタンス化されているため考えない。
(Re-exports from Control.Exceptionの章を参照)
例外型一覧
以下、いくらか定義の簡略で表記する。
この簡略はthrowする分には問題ないよ :D
data ArithException = Overflow
                    | Underflow
                    | LossOfPrecision
                    | DivideByZero
                    | Denormal
                    | RatioZeroDenominator
data ArrayException = IndexOutOfBounds String
                    | UndefinedElement String
newtype AssertionFailed = AssertionFailed String
data AsyncException = StackOverflow
                    | HeapOverflow
                    | ThreadKilled
                    | UserInterrupt
data NonTermination = NonTermination
data NestedAtomically = NestedAtomically
data BlockedIndefinitelyOnMVar = BlockedIndefinitelyOnMVar
data BlockedIndefinitelyOnSTM = BlockedIndefinitelyOnSTM
data AllocationLimitExceeded = AllocationLimitExceeded
data Deadlock = Deadlock
newtype NoMethodError = NoMethodError
newtype PatternMatchFail = PatternMatchFail String
newtype RecConError = RecConError String
newtype RecSelError = RecSelError String
newtype RecUpdError = RecUpdError
data ErrorCall = ErrorCallWithLocation String String
newtype TypeError = TypeError String