group package:base-compat

The group function takes a stream and returns a list of streams such that flattening the resulting list is equal to the argument. Moreover, each stream in the resulting list contains only equal elements. For example, in list notation:
'group' $ 'cycle' "Mississippi"
= "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ...
group1 operates like group, but uses the knowledge that its input is non-empty to produce guaranteed non-empty output.
groupAllWith operates like groupWith, but sorts the list first so that each equivalence class has, at most, one list in the output
groupBy operates like group, but uses the provided equality predicate instead of ==.
groupBy1 is to group1 as groupBy is to group.
groupWith operates like group, but uses the provided projection when comparing for equality
The class of semigroups (types with an associative binary operation). Instances should satisfy the following:
  • Associativity x <> (y <> z) = (x <> y) <> z
You can alternatively define sconcat instead of (<>), in which case the laws are: