regex-tdfa
regex-tdfa copied to clipboard
Fix `showPattern` to round-trip
~~Better docs for Pattern module~~ (fixed in 1.3.2), fix showPattern to round-trip.
It is claimed that showPattern round-trips, but does not:
>>> getAllTextMatches ("a \" \\" =~ "[a]") :: [String]
["a"]
>>> let parse = either (error . show) fst . parseRegex
>>> let pp' = showPattern . parse
>>> getAllTextMatches ("a \" \\" =~ pp' "[a]") :: [String]
["a","\""]
It uses Show PatternSet which adds " coming from empty components of PatternSet:
https://github.com/haskell-hvr/regex-tdfa/blob/c5b8f544b091b2033afe61a9d5dd3987a6f8d21d/lib/Text/Regex/TDFA/Pattern.hs#L102-L109