HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

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

Read

4 declarations
valuederiveRead :: Name -> Q [Dec]
#

Generates a Read instance declaration for the given data type or data family instance.

valuemakeReadPrec :: Name -> Q Exp
#

Generates a lambda expression which behaves like readPrec (without requiring a Read instance).

Read1

6 declarations
valuederiveRead1 :: Name -> Q [Dec]
#

Generates a Read1 instance declaration for the given data type or data family instance.

valuemakeLiftReadsPrec :: Name -> Q Exp
#

Generates a lambda expression which behaves like liftReadsPrec (without requiring a Read1 instance).

This function is not available with transformers-0.4.

valuemakeLiftReadPrec :: Name -> Q Exp
#

Generates a lambda expression which behaves like liftReadPrec (without requiring a Read1 instance).

This function is only available with base-4.10 or later.

valuemakeReadPrec1 :: Name -> Q Exp
#

Generates a lambda expression which behaves like readPrec1 (without requiring a Read1 instance).

This function is only available with base-4.10 or later.

valuemakeReadsPrec1 :: Name -> Q Exp
#

Generates a lambda expression which behaves like readsPrec1 (without requiring a Read1 instance).

Read2

6 declarations
valuederiveRead2 :: Name -> Q [Dec]
#

Generates a Read2 instance declaration for the given data type or data family instance.

This function is not available with transformers-0.4.

valuemakeLiftReadsPrec2 :: Name -> Q Exp
#

Generates a lambda expression which behaves like liftReadsPrec2 (without requiring a Read2 instance).

This function is not available with transformers-0.4.

valuemakeLiftReadPrec2 :: Name -> Q Exp
#

Generates a lambda expression which behaves like liftReadPrec2 (without requiring a Read2 instance).

This function is only available with base-4.10 or later.

valuemakeReadPrec2 :: Name -> Q Exp
#

Generates a lambda expression which behaves like readPrec2 (without requiring a Read2 instance).

This function is only available with base-4.10 or later.

valuemakeReadsPrec2 :: Name -> Q Exp
#

Generates a lambda expression which behaves like readsPrec2 (without requiring a Read2 instance).

This function is not available with transformers-0.4.

ReadOptions

2 declarations
newtypenewtype ReadOptions
#

Options that further configure how the functions in Text.Read.Deriving should behave.

Constructors

  • ReadOptions
    • useReadPrec :: Bool

      If True:

      • Derived Read instances will implement readPrec, not readsPrec, and will provide a default implementation of readListPrec in terms of readPrec.

      • If built against base-4.10 or later, derived Read1/Read2 instances will implement liftReadPrec/liftReadPrec2, not liftReadsPrec/liftReadsPrec2, and will provide default implementations of liftReadListPrec/liftReadListPrec2 in terms of liftReadPrec/liftReadPrec2. If built against an earlier version of base, derived Read1/Read2 instances are not affected, so they will act as if this flag were False.

      If False:

      • Derived Read instances will implement readsPrec.

      • Derived Read1 instances will implement readsPrec1 (if built against transformers-0.4) or liftReadsPrec (otherwise). If not built against transformers-0.4, derived Read2 instances will implement liftReadsPrec2.

      It's generally a good idea to enable this option, since readPrec and friends are more efficient than readsPrec and friends, since the former use the efficient ReadPrec parser 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.Internal
  • Ord ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.Internal
  • Read ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.Internal
  • Show ReadOptionsDefined in deriving-compat-0.6.8 · Text.Read.Deriving.Internal