-
-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
The behavior of Semigroup.foldRight and Monoid.foldRight is different for non-commutative operations. For monoids, we have:
Lazy<String> resultMonoid = Monoid.monoid(String::concat, "").foldRight("", Arrays.asList("1", "2", "3", "4"));
resultMonoid.value()
// "1234"For semigroups:
Lazy<String> resultSemigroup = ((Semigroup<String> String::concat)).foldRight("", Arrays.asList("1", "2", "3", "4"));
resultSemigroup.value()
// "4321"It appears the order of arguments is reversed inside fmap of the semigroup implementation (source). Is there motivation for this difference between foldRight in the two algebras?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels