ClassLaws- Stating and checking laws for type class methods

Safe HaskellNone



This module collects the infrastructure used to easily switch between testing ClassLaws with or without partial values. Built around QuickCheck and ChasingBottoms.



newtype Partial a Source

A modifier to indicate that partial values should be generated (or tested, or both).




unPartial :: a


Show (Partial Bool) 
Show (Partial Char) 
(Enum e, Bounded e, Show (Partial e), Show (Partial b)) => Show (Partial (e -> b)) 
Show (Partial Int) 
Show (Partial Ordering) 
Show (Partial ()) 
(Show (Partial a), Show (Partial b)) => Show (Partial (a, b)) 
(Show (Partial a), Show (Partial b), Show (Partial c)) => Show (Partial (a, b, c)) 
(Bounded a, Enum a, Show (Partial a)) => Show (Partial (Endo a)) 
(Enum s, Bounded s, Show (Partial a), Show (Partial s)) => Show (Partial (SS s a)) 
(Enum s, Bounded s, Show (Partial a), Show (Partial s)) => Show (Partial (State s a)) 
(Show (Partial a), Show (Partial b)) => Show (Partial (Pair a b)) 
TestablePartial prop => Testable (Partial prop) 

class TestablePartial prop whereSource

Declaring a property for possibly partial values.

showPartial :: String -> (a -> String) -> a -> StringSource

Helper for showing partial values

genPartial :: Int -> Int -> Gen a -> Gen aSource

Helper for generating partial values: genPartial ib ia ga generates bottom with frequence ib and ga with frequency ia.