git.iko.soy/typeable/attoparsec
on master help sign in
Fix a bug in stringCI

This is even less efficient. If there is an upper limit for the number of characters a single character can be folded to (say m), than we could probably optimize this by starting from (n `div` m) (where n is the length of the case-folded argument to stringCI).

commitdb16946128c1aeeee5d317104a4675aad6f70d46 authorSimon Hengel <sol@typeful.net> dateSun 15 Jan 2012, 20:04 (15 years ago) parentb3d5ab5
1 file changed+1−1
Data/Attoparsec/Text/Internal.hs+1−1
Data/Attoparsec/Text/Internal.hs+1−1
@@ -231,7 +231,7 @@ string s = takeWith (T.length s) (==s)
231231-- "ss"), which makes a simple, efficient implementation tricky. We
232232-- have (for now) chosen simplicity over efficiency.
233233stringCI :: Text -> Parser Text
234−stringCI s = go (T.length s)
234+stringCI s = go 0
235235 where
236236 go !n
237237 | n > T.length fs = fail "stringCI"