The funpat package

This library provides pattern matching with restricted function patterns
(RFPs). An expression is an RFP iff exists an equivalent valid Haskell
pattern. For example ("abc" ++ xs) is an RFP, because ('a' : 'b' : 'c' : xs)
is an equivalent valid Haskell pattern. On the other hand, (xs ++ "abc")
is not an RFP. Details are discussed in the paper Restricted Function Patterns
presented at TFP 2011.

Example 1. Here is a function to chop off the prefix "prefix" of strings: