<!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 >Data.Attempt</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Data-Attempt.html")};</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" >attempt-0.3.0: Concrete data type for handling extensible exceptions as failures.</TD ><TD CLASS="topbut" ><A HREF="src/Data-Attempt.html" >Source code</A ></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" >Data.Attempt</FONT ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Data type and type class </A ></DT ><DT ><A HREF="#2" >General handling of <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >s </A ></DT ><DT ><A HREF="#3" >Individual <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >s </A ></DT ><DT ><A HREF="#4" >Lists of <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >s </A ></DT ><DT ><A HREF="#5" >Runtime exceptions </A ></DT ><DT ><A HREF="#6" >Reexport the <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT > class </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >A universal data type for computations which may fail. Errors are reported using extensible exceptions. These exceptions are not explicitly stated; if you want this kind of functionality, something like control-monad-exception might be a more appropriate fit. </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" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AAttempt" >Attempt</A > v </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" >= <A HREF="#v%3ASuccess" >Success</A > v</TD ></TR ><TR ><TD CLASS="decl" >| <SPAN CLASS="keyword" >forall</SPAN > e . <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => <A HREF="#v%3AFailure" >Failure</A > e</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > <A HREF="#t%3AFromAttempt" >FromAttempt</A > a <SPAN CLASS="keyword" >where</SPAN ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromAttempt" >fromAttempt</A > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> a v</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Afa" >fa</A > :: <A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > a => <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> a v</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AjoinAttempt" >joinAttempt</A > :: (<A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > m, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Monad.html#t%3AMonad" >Monad</A > m) => m (<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v) -> m v</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aattempt" >attempt</A > :: (<SPAN CLASS="keyword" >forall</SPAN > e. <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => e -> b) -> (a -> b) -> <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > a -> b</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmakeHandler" >makeHandler</A > :: [<A HREF="Data-Attempt.html#t%3AAttemptHandler" >AttemptHandler</A > v] -> v -> <SPAN CLASS="keyword" >forall</SPAN > e. <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => e -> v</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AAttemptHandler" >AttemptHandler</A > v = <SPAN CLASS="keyword" >forall</SPAN > e . <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => <A HREF="#v%3AAttemptHandler" >AttemptHandler</A > (e -> v)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisFailure" >isFailure</A > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisSuccess" >isSuccess</A > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromSuccess" >fromSuccess</A > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> v</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Asuccesses" >successes</A > :: [<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v] -> [v]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Afailures" >failures</A > :: [<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v] -> [<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3ASomeException" >SomeException</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ApartitionAttempts" >partitionAttempts</A > :: [<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v] -> ([<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3ASomeException" >SomeException</A >], [v])</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AattemptIO" >attemptIO</A > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > eIn, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > eOut) => (eIn -> eOut) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > v -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > (<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" >module <A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html" >Control.Failure</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Data type and type class </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:Attempt" ><A NAME="t%3AAttempt" ></A ></A ><B >Attempt</B > v </TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#Attempt" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >Contains either a <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT > value or a <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT > exception. </TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><A NAME="v:Success" ><A NAME="v%3ASuccess" ></A ></A ><B >Success</B > v</TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" ><SPAN CLASS="keyword" >forall</SPAN > e . <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => <A NAME="v:Failure" ><A NAME="v%3AFailure" ></A ></A ><B >Failure</B > e</TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Attempt')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Attempt" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Monad.html#t%3AMonad" >Monad</A > <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Monad.html#t%3AFunctor" >Functor</A > <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Typeable.html#t%3ATypeable1" >Typeable1</A > <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Applicative.html#t%3AApplicative" >Applicative</A > <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => <A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A > e <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => <A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AWrapFailure" >WrapFailure</A > e <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > v => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > (<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v)</TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >class</SPAN > <A NAME="t:FromAttempt" ><A NAME="t%3AFromAttempt" ></A ></A ><B >FromAttempt</B > a <SPAN CLASS="keyword" >where</SPAN ></TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#FromAttempt" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >Any type which can be converted from an <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >. The included instances are your "usual suspects" for dealing with error handling. They include: </P ><P ><TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A ></TT >: For the IO instance, any exceptions in the <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT > are thrown as runtime exceptions. </P ><P ><TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A ></TT >: Returns <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#v%3ANothing" >Nothing</A ></TT > on <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT >, or <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#v%3AJust" >Just</A ></TT > on <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT >. </P ><P >List: Returns the empty list on <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT >, or a singleton list on <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT >. </P ><P ><TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither" >Either</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TT >: Returns <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#v%3ALeft" >Left</A ></TT > (<TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#v%3Ashow" >show</A ></TT > exception) on <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT >, or <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#v%3ARight" >Right</A ></TT > on <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT >. </P ><P ><TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither" >Either</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A ></TT >: Returns <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#v%3ALeft" >Left</A ></TT > exception on <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT >, or <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#v%3ARight" >Right</A ></TT > on <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT >. </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" >Methods</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fromAttempt" ><A NAME="v%3AfromAttempt" ></A ></A ><B >fromAttempt</B > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> a v</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#fromAttempt" >Source</A ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:FromAttempt')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:FromAttempt" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > []</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither" >Either</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >)</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither" >Either</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3ASomeException" >SomeException</A >)</TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fa" ><A NAME="v%3Afa" ></A ></A ><B >fa</B > :: <A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > a => <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> a v</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#fa" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >A shortcut for <TT ><A HREF="Data-Attempt.html#v%3AfromAttempt" >fromAttempt</A ></TT >. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:joinAttempt" ><A NAME="v%3AjoinAttempt" ></A ></A ><B >joinAttempt</B > :: (<A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A > m, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Monad.html#t%3AMonad" >Monad</A > m) => m (<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v) -> m v</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#joinAttempt" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >This is not a simple translation of the Control.Monad.join function. Instead, for <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Monad.html#t%3AMonad" >Monad</A ></TT >s which are instances of <TT ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A ></TT >, it removes the inner <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT > type, reporting errors as defined in the <TT ><A HREF="Data-Attempt.html#t%3AFromAttempt" >FromAttempt</A ></TT > instance. </P ><P >For example, join (Just (failureString "foo")) == Nothing. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >General handling of <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >s </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:attempt" ><A NAME="v%3Aattempt" ></A ></A ><B >attempt</B ></TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#attempt" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="arg" >:: <SPAN CLASS="keyword" >forall</SPAN > e. <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => e -> b</TD ><TD CLASS="rdoc" >error handler </TD ></TR ><TR ><TD CLASS="arg" >-> a -> b</TD ><TD CLASS="rdoc" >success handler </TD ></TR ><TR ><TD CLASS="arg" >-> <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > a</TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="arg" >-> b</TD ><TD CLASS="rdoc" ></TD ></TR ><TR ><TD CLASS="ndoc" COLSPAN="2" ><P >Process either the exception or value in an <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT > to produce a result. </P ><P >This function is modeled after <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#v%3Amaybe" >maybe</A ></TT > and <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#v%3Aeither" >either</A ></TT >. The first argument must accept any instances of <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A ></TT >. If you want to handle multiple types of exceptions, see <TT ><A HREF="Data-Attempt.html#v%3AmakeHandler" >makeHandler</A ></TT >. The second argument converts the success value. </P ><P >Note that this function does not expose all the data available in an <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT > value. Notably, the monadic stack trace is not passed on to the error handler. If desired, use the monadicStackTrace function to extract it. </P ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:makeHandler" ><A NAME="v%3AmakeHandler" ></A ></A ><B >makeHandler</B > :: [<A HREF="Data-Attempt.html#t%3AAttemptHandler" >AttemptHandler</A > v] -> v -> <SPAN CLASS="keyword" >forall</SPAN > e. <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => e -> v</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#makeHandler" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >Convert multiple <TT ><A HREF="Data-Attempt.html#t%3AAttemptHandler" >AttemptHandler</A ></TT >s and a default value into an exception handler. </P ><P >This is a convenience function when you want to have special handling for a few types of <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A ></TT >s and provide another value for anything else. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:AttemptHandler" ><A NAME="t%3AAttemptHandler" ></A ></A ><B >AttemptHandler</B > v </TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#AttemptHandler" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >A simple wrapper value necesary due to the Haskell type system. Wraps a function from a *specific* <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A ></TT > type to some value. </TD ></TR ><TR ><TD CLASS="section4" >Constructors</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="arg" ><SPAN CLASS="keyword" >forall</SPAN > e . <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > e => <A NAME="v:AttemptHandler" ><A NAME="v%3AAttemptHandler" ></A ></A ><B >AttemptHandler</B > (e -> v)</TD ><TD CLASS="rdoc" ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="3" ><A NAME="3" >Individual <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >s </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:isFailure" ><A NAME="v%3AisFailure" ></A ></A ><B >isFailure</B > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#isFailure" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Tests for a <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT > value. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:isSuccess" ><A NAME="v%3AisSuccess" ></A ></A ><B >isSuccess</B > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Bool.html#t%3ABool" >Bool</A ></TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#isSuccess" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Tests for a <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT > value. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fromSuccess" ><A NAME="v%3AfromSuccess" ></A ></A ><B >fromSuccess</B > :: <A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v -> v</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#fromSuccess" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >This is an unsafe, partial function which should only be used if you either know that a function will succeed or don't mind the occassional runtime exception. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="4" ><A NAME="4" >Lists of <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >s </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:successes" ><A NAME="v%3Asuccesses" ></A ></A ><B >successes</B > :: [<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v] -> [v]</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#successes" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Returns only the <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT > values. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:failures" ><A NAME="v%3Afailures" ></A ></A ><B >failures</B > :: [<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v] -> [<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3ASomeException" >SomeException</A >]</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#failures" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Returns only the <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT > values, each wrapped in a SomeException. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:partitionAttempts" ><A NAME="v%3ApartitionAttempts" ></A ></A ><B >partitionAttempts</B > :: [<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v] -> ([<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3ASomeException" >SomeException</A >], [v])</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#partitionAttempts" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Return all of the <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT >s and <TT ><A HREF="Data-Attempt.html#v%3ASuccess" >Success</A ></TT >es separately in a tuple. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="5" ><A NAME="5" >Runtime exceptions </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:attemptIO" ><A NAME="v%3AattemptIO" ></A ></A ><B >attemptIO</B > :: (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > eIn, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Control-Exception-Base.html#t%3AException" >Exception</A > eOut) => (eIn -> eOut) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > v -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > (<A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A > v)</TD ><TD CLASS="declbut" ><A HREF="src/Data-Attempt.html#attemptIO" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >Catches runtime (ie, IO) exceptions and inserts them into an <TT ><A HREF="Data-Attempt.html#t%3AAttempt" >Attempt</A ></TT >. </P ><P >Like handle, the first argument to this function must explicitly state the type of its input. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="6" ><A NAME="6" >Reexport the <TT ><A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html#t%3AFailure" >Failure</A ></TT > class </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" >module <A HREF="/usr/share/doc/ghc/html/libraries/failure-0.1.0.1/Control-Failure.html" >Control.Failure</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >