Copyright | (C) 2015-2017 Ryan Scott |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Ryan Scott |
Portability | Template Haskell |
Safe Haskell | None |
Language | Haskell2010 |
Exports functions to mechanically derive ReadClass
, 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.
Synopsis
- deriveRead :: Name -> Q [Dec]
- deriveReadOptions :: ReadOptions -> Name -> Q [Dec]
- makeReadsPrec :: Name -> Q Exp
- makeReadPrec :: Name -> Q Exp
- deriveRead1 :: Name -> Q [Dec]
- deriveRead1Options :: ReadOptions -> Name -> Q [Dec]
- makeLiftReadsPrec :: Name -> Q Exp
- makeLiftReadPrec :: Name -> Q Exp
- makeReadPrec1 :: Name -> Q Exp
- makeReadsPrec1 :: Name -> Q Exp
- deriveRead2 :: Name -> Q [Dec]
- deriveRead2Options :: ReadOptions -> Name -> Q [Dec]
- makeLiftReadsPrec2 :: Name -> Q Exp
- makeLiftReadPrec2 :: Name -> Q Exp
- makeReadPrec2 :: Name -> Q Exp
- makeReadsPrec2 :: Name -> Q Exp
- newtype ReadOptions = ReadOptions {
- useReadPrec :: Bool
- defaultReadOptions :: ReadOptions
ReadClass
deriveRead :: Name -> Q [Dec] Source #
Generates a ReadClass
instance declaration for the given data type or data
family instance.
deriveReadOptions :: ReadOptions -> Name -> Q [Dec] Source #
Like deriveRead
, but takes a ReadOptions
argument.
makeReadsPrec :: Name -> Q Exp Source #
Generates a lambda expression which behaves like readsPrec
(without
requiring a ReadClass
instance).
makeReadPrec :: Name -> Q Exp Source #
Generates a lambda expression which behaves like readPrec
(without
requiring a ReadClass
instance).
Read1
deriveRead1 :: Name -> Q [Dec] Source #
Generates a Read1
instance declaration for the given data type or data
family instance.
deriveRead1Options :: ReadOptions -> Name -> Q [Dec] Source #
Like deriveRead1
, but takes a ReadOptions
argument.
makeLiftReadsPrec :: Name -> Q Exp Source #
Generates a lambda expression which behaves like liftReadsPrec
(without
requiring a Read1
instance).
This function is not available with transformers-0.4
.
makeLiftReadPrec :: Name -> Q Exp Source #
Generates a lambda expression which behaves like liftReadPrec
(without
requiring a Read1
instance).
This function is only available with base-4.10
or later.
makeReadPrec1 :: Name -> Q Exp Source #
Generates a lambda expression which behaves like readPrec1
(without
requiring a Read1
instance).
This function is only available with base-4.10
or later.
makeReadsPrec1 :: Name -> Q Exp Source #
Generates a lambda expression which behaves like readsPrec1
(without
requiring a Read1
instance).
Read2
deriveRead2 :: Name -> Q [Dec] Source #
Generates a Read2
instance declaration for the given data type or data
family instance.
This function is not available with transformers-0.4
.
deriveRead2Options :: ReadOptions -> Name -> Q [Dec] Source #
Like deriveRead2
, but takes a ReadOptions
argument.
This function is not available with transformers-0.4
.
makeLiftReadsPrec2 :: Name -> Q Exp Source #
Generates a lambda expression which behaves like liftReadsPrec2
(without
requiring a Read2
instance).
This function is not available with transformers-0.4
.
makeLiftReadPrec2 :: Name -> Q Exp Source #
Generates a lambda expression which behaves like liftReadPrec2
(without
requiring a Read2
instance).
This function is only available with base-4.10
or later.
makeReadPrec2 :: Name -> Q Exp Source #
Generates a lambda expression which behaves like readPrec2
(without
requiring a Read2
instance).
This function is only available with base-4.10
or later.
makeReadsPrec2 :: Name -> Q Exp Source #
Generates a lambda expression which behaves like readsPrec2
(without
requiring a Read2
instance).
This function is not available with transformers-0.4
.
ReadOptions
newtype ReadOptions Source #
Options that further configure how the functions in Text.Read.Deriving should behave.
ReadOptions | |
|
Instances
Eq ReadOptions Source # | |
Defined in Text.Read.Deriving.Internal (==) :: ReadOptions -> ReadOptions -> Bool # (/=) :: ReadOptions -> ReadOptions -> Bool # | |
Ord ReadOptions Source # | |
Defined in Text.Read.Deriving.Internal compare :: ReadOptions -> ReadOptions -> Ordering # (<) :: ReadOptions -> ReadOptions -> Bool # (<=) :: ReadOptions -> ReadOptions -> Bool # (>) :: ReadOptions -> ReadOptions -> Bool # (>=) :: ReadOptions -> ReadOptions -> Bool # max :: ReadOptions -> ReadOptions -> ReadOptions # min :: ReadOptions -> ReadOptions -> ReadOptions # | |
Read ReadOptions Source # | |
Defined in Text.Read.Deriving.Internal readsPrec :: Int -> ReadS ReadOptions # readList :: ReadS [ReadOptions] # readPrec :: ReadPrec ReadOptions # readListPrec :: ReadPrec [ReadOptions] # | |
Show ReadOptions Source # | |
Defined in Text.Read.Deriving.Internal showsPrec :: Int -> ReadOptions -> ShowS # show :: ReadOptions -> String # showList :: [ReadOptions] -> ShowS # |
defaultReadOptions :: ReadOptions Source #
ReadOptions
that favor readPrec
over readsPrec
.