Closed spencerjanssen closed 1 year ago
We could do the desugaring manually and generate getField @"fieldName" x
, or, to avoid needing TypeApplications, possibly (getField :: HasField "fieldName" s t => s -> t) x
(though that probably also requires some extensions)
Looks like we could go as far back as GHC 8.2.1/base 4.10.0.0/template-haskell 2.12.0.0 with the type application approach. I'm happy to implement that if you'd prefer.
Only question from me: based on the comments, this looks like it's a backwards-compatible change. If so, do we need the major version bump present in the PR right now?
I bumped the major version because we're adding a new constructor to the Deref
type exported from Text.Shakespeare.Base
.
Got it, thanks!
This PR adds
OverloadedRecordDot
support to templates on compilers that support that extension.I believe this will not break existing templates because the parser for infix operator expressions requires spaces around the operator:
x.y
was previously rejected;x . y
parses to(.) x y
.I'm not sure how best to handle record dot expressions on older compilers. The solution I landed on is to allow them in the parser and throw an exception when building the Template Haskell
Exp
.