ChasingBottoms-1.2.2: For testing partial and infinite values.Source codeContentsIndex
Test.ChasingBottoms.IsBottom
Portabilitynon-portable (exceptions)
Stabilityexperimental
Maintainerhttp://www.cs.chalmers.se/~nad/
Description
Synopsis
isBottom :: a -> Bool
bottom :: a
nonBottomError :: String -> a
isBottomTimeOut :: Maybe Int -> a -> Bool
Documentation
isBottom :: a -> BoolSource

isBottom a returns False if a is distinct from bottom. If a equals bottom and results in an exception which is caught by isBottom, and this exception is of a certain kind (see below), then isBottom a = True. Other caught exceptions are re-thrown. If a never reaches a weak head normal form and never throws an exception, then isBottom a never terminates.

The exceptions that yield True are those that correspond to "pure bottoms", i.e. bottoms that can originate in pure code. Assertions are excluded, since 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 Control.Exception.DivideByZero, but the value infinity makes that case unclear as well).

bottom :: aSource
bottom generates a bottom that is suitable for testing using isBottom.
nonBottomError :: String -> aSource
nonBottomError s raises an exception (AssertionFailed) that is not caught by isBottom. Use s to describe the exception.
isBottomTimeOut :: Maybe Int -> a -> BoolSource

isBottomTimeOut timeOutLimit works like isBottom, but if timeOutLimit is Just lim, then computations taking more than lim 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 scheduling vagaries as Test.ChasingBottoms.TimeOut.timeOut.

Produced by Haddock version 2.4.2