Generates a Read instance declaration for the given data type or data family instance.
Modulederiving-compat-0.6.8Haskell2010
Text.Read.Deriving.Internal
Exports functions to mechanically derive Read, Read1, and Read2 instances.
Note: this is an internal module, and as such, the API presented here is not guaranteed to be stable, even between minor releases of this library.
- 1 type
- 17 values
- Packagederiving-compat-0.6.8
- Exports18
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceInternal.hs
Read
4 declarationsLike deriveRead, but takes a ReadOptions argument.
Generates a lambda expression which behaves like readPrec (without
requiring a Read instance).
Read1
6 declarationsGenerates a Read1 instance declaration for the given data type or data
family instance.
Like deriveRead1, but takes a ReadOptions argument.
Generates a lambda expression which behaves like liftReadsPrec (without
requiring a Read1 instance).
This function is not available with transformers-0.4.
Generates a lambda expression which behaves like liftReadPrec (without
requiring a Read1 instance).
This function is only available with base-4.10 or later.
Generates a lambda expression which behaves like readPrec1 (without
requiring a Read1 instance).
This function is only available with base-4.10 or later.
Generates a lambda expression which behaves like readsPrec1 (without
requiring a Read1 instance).
Read2
6 declarationsGenerates a Read2 instance declaration for the given data type or data
family instance.
This function is not available with transformers-0.4.
Like deriveRead2, but takes a ReadOptions argument.
This function is not available with transformers-0.4.
Generates a lambda expression which behaves like liftReadsPrec2 (without
requiring a Read2 instance).
This function is not available with transformers-0.4.
Generates a lambda expression which behaves like liftReadPrec2 (without
requiring a Read2 instance).
This function is only available with base-4.10 or later.
Generates a lambda expression which behaves like readPrec2 (without
requiring a Read2 instance).
This function is only available with base-4.10 or later.
Generates a lambda expression which behaves like readsPrec2 (without
requiring a Read2 instance).
This function is not available with transformers-0.4.
ReadOptions
2 declarationsOptions that further configure how the functions in Text.Read.Deriving should behave.
Constructors
ReadOptionsuseReadPrec :: BoolIf True:
Derived Read instances will implement
readPrec, not readsPrec, and will provide a default implementation ofreadListPrecin terms ofreadPrec.If built against
base-4.10or later, derivedRead1/Read2instances will implementliftReadPrec/liftReadPrec2, notliftReadsPrec/liftReadsPrec2, and will provide default implementations ofliftReadListPrec/liftReadListPrec2in terms ofliftReadPrec/liftReadPrec2. If built against an earlier version ofbase, derivedRead1/Read2instances are not affected, so they will act as if this flag were False.
If False:
Derived
Read1instances will implementreadsPrec1(if built againsttransformers-0.4) orliftReadsPrec(otherwise). If not built againsttransformers-0.4, derivedRead2instances will implementliftReadsPrec2.
It's generally a good idea to enable this option, since
readPrecand friends are more efficient than readsPrec and friends, since the former use the efficientReadPrecparser datatype while the latter use the slower, list-based ReadS type.
Instances4Eq, Ord, Read, Show
Eq ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.InternalOrd ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.InternalRead ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.InternalShow ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.Internal
ReadOptions that favor readPrec over readsPrec.