ChasingBottoms-1.2.2: docs/Test-ChasingBottoms-IsBottom.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Test.ChasingBottoms.IsBottom</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock.js" TYPE="text/javascript"
></SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>Chasing Bottoms</TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Test.ChasingBottoms.IsBottom</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>non-portable (exceptions)</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>experimental</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>http://www.cs.chalmers.se/~nad/</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3AisBottom"
>isBottom</A
> :: a -> <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Abottom"
>bottom</A
> :: a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AnonBottomError"
>nonBottomError</A
> :: <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Char.html#t%3AString"
>String</A
> -> a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AisBottomTimeOut"
>isBottomTimeOut</A
> :: <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Maybe.html#t%3AMaybe"
>Maybe</A
> <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Int.html#t%3AInt"
>Int</A
> -> a -> <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AisBottom"
></A
><B
>isBottom</B
> :: a -> <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
><TR
><TD CLASS="doc"
><P
><TT
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
> a</TT
> returns <TT
><A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#v%3AFalse"
>False</A
></TT
> if <TT
>a</TT
> is distinct from bottom. If
<TT
>a</TT
> equals bottom and results in an exception which is caught by
<TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
>, and this exception is of a certain kind (see below),
then <TT
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
> a = <TT
><A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#v%3ATrue"
>True</A
></TT
></TT
>. Other caught exceptions are
re-thrown. If <TT
>a</TT
> never reaches a weak head normal form and
never throws an exception, then <TT
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
> a</TT
> never terminates.
</P
><P
>The exceptions that yield <TT
><A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#v%3ATrue"
>True</A
></TT
> 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
<TT
><A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Control-Exception.html#t%3ADivideByZero"
>DivideByZero</A
></TT
>, but the value infinity makes that
case unclear as well).
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Abottom"
></A
><B
>bottom</B
> :: a</TD
></TR
><TR
><TD CLASS="doc"
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3Abottom"
>bottom</A
></TT
> generates a bottom that is suitable for testing using
<TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AnonBottomError"
></A
><B
>nonBottomError</B
> :: <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Char.html#t%3AString"
>String</A
> -> a</TD
></TR
><TR
><TD CLASS="doc"
><TT
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AnonBottomError"
>nonBottomError</A
></TT
> s</TT
> raises an exception (<TT
><A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Control-Exception.html#v%3AAssertionFailed"
>AssertionFailed</A
></TT
>) that
is not caught by <TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
>. Use <TT
>s</TT
> to describe the exception.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AisBottomTimeOut"
></A
><B
>isBottomTimeOut</B
> :: <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Maybe.html#t%3AMaybe"
>Maybe</A
> <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Int.html#t%3AInt"
>Int</A
> -> a -> <A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
><TR
><TD CLASS="doc"
><P
><TT
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottomTimeOut"
>isBottomTimeOut</A
></TT
> timeOutLimit</TT
> works like <TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottom"
>isBottom</A
></TT
>, but if
<TT
>timeOutLimit</TT
> is <TT
><TT
><A HREF="http://www.haskell.org/ghc/docs/latest/html/libraries/base-3.0.0.0/Data-Maybe.html#v%3AJust"
>Just</A
></TT
> lim</TT
>, then computations taking more than
<TT
>lim</TT
> 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.
</P
><P
><TT
><A HREF="Test-ChasingBottoms-IsBottom.html#v%3AisBottomTimeOut"
>isBottomTimeOut</A
></TT
> is subject to all the same scheduling vagaries as
<TT
><A HREF="Test-ChasingBottoms-TimeOut.html#v%3AtimeOut"
>timeOut</A
></TT
>.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 0.7</TD
></TR
></TABLE
></BODY
></HTML
>