Copyright | (c) Nils Anders Danielsson 2004-2021 |
---|---|
License | See the file LICENCE. |
Maintainer | http://www.cse.chalmers.se/~nad/ |
Stability | experimental |
Portability | non-portable (exceptions) |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- isBottom :: a -> Bool
- isBottomIO :: a -> IO Bool
- bottom :: a
- nonBottomError :: String -> a
- isBottomTimeOut :: Maybe Int -> a -> Bool
- isBottomTimeOutIO :: Maybe Int -> a -> IO Bool
Documentation
isBottom :: a -> Bool Source #
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:
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 -> a Source #
raises an exception (nonBottomError
sAssertionFailed
)
that is not caught by isBottom
. Use s
to describe the
exception.
isBottomTimeOut :: Maybe Int -> a -> Bool Source #
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
.
isBottomTimeOutIO :: Maybe Int -> a -> IO Bool Source #
A variant of isBottomTimeOut
that lives in the IO
monad.