
Nicolas Frisby wrote:
Some of the code from the previous wiki link, type-level decimal numbers
I would rather advice against type-level decimal numbers, if we are looking at a lightweight solution. The [complete] code at http://www.haskell.org/haskellwiki/Non-empty_list is Haskell98! It also provides for a head and tail functions -- which are total and so raise no errors. Incidentally, inserting NList into the existing Safe.List does not seem like a good match as NList critically relies on being in a separate module with a limited export. NList constitutes a security kernel, whose invariants are to be described explicitly (and hopefully, automatically proven at some point). For that reason, it is beneficial to keep module NList separate and compact. It could of course be placed within Safe.* hierarchy, etc -- as a separate module. Neil Mitchell wrote:
Fortunately the problem of pattern match errors is being tackled by at least two projects:
* Catch: http://www-users.cs.york.ac.uk/~ndm/projects/catch.php * ESC-Haskell: http://www.cl.cam.ac.uk/~nx200/research/escH-hw.ps
I would submit the approach of the lightweight static capabilities (cf above Wiki link) to be counted as the third project in that area. The latter has an advantage that it is available in Haskell right now and requires no extra tools.