Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class (Arbitrary (Repr a), Show (Repr a)) => Constructible a where
- data Constructed a = Constructed (Repr a) a
- pattern Construct :: a -> Constructed a
- mkConstructed :: Constructible a => Repr a -> Constructed a
The Constructible
class
class (Arbitrary (Repr a), Show (Repr a)) => Constructible a where Source #
A Constructible
type is associated with a type of "finite descriptions"
that can be generated, shown (e.g., as counterexamples in QuickCheck), and
interpreted as values.
This enhances Arbitrary
and Show
used by vanilla QuickCheck.
The main motivating example is the type of functions, which can be
finitely represented by the type (
(see also Test.Fun).:->
)
It turns out we can define Constructible
for just about anything
except IO
(for now...).
Instances
Constructible Bool Source # | |
Constructible Char Source # | |
Constructible Double Source # | |
Constructible Int Source # | |
Constructible Integer Source # | |
Constructible Ordering Source # | |
Constructible Word Source # | |
Constructible () Source # | |
Constructible a => Constructible [a] Source # | |
Constructible a => Constructible (Maybe a) Source # | |
Constructible a => Constructible (Identity a) Source # | |
Constructible a => Constructible (Sum a) Source # | |
(CoArbitrary Gen a, Constructible b) => Constructible (a -> b) Source # | |
(Constructible a, Constructible b) => Constructible (Either a b) Source # | |
(Constructible a, Constructible b) => Constructible (a, b) Source # | |
(CoArbitrary a, Function a, Show a, Constructible b) => Constructible (Fun a b) Source # | |
The Constructed
modifier
data Constructed a Source #
Constructible
wrapper with Show
and Arbitrary
instances
that operate on the representation of the argument type.
Deconstruct with the Construct
pattern.
This is only useful for property combinators from vanilla QuickCheck, that
use the original Testable
class instead of
Testable'
from this library.
Constructed (Repr a) a |
Instances
Constructible a => Show (Constructed a) Source # | |
Defined in Test.QuickCheck.HigherOrder.Internal.Constructible showsPrec :: Int -> Constructed a -> ShowS # show :: Constructed a -> String # showList :: [Constructed a] -> ShowS # | |
Constructible a => Arbitrary (Constructed a) Source # | |
Defined in Test.QuickCheck.HigherOrder.Internal.Constructible arbitrary :: Gen (Constructed a) # shrink :: Constructed a -> [Constructed a] # |
pattern Construct :: a -> Constructed a Source #
A unidirectional pattern to deconstruct Constructed
values.
mkConstructed :: Constructible a => Repr a -> Constructed a Source #
A smart constructor for constructible values.