%**<title>The Haskell 98 Library Report: Maybe Utilities</title>
%**~header
\section{Maybe Utilities}

\outline{
\inputHS{headers/Maybe}
}

The type constructor @Maybe@ is defined in @Prelude@ as
\bprog
@
data Maybe a = Nothing | Just a
@
\eprog
The purpose of the @Maybe@ type is to provide a method of dealing with
illegal or optional values without terminating the program, as would
happen if @error@ were used, and without using @IOError@ from the @IO@
monad, which would cause the expression to become monadic.  A correct
result is encapsulated by wrapping it in @Just@; an incorrect result
is returned as @Nothing@.

Other operations on @Maybe@ are provided as part of the monadic
classes in the Prelude.

\clearpage
\subsection{Library {\tt Maybe}}
\label {Maybe}
\inputHS{code/Maybe}

%**~footer
