Hi, Do you sometimes encounter the dreaded "pattern match failure: head []" message? Do you have incomplete patterns which sometimes fail? Do you have incomplete patterns which you know don't fail, but still get compiler warnings about them? Would you like to statically ensure the absence of all calls to error? For the last few years I've been working on a pattern-match checker for Haskell, named Catch. I'm now happy to make a release: Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/catch-0.1 Homepage: http://www-users.cs.york.ac.uk/~ndm/catch/ User manual: http://www.cs.york.ac.uk/fp/darcs/catch/catch.htm While a darcs version is available, I strongly recommend the use of the tarball on hackage. Features: * Detects all incomplete patterns and calls to error * Full support for Haskell, through the use of Yhc as a front end * Automatic - no annotations are required * Fast - checking times of under 5 seconds (excluding Yhc compilation) are typical Drawbacks: * Requires Yhc to be installed, which doesn't accept most Haskell extensions. This will be fixed once GHC.Core is available as a standalone library. The underlying tool is not limited to Haskell 98 in any way. Success stories: * The darcs version of HsColour has been proven free of pattern match errors, and Catch was able to find three previously unknown crashes which could be triggered by a malformed document. * System.FilePath has been checked, and is free of pattern-match errors * XMonad's central StackSet.hs module has been checked repeatedly, as it has evolved. Unfortunately currently this module goes beyond Haskell 98, but this should be fixed shortly. If you have any experiences with Catch, I'd be very interested to hear them. Thanks Neil
Neil Mitchell wrote:
Hi,
Do you sometimes encounter the dreaded "pattern match failure: head []" message? Do you have incomplete patterns which sometimes fail? Do you have incomplete patterns which you know don't fail, but still get compiler warnings about them? Would you like to statically ensure the absence of all calls to error?
For the last few years I've been working on a pattern-match checker for Haskell, named Catch. I'm now happy to make a release:
Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/catch-0.1 Homepage: http://www-users.cs.york.ac.uk/~ndm/catch/ User manual: http://www.cs.york.ac.uk/fp/darcs/catch/catch.htm
While a darcs version is available, I strongly recommend the use of the tarball on hackage.
Features:
* Detects all incomplete patterns and calls to error * Full support for Haskell, through the use of Yhc as a front end * Automatic - no annotations are required * Fast - checking times of under 5 seconds (excluding Yhc compilation) are typical
Drawbacks:
* Requires Yhc to be installed, which doesn't accept most Haskell extensions. This will be fixed once GHC.Core is available as a standalone library. The underlying tool is not limited to Haskell 98 in any way.
Success stories:
* The darcs version of HsColour has been proven free of pattern match errors, and Catch was able to find three previously unknown crashes which could be triggered by a malformed document. * System.FilePath has been checked, and is free of pattern-match errors * XMonad's central StackSet.hs module has been checked repeatedly, as it has evolved. Unfortunately currently this module goes beyond Haskell 98, but this should be fixed shortly.
If you have any experiences with Catch, I'd be very interested to hear them.
Thanks
Neil
I would love to use this with regex-tdfa (and the other regex-* modules). At the moment regex-tdfa is uses a few extensions such as recursive "mdo" notation and parts hook up to the MPTC + fundeps used in regex-base. The MPTC+fundeps are not part of the workhorse modules, they are just "type class syntactic sugar" that makes it easier for the library consumer. But "mdo" _is_ used in two of the important internal functions. -- Chris
participants (2)
-
haskell@list.mightyreason.com -
Neil Mitchell