Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Donald Bruce Stewart <dons <at> cse.unsw.edu.au>
Subject: ANNOUNCE: LocH, source locations in error, trace, and exceptions
Newsgroups: gmane.comp.lang.haskell.general
Date: Wednesday 15th November 2006 02:09:48 UTC (over 10 years ago)
The topic of improving exception diagnosis in Haskell is hot at the
moment, and I'm pleased to announce the release of LocH, a small Haskell
module providing source location-specific error messages and debugging
strings for Haskell code. 

It uses the compiler-expanded 'assert' token, rather than cpp or m4, to
provide a lightweight approach to generating source locations. No
preprocessor is required. The code is available under a BSD license.

The LocH home:
    http://www.cse.unsw.edu.au/~dons/loch.html

The API:
    http://www.cse.unsw.edu.au/~dons/loch/Debug-Trace-Location.html

Example usage:

    import Debug.Trace.Location

    main =
        trace assert "Starting ..." $ do
        print 1
        trace assert "Finished" $ do
        print 2
        let x = check assert $ head ([] :: [Int])
        print x

Will produce:

    $ ./a.out 
    A.hs:4:10-15: Starting ...
    1
    A.hs:6:10-15: Finished
    2
    a.out: A.hs:8:18-23: Prelude.head: empty list

LocH provides located versions of trace, failure, as well as check and
checkIO
to wrap exception-throwing pure and IO code.

May all your exceptions be located,
    Don
 
CD: 3ms