# interlude: Replaces some Prelude functions for enhanced error reporting

[ development, library ] [ Propose Tags ]

Interlude is a CPP include file, and a module which you can use instead of the (often implicit) Prelude import. It replaces some partial functions (i.e. functions that may fail on correctly typed input like 'head []') with pattern matches, so that a sensible error message that includes location can be printed out.

Versions [faq] 0.1, 0.1.1, 0.1.2 base (==4.*) [details] LicenseRef-GPL Ketil Malde none Development http://malde.org/~ketil/ by KetilMalde at Sat Dec 12 16:51:49 UTC 2009 NixOS:0.1.2 2414 total (114 in the last 30 days) (no votes yet) [estimated by Bayesian average] λ λ λ Docs uploaded by userBuild status unknown

## Modules

[Index]

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]
SYNOPSIS

Interlude is an include file and a module to use instead of the
(often implicit) Prelude import.  It replaces some partial
functions (i.e. functions that may fail on correctly typed input)
with pattern matches, so that a sensible error message that includes
location can be printed out.

E.g. using the Prelude, "head []" results in

*** Exception: Program error - 'head' failed: empty list. Location: test.hs line: 7

INSTALLATION

As per the usual cabal incantations:

./Setup.hs configure
./Setup.hs build
sudo ./Setup.hs install

(Or add --user to configure in lieu of the sudo for install if you
don't have or want to use the privileges.)

USAGE

Replace any implicit or explicit import of the Prelude with

#include <interlude.h>
import Interlude

Make sure you compile with CPP, adding the {-# OPTIONS -cpp #-} pragma
or -cpp to the command line works for GHC, in addition :s -cpp works for
GHCi.

You may also #define a MESSAGE macro with a string to print after any
error.  Useful to point out the address to contact for support, for
intstance.

BUGS

You will not be able to hide or qualify the functions replaced by
the Interlude.  As the names will be expanded in the imports, expect
some messy error messages if you try.

The C preprocessor doesn't care much for macro expansion in the
presence of primes used as variable names, and using these replacement
functions on the same line as single quotes will usually not work.
See the file example.hs for an example