witchcrafters/algae

Foldable laws?

toraritte opened this issue · 0 comments

From Foldable documentation:

People are working on Foldable properties. This is one of the exceptions to there needing to conform to properties.

PureScript's Foldable doesn't mention properties, but Haskell's does:

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
length = getSum . foldMap (Sum . const  1)

Documenting other useful sources found: