Portability | non-portable (exceptions) |
---|---|
Stability | experimental |
Maintainer | http://www.cs.nott.ac.uk/~nad/ |
- isBottom :: a -> Bool
- bottom :: a
- nonBottomError :: String -> a
- isBottomTimeOut :: Maybe Int -> a -> Bool
Documentation
returns isBottom
aFalse
if a
is distinct from bottom. If
a
equals bottom and results in an exception of a certain kind
(see below), then
. If isBottom
a = True
a
never reaches a
weak head normal form and never throws one of these exceptions,
then
never terminates.
isBottom
a
The exceptions that yield True
correspond to "pure bottoms",
i.e. bottoms that can originate in pure code:
-
ArrayException
-
ErrorCall
-
NoMethodError
-
NonTermination
-
PatternMatchFail
-
RecConError
-
RecSelError
-
RecUpdError
Assertions are excluded, because their behaviour depends on
compiler flags (not pure, and a failed assertion should really
yield an exception and nothing else). The same applies to
arithmetic exceptions (machine dependent, except possibly for
DivideByZero
, but the value infinity makes that case unclear as
well).
nonBottomError :: String -> aSource
raises an exception (nonBottomError
sAssertionFailed
)
that is not caught by isBottom
. Use s
to describe the
exception.
isBottomTimeOut :: Maybe Int -> a -> BoolSource
works like isBottomTimeOut
timeOutLimitisBottom
, but if
timeOutLimit
is
, then computations taking more than
Just
limlim
seconds are also considered to be equal to bottom. Note that
this is a very crude approximation of what a bottom is. Also note
that this "function" may return different answers upon different
invocations. Take it for what it is worth.
isBottomTimeOut
is subject to all the same vagaries as
timeOut
.