purescript-contrib / purescript-quickcheck-laws

QuickCheck powered law tests for PureScript's core typeclasses.
MIT License
25 stars 18 forks source link

Add checks for Foldable #20

Closed jacereda closed 7 years ago

garyb commented 7 years ago

I think Foldable is technically lawless, but these look like good properties to have even if they're not officially required. Thanks!

jacereda commented 7 years ago

I thought it had laws because http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Foldable.html states that

Foldable instances are expected to satisfy the following laws:

foldr f z t = appEndo (foldMap (Endo . f) t ) z foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z fold = foldMap id

and

If the type is also a Functor instance, it should satisfy

foldMap f = fold . fmap f

jacereda commented 7 years ago

Oh, right. I'll remove it.