Factor out readField (#14364)
authorTobias Dammers <tdammers@gmail.com>
Wed, 25 Oct 2017 23:09:03 +0000 (19:09 -0400)
committerBen Gamari <ben@smart-cactus.org>
Wed, 25 Oct 2017 23:18:42 +0000 (19:18 -0400)
commitdbd81f7e86514498218572b9d978373b1699cc5b
tree5c4527f5405e67d0de0006fc07dd132162c3b96d
parent4c06ccb71737b77a8165e888ad75417a425549dd
Factor out readField (#14364)

Improves compiler performance of deriving Read instances, as suggested
in the issue.

Additionally, we introduce `readSymField`, a companion to `readField`
that parses symbol-type fields (where the field name is a symbol, e.g.
`(#)`, rather than an alphanumeric identifier. The decision between
these two functions is made a compile time, because we already know
which one we need based on the field name.

Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D4108
compiler/prelude/PrelNames.hs
compiler/typecheck/TcGenDeriv.hs
libraries/base/GHC/Read.hs
testsuite/tests/perf/compiler/all.T