ChasingBottoms-1.3.1.15: For testing partial and infinite values.
Copyright(c) Nils Anders Danielsson 2004-2022 2024
LicenseSee the file LICENCE.
Maintainerhttp://www.cse.chalmers.se/~nad/
Stabilityexperimental
Portabilitynon-portable (exceptions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.ChasingBottoms.IsBottom

Description

 
Synopsis

Documentation

isBottom :: a -> Bool Source #

isBottom a returns False if a is distinct from bottom. If a equals bottom and results in an exception of a certain kind (see below), then isBottom a = True. If a never reaches a weak head normal form and never throws one of these exceptions, then isBottom a never terminates.

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).

isBottomIO :: a -> IO Bool Source #

A variant of isBottom that lives in the IO monad.

bottom :: a Source #

bottom generates a bottom that is suitable for testing using isBottom.

nonBottomError :: String -> a Source #

nonBottomError s raises an exception (AssertionFailed) that is not caught by isBottom. Use s to describe the exception.

isBottomTimeOut :: Maybe Int -> a -> Bool Source #

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 vagaries as timeOut.

isBottomTimeOutIO :: Maybe Int -> a -> IO Bool Source #

A variant of isBottomTimeOut that lives in the IO monad.