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.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.1.2
Dependencies base (>=4 && <5) [details]
License LicenseRef-GPL
Author Ketil Malde <ketil@malde.org>
Maintainer none
Category Development
Home page http://malde.org/~ketil/
Uploaded by KetilMalde at 2009-12-12T16:51:49Z
Distributions NixOS:0.1.2
Reverse Dependencies 2 direct, 1 indirect [details]
Downloads 3265 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for interlude-0.1.2

[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: 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