| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Record.QQ.CodeGen
Description
Quasi-quoter support for large records
NOTE: The only reason for the existence of this module is that record pattern
syonyms in ghc are currently not useable: when we declare a record pattern
synonym, ghc automatically derives field accessors for every field in the
record. We don't want those accessors: they result in name clashes
(DuplicateRecordFields does not apply to record pattern synonyms) and, more
importantly, they result in quadratic code size again. Once the
NoFieldSelectors language extension is merged (probably ghc 9.2), we
can reconsider whether this module is still required.
See also:
Documentation
lr :: QuasiQuoter Source #
Construct or match on large-records-style records
Example construction usage:
inOrder :: R Bool
inOrder = [lr| MkR { x = 1234, y = [True] } |]or:
constructorApp :: R Bool constructorApp = [lr| MkR |] 1234 [True]
Example matching usage:
projectOne :: T Bool -> Int
projectOne [lr| MkT { x = a } |] = a