sdp-0.2.1.1: Simple Data Processing
Copyright(c) Andrey Mulik 2019-2021
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Control.Exception.SDP

Description

Control.Exception.SDP - service module that provide some useful exceptions. Note that SDP.SafePrelude doesn't export this module.

Synopsis

Exports

Exceptions

data UnreachableException Source #

A UnreachableException is used as an exception that should never be thrown.

Example: newArray# requires a default value to fill the newly created array. If the array is guaranteed to be filled with values (for example, in the replicate function), then this value will never be needed and, therefore, calculated. UnreachableException in this case will be a marker of unreachability of this expression.

data IndexException Source #

IndexException replaces the less informative ArrayException and has more neutral names.

  • UnacceptableExpansion - occurs when performing the (safe) rebound operation with unacceptable target range (example: an attempt to convert structure with bounds (2, 5) to structure with bounds ('\0', '\255') is invalid because available size is smaller than required)
  • UnexpectedRank - occurs when trying to convert one representation of an index to another, if their dimensions doesn't match (example: trying to convert a list [1, 2, 3] of type [Int] to an index of type (T4 Int))
  • UndefinedValue - occurs when referring to a non-existent or undefined element; some unsafe structures and operations can lead to the possibility of untracked reading of invalid or undefined values
  • EmptyRange - occurs when accessing the contents of an empty structure
  • IndexOverflow - occurs when going beyond the upper boundary of the structure (overflow)
  • IndexUnderflow - occurs when going beyond the lower boundary of the structure (underflow)

If the error type may depend on the check order, it should be indicated in the documentation. For example: overflow is checked first, and then underflow. But if an overflow is detected, underflow may not be noticed. IndexException constructor order is the recommended order.