First class patterns and pattern matching, using type families https://github.com/reinerp/first-class-patterns
|Latest on Hackage:||0.3.2.3|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
This package implements a library of first class patterns. The initial basis for this library was Morten Rhiger's "Type-safe pattern combinators"; the patterns can be used in an almost identical way to those of Morten Rhiger. In a series of blog posts at http://reinerp.wordpress.com/category/pattern-combinators/ the types of patterns were made more revealing using type families, and a simpler implementation was used which avoids some book-keeping.
The library reimplements most of Haskell's built-in pattern matching facilities, plus some more. The pattern matches of this library are lightweight: when GHC's optimisation is turned on, all overhead should be optimised away, leaving a standard Haskell pattern match.
If you're just reading the documentation for this library for
the first time, start with