The interlude package

[Tags: gpl, library]

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.


[Skip to ReadMe]

Properties

Versions0.1, 0.1.1, 0.1.2
Change logNone available
Dependenciesbase (==4.*) [details]
LicenseGPL
AuthorKetil Malde <ketil@malde.org>
Maintainernone
StabilityAlpha
CategoryDevelopment
Home pagehttp://malde.org/~ketil/
UploadedSat Dec 12 16:51:49 UTC 2009 by KetilMalde
DistributionsNixOS:0.1.2
Downloads747 total (21 in last 30 days)
Votes
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for interlude-0.1.2

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: Prelude.head: empty list

With Interlude, you instead get:

   *** 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