Haskell Platform proposal: Add case-insensitive

Bas van Dijk v.dijk.bas at gmail.com
Sat Jan 26 19:57:51 CET 2013


On 26 January 2013 19:31, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> Any ideas how to improve this?

It also doesn't help using a rewrite rule to not go via the type class:

{-# RULES
  "mk/ByteString" forall (bs :: B.ByteString). mk bs = CI bs (B.map toLower8 bs)
  #-}

and modifying the benchmark so that the rule fires:

...
      , bench "case-insensitive" $ nf f bs
...

f :: ByteString -> CI.CI ByteString
f bs = CI.mk bs

What does help a bit is inlining toLower8 in Data.CaseInsensitive. But
with that it's still 44% slower than the no-class benchmark.

Bas



More information about the Libraries mailing list