Foldable laws?
toraritte opened this issue · 0 comments
toraritte commented
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:
- Stackoverflow thread explaining Haskell's
Foldable
laws - Haskell/Foldable on WikiBooks
- A Proposed Law for Foldable? from the Haskell mailing list
- Does Foldable have any laws? twitter thread