generic-data-0.9.2.1: Deriving instances with GHC.Generics and related utilities
Safe HaskellTrustworthy
LanguageHaskell2010

Generic.Data.Internal.Read

Description

Generic implementation of Read

Warning

This is an internal module: it is not subject to any versioning policy, breaking changes can happen at any time.

If something here seems useful, please report it or create a pull request to export it from an external module.

Synopsis

Documentation

greadPrec :: (Generic a, GRead0 (Rep a)) => ReadPrec a Source #

Generic readPrec.

instance Read MyType where
  readPrec = greadPrec
  readListPrec = readListPrecDefault

type GRead0 = GRead Proxy Source #

Generic representation of Read types.

gliftReadPrec :: (Generic1 f, GRead1 (Rep1 f)) => ReadPrec a -> ReadPrec [a] -> ReadPrec (f a) Source #

Generic liftReadPrec.

type GRead1 = GRead Identity Source #

Generic representation of Read1 types.

class GRead p f where Source #

Methods

gPrecRead :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (f a) Source #

Instances

Instances details
GRead p (V1 :: Type -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecRead :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (V1 a) Source #

(GRead p f, GRead p g) => GRead p (f :+: g) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecRead :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec ((f :+: g) a) Source #

(Constructor c, GReadC p c f) => GRead p (M1 C c f) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecRead :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (M1 C c f a) Source #

(GRead p f, IsNullaryDataType f) => GRead p (M1 D d f) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecRead :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (M1 D d f a) Source #

class IsNullaryDataType f where Source #

Methods

isNullaryDataType :: f a -> Bool Source #

Instances

Instances details
IsNullaryDataType (V1 :: Type -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Read

IsNullaryDataType (f :+: g) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

isNullaryDataType :: (f :+: g) a -> Bool Source #

IsNullaryDataType (C1 c f) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

isNullaryDataType :: C1 c f a -> Bool Source #

class GReadC p c f where Source #

Methods

gPrecReadC :: p (ReadPrec a, ReadPrec [a]) -> String -> Fixity -> ReadPrec (M1 C c f a) Source #

Instances

Instances details
GReadNamed p f => GReadC p ('MetaCons s y 'True) f Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadC :: p (ReadPrec a, ReadPrec [a]) -> String -> Fixity -> ReadPrec (M1 C ('MetaCons s y 'True) f a) Source #

GReadFields p f => GReadC p ('MetaCons s y 'False) f Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadC :: p (ReadPrec a, ReadPrec [a]) -> String -> Fixity -> ReadPrec (M1 C ('MetaCons s y 'False) f a) Source #

class GReadFields p f where Source #

Methods

gPrecReadFields :: p (ReadPrec a, ReadPrec [a]) -> ReadPrecTree (f a) Source #

Instances

Instances details
GReadFields p (U1 :: Type -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Read

(GReadFields p f, GReadFields p g) => GReadFields p (f :*: g) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadFields :: p (ReadPrec a, ReadPrec [a]) -> ReadPrecTree ((f :*: g) a) Source #

GReadSingle p f => GReadFields p (M1 S c f) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadFields :: p (ReadPrec a, ReadPrec [a]) -> ReadPrecTree (M1 S c f a) Source #

class GReadNamed p f where Source #

Methods

gPrecReadNamed :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (f a) Source #

Instances

Instances details
GReadNamed p (U1 :: Type -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadNamed :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (U1 a) Source #

(GReadNamed p f, GReadNamed p g) => GReadNamed p (f :*: g) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadNamed :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec ((f :*: g) a) Source #

(Selector c, GReadSingle p f) => GReadNamed p (M1 S c f) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadNamed :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (M1 S c f a) Source #

class GReadSingle p f where Source #

Methods

gPrecReadSingle :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec (f a) Source #

Instances

Instances details
GReadSingle Identity Par1 Source # 
Instance details

Defined in Generic.Data.Internal.Read

Read1 f => GReadSingle Identity (Rec1 f) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Read a => GReadSingle p (K1 i a :: Type -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadSingle :: p (ReadPrec a0, ReadPrec [a0]) -> ReadPrec (K1 i a a0) Source #

(Read1 f, GReadSingle p g) => GReadSingle p (f :.: g) Source # 
Instance details

Defined in Generic.Data.Internal.Read

Methods

gPrecReadSingle :: p (ReadPrec a, ReadPrec [a]) -> ReadPrec ((f :.: g) a) Source #

coerceM1 :: ReadPrec (f p) -> ReadPrec (M1 i c f p) Source #

liftReadPrecCompat :: Read1 f => (ReadPrec a, ReadPrec [a]) -> ReadPrec (f a) Source #

A backwards-compatible version of liftReadPrec. This is needed for compatibility with base-4.9, where Read1 only offers liftReadsPrec, not liftReadPrec.

data ReadPrecTree a where Source #

Constructors

U1Leaf :: ReadPrecTree (U1 a) 
M1Leaf :: ReadPrec (f a) -> ReadPrecTree (M1 i c f a) 
Branch :: ReadPrecTree (f a) -> ReadPrecTree (g a) -> ReadPrecTree ((f :*: g) a) 

snocView :: [a] -> Maybe ([a], a) Source #