HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulegenvalidity-sydtest-1.0.0.0Haskell2010

Test.Syd.Validity.Monad

Monad properties

You will need TypeApplications to use these.

  • 3 values
valuemonadSpecOnGens
  1. :: (Show a, Show (f a), Show (f b), Show (f c), Eq (f a), Eq (f b), Eq (f c), Monad f, Typeable f, Typeable a, Typeable b, Typeable c)
  2. => Gen a
  3. -> String
  4. -> Gen (f a)
  5. -> String
  6. -> Gen (f b)
  7. -> String
  8. -> Gen (a -> b)
  9. -> String
  10. -> Gen (a -> f b)
  11. -> String
  12. -> Gen (b -> f c)
  13. -> String
  14. -> Gen (f (a -> b))
  15. -> String
  16. -> Spec
#

Standard test spec for properties of Monad instances for values generated by given generators (and names for those generator).

Example usage:

monadSpecOnGens
    @[]
    @Int
    (pure 4)
    "four"
    (genListOf $ pure 5)
    "list of fives"
    (genListOf $ pure 6)
    "list of sixes"
    ((*) <$> genValid)
    "factorisations"
    (pure $ \a -> [a])
    "singletonisation"
    (pure $ \a -> [a])
    "singletonisation"
    (pure $ pure (+ 1))
    "increment in list"