hsExprTest-3.6.5: Expression Testing
Safe HaskellSafe
LanguageHaskell2010

Test.Testable.Data

Description

Support for testing data type declarations.

(c) 2014 Vladimír Štill

Synopsis

Documentation

showData :: DataDecl -> String #

Get string representation of DataDecl.

reflectData :: forall a. Data a => a -> DataDecl #

infer data declaration of given type it works well for monomorphic ATDs, for polymorphic types it will print data declaration as it would seem if all type variables were instantiated. For records it ommits record fields For non-ADT types results will be wrong most likely

conArgs :: Data a => a -> [TypeRep] #

Get types of constructor arguments of given value.

conArgsNames :: Data a => a -> [String] #

Get string types of constructor arguments.

constrArgs :: forall witness. Data witness => witness -> Constr -> [TypeRep] #

As conArgs but value is build from given type witness and constuctor representation.

constrArgsNames :: forall witness. Data witness => witness -> Constr -> [String] #

As conArgsNames but value is build from given type witness and constuctor representation.

data DataDecl #

Representation of (monomorphic) data type.

Constructors

DataDecl 

Fields

Instances

Instances details
Data DataDecl # 
Instance details

Defined in Test.Testable.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DataDecl -> c DataDecl

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DataDecl

toConstr :: DataDecl -> Constr

dataTypeOf :: DataDecl -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DataDecl)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DataDecl)

gmapT :: (forall b. Data b => b -> b) -> DataDecl -> DataDecl

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DataDecl -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DataDecl -> r

gmapQ :: (forall d. Data d => d -> u) -> DataDecl -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> DataDecl -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> DataDecl -> m DataDecl

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DataDecl -> m DataDecl

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DataDecl -> m DataDecl

Read DataDecl # 
Instance details

Defined in Test.Testable.Data

Methods

readsPrec :: Int -> ReadS DataDecl

readList :: ReadS [DataDecl]

readPrec :: ReadPrec DataDecl

readListPrec :: ReadPrec [DataDecl]

Show DataDecl # 
Instance details

Defined in Test.Testable.Data

Methods

showsPrec :: Int -> DataDecl -> ShowS

show :: DataDecl -> String

showList :: [DataDecl] -> ShowS

Eq DataDecl # 
Instance details

Defined in Test.Testable.Data

Methods

(==) :: DataDecl -> DataDecl -> Bool

(/=) :: DataDecl -> DataDecl -> Bool

Ord DataDecl # 
Instance details

Defined in Test.Testable.Data

Methods

compare :: DataDecl -> DataDecl -> Ordering

(<) :: DataDecl -> DataDecl -> Bool

(<=) :: DataDecl -> DataDecl -> Bool

(>) :: DataDecl -> DataDecl -> Bool

(>=) :: DataDecl -> DataDecl -> Bool

max :: DataDecl -> DataDecl -> DataDecl

min :: DataDecl -> DataDecl -> DataDecl

data DataCon #

Representatio of data constructor.

Constructors

DataCon 

Fields

Instances

Instances details
Data DataCon # 
Instance details

Defined in Test.Testable.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DataCon -> c DataCon

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DataCon

toConstr :: DataCon -> Constr

dataTypeOf :: DataCon -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DataCon)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DataCon)

gmapT :: (forall b. Data b => b -> b) -> DataCon -> DataCon

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DataCon -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DataCon -> r

gmapQ :: (forall d. Data d => d -> u) -> DataCon -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> DataCon -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> DataCon -> m DataCon

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DataCon -> m DataCon

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DataCon -> m DataCon

Read DataCon # 
Instance details

Defined in Test.Testable.Data

Methods

readsPrec :: Int -> ReadS DataCon

readList :: ReadS [DataCon]

readPrec :: ReadPrec DataCon

readListPrec :: ReadPrec [DataCon]

Show DataCon # 
Instance details

Defined in Test.Testable.Data

Methods

showsPrec :: Int -> DataCon -> ShowS

show :: DataCon -> String

showList :: [DataCon] -> ShowS

Eq DataCon # 
Instance details

Defined in Test.Testable.Data

Methods

(==) :: DataCon -> DataCon -> Bool

(/=) :: DataCon -> DataCon -> Bool

Ord DataCon # 
Instance details

Defined in Test.Testable.Data

Methods

compare :: DataCon -> DataCon -> Ordering

(<) :: DataCon -> DataCon -> Bool

(<=) :: DataCon -> DataCon -> Bool

(>) :: DataCon -> DataCon -> Bool

(>=) :: DataCon -> DataCon -> Bool

max :: DataCon -> DataCon -> DataCon

min :: DataCon -> DataCon -> DataCon

canonizeData :: DataDecl -> DataDecl #

Get canonical representation of data type, that is such that data constructor order is sorted.

deepCanonizeData :: DataDecl -> DataDecl #

Canonize also data field order, in addition to data constructor order (as done by canonizeData).