Factor out readField (#14364)

Authored by tdammers on Oct 25 2017, 6:09 PM.


Factor out readField (Trac #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