yesodweb/path-pieces — pull request #3 by paul-rouse (2013-04-12 16:05:17+00:00)
Title: Replace PathMultiPiece instances with a more generic one.

In my present project, I came across a need for an instance of `PathMultiPiece` for `[Int]`. Pretty trivial, but GHC gave me the "orphan instance" annoyance, and anyway I had written the instance methods in a completely generic fashion.

This change puts the generic implementation into the `Web.PathPieces` library, automatically providing `instance PathPiece p => PathMultiPiece [p]`.

NB I have taken the liberty of bumping the version in the cabal file, as this seems to be the only change for a while.

At the moment I have *replaced* the specific instances with the general one. There is a small performance penalty in doing this. In percentage terms, the strict Text case is the most affected, since its special-case implementation is so trivial - the generic implementation is about half the speed, as judged by mapping a test function containing just a check of `fromPathMultiPiece . toPathMultiPiece` over a pre-evaluated list of a million examples.

It would, of course, be possible to retain the special case for `[Text]` and use `OverlappingInstances`, but I didn't think the performance difference was likely to be important in a realistic situation. However, I do not have a sensible benchmark setup for a whole application, so I have not checked that assertion.