hledger/hledger-lib/Hledger
Simon Michael 58f989715a Replace our stringly Regex with a safer compiled Regexp type
This PR #1330, addressing #1312 (parseQuery is partial) and #1245
(internal server error).

User-visible changes:

- hledger-web now handles malformed regular expressions
  (eg, a query consisting of the single character `?`) gracefully,
  showing a tidy error message instead "internal server error".

API/internal changes:

- The Regex type alias has been replaced by the Regexp ADT, which
  contains both the compiled regular expression (so is guaranteed to
  be usable at runtime) and the original string (so can be serialised,
  printed, compared, etc.) A Regexp also knows whether is it case
  sensitive or case insensitive. The Hledger.Utils.Regex api has changed.

- Typeable and Data instances are no longer derived for hledger's
  data types; they were redundant/no longer needed

- NFData instances are no longer derived for hledger's data types.
  This speeds up a full build by roughly 7%. But it means we can't
  deep-evaluate hledger values, or time hledger code with Criterion.
  https://github.com/simonmichael/hledger/pull/1330#issuecomment-684075129
  has some ideas on this.

- Query no longer has a custom Show instance

- Some internal use of regexps was replaced by text replacement or
  parsers.

- Hledger.Utils.String: quoteIfNeeded now actually escapes quotes in
  strings; dropped escapeQuotes

- Hledger.Utils.Tree: dropped some old utilities

- dropped some obsolete code for the old --display option

Merge branch 'regexp' into master
2020-09-01 10:33:33 -07:00
..
Data lib,cli,ui: Change to consistent naming scheme for Hledger.Utils.Regex. 2020-09-01 11:36:34 +10:00
Read lib,cli,ui: Change to consistent naming scheme for Hledger.Utils.Regex. 2020-09-01 11:36:34 +10:00
Reports Replace our stringly Regex with a safer compiled Regexp type 2020-09-01 10:33:33 -07:00
Utils lib: Fix quoteIfNeeded so it actually escapes quotes. 2020-09-01 11:41:55 +10:00
Data.hs move JSON instances from hledger-web to hledger-lib 2019-12-16 17:17:00 -08:00
Query.hs lib,cli,ui: Change to consistent naming scheme for Hledger.Utils.Regex. 2020-09-01 11:36:34 +10:00
Read.hs lib,cli: Replace parsedate and mkdatespan with direct applications of fromGregorian, transaction now takes Day instead of a date string. 2020-08-29 15:08:28 -07:00
Reports.hs lib,cli,ui: Remove redundant Typeable and Data instances. 2020-08-31 15:41:30 +10:00
Utils.hs ;review, tag all error calls with an easier to find PARTIAL: comment (#1312) 2020-08-05 16:08:33 -07:00