Safe Haskell | Safe-Infered |
---|

Properties for testing that instances of the `Functor`

class
perform correctly.

This testing requires an `Eq`

instance, which not all `Functor`

s
actually have. It also requires a `Show`

instance, which is also
uncommon. The `Label1`

wrapper may be useful in dealing with the
`Show`

requirement.

Tests are supplied both in regular "unlabelled" form, and also
in a special "labelled" form, where function objects have
`Label`

s attached to them. Because of this, the function used for
each test can be recorded in the test log, which can be quite
helpful.

- p_map_id :: (Functor f, Eq (f x), Show (f x)) => f x -> Test
- p_map_compose :: (Functor f, Eq (f z), Show (f x), Show (f y), Show (f z)) => f x -> (x -> y) -> (y -> z) -> Test
- p_Functor :: (Functor f, Eq (f x), Show (f x)) => [f x] -> [x -> x] -> Test
- p_map_compose_L :: (Functor f, Eq (f z), Show (f x), Show (f y), Show (f z)) => f x -> Label (x -> y) -> Label (y -> z) -> Test
- p_Functor_L :: (Functor f, Eq (f x), Show (f x)) => [f x] -> [Label (x -> x)] -> Test

# Unlabelled tests

p_map_compose :: (Functor f, Eq (f z), Show (f x), Show (f y), Show (f z)) => f x -> (x -> y) -> (y -> z) -> TestSource

p_Functor :: (Functor f, Eq (f x), Show (f x)) => [f x] -> [x -> x] -> TestSource

Given a list of *distinct* `Functor`

values and functions, perform
all tests on all combinations of inputs. (If the inputs are not
distinct, some redundant tests will be performed.)

The argument types are somewhat constrained to keep the type signature reasonably simple.

# Labelled tests

p_map_compose_L :: (Functor f, Eq (f z), Show (f x), Show (f y), Show (f z)) => f x -> Label (x -> y) -> Label (y -> z) -> TestSource

p_Functor_L :: (Functor f, Eq (f x), Show (f x)) => [f x] -> [Label (x -> x)] -> TestSource

Given a list of *distinct* `Functor`

values and functions, perform
all tests on all combinations of inputs. (If the inputs are not
distinct, some redundant tests will be performed.)

The argument types are somewhat constrained to keep the function's type signature reasonably simple.