Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Options that influence TH code generation
Documentation
Tweak the output of the generator
In the explanations of the various options below, we will use the following record as our running example:
data T a b = MkT { tWord :: Word , tBool :: Bool , tChar :: Char , tA :: a , tListB :: [b] } deriving (Eq, Show)
Options | |
|
defaultPureScript :: Options Source #
Default options for "Purescript style" records
That is:
- All fields are strict
- We do not generate field accessors: fields must be accessed and updated
through the
HasField
instances (e.g.,record-dot-preprocessor
syntax).
We do not introduce a pattern synonym by default:
- Introducing a pattern synonym reintroduces code that is quadratic in size.
- Perhaps more importantly, it would make it impossible to define two records with the same field names in a single module, as the field accessors (unnecessarily but currently unavoidably) introduced by the pattern synonym would clash.
NOTE: The record-dot-preprocessor
enables DuplicateRecordFields
by
default. Since the records that we produce are not visible to ghc
,
large-records
is not compatible with DRF-style overloading. However, as
long as all overloading is resolved through HasField
instead (which is
what record-dot-preprocessor
encourages anyway), all is fine.