algae icon indicating copy to clipboard operation
algae copied to clipboard

Foldable laws?

Open toraritte opened this issue 5 years ago • 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:

toraritte avatar Mar 14 '19 15:03 toraritte