Here are the many interesting Monoids

String concatenation

The identity: empty string The operation: concatenation

("dog" ++ "cat") ++ "pig" = "dog" ++ ("cat" ++ "pig") "" ++ "dog" = "dog" ++ "" = "dog"

Addition, subtraction, multiplication on Integer

The identity: 0 The operation: Add

1 + 2 + 3 = 1 + (2 + 3) 0 + 1 = 1 + 0 = 1

Maximum(, ) and Minimum(, )

The identity: Mininum, Maximum The operation: Maximum( , ), Minimum( , )

Max(Max(a, b), c) = Max(a, Max(b, c)) Max(Min, a) = a Min(Min(a, b), c) = Min(a, Min(b, c)) Min(Max, a) = a

Boolean operations: Or and And

Identity: True Operation: Or Identity: False Operation: And

True || False = False || True = False False && True = True && False = False

Length Operation is monoid

Identity: [], empty list Operation: length

length [] + length [1] = length [1] + length [] length [1, 2] + length [3, 4] + length [5] = length [1, 2] + (length [3, 4] + length [5])

Merge sorted list is monoid

Identity: [] Operation: merge

(+++:)::(Ord a)=>[a]->[a]->[a] (+++:) xs [] = xs (+++:) [] ys = ys (+++:) (x:xs) (y:ys) = if x <= y then x:(xs +++: (y:ys)) else y:((x:xs) +++: ys) main = do pp $ [] +++: [1] == [1] -- left identity pp $ [2] +++: [] == [2] -- right identity pp $ [2] +++: [1] == [1, 2] -- a, b \in S, then a `op` b \in S pp $ [1, 2] +++: [0, 1, 9, 10] == [0, 1, 1, 2, 9, 10] -- associativity pp $ ([1, 2] +++: [0, 1] +++: [4, 5]) == ([1, 2] +++: ([0, 1] +++: [4, 5]))