demo_monoid1 = do
  print ((Sum (Complex 1 2)) <> mempty)
  print ((Sum (Complex 1 2)) <> ((Sum (Complex 2 3)) <> (Sum (Complex 3 4))))
  print (((Sum (Complex 1 2)) <> (Sum (Complex 2 3))) <> (Sum (Complex 3 4)))
  print (mconcat [(Sum (Complex 1 2)), (Sum (Complex 2 3))])
  print (mconcat (map Sum [(Complex 1 2), (Complex 2 3)]))
  {-
  analysis of precedence:
    1. Function application has higher precedence than any infix operator
    2. infixr 9 .
    3. infixr 0 $
  So first apply map with Sum. Then combine mconcat with (map Sum). Finally apply
  this combined function to [...]
  -}
  print (mconcat . map Sum $ [(Complex 1 2), (Complex 2 3)])
  print ((mconcat . (map Sum)) [(Complex 1 2), (Complex 2 3)])
demo_monoid1 = do
  print ((Sum (Complex 1 2)) <> mempty)
  print ((Sum (Complex 1 2)) <> ((Sum (Complex 2 3)) <> (Sum (Complex 3 4))))
  print (((Sum (Complex 1 2)) <> (Sum (Complex 2 3))) <> (Sum (Complex 3 4)))
  print (mconcat [(Sum (Complex 1 2)), (Sum (Complex 2 3))])
  print (mconcat (map Sum [(Complex 1 2), (Complex 2 3)]))
  {-
  analysis of precedence:
    1. Function application has higher precedence than any infix operator
    2. infixr 9 .
    3. infixr 0 $
  So first apply map with Sum. Then combine mconcat with (map Sum). Finally apply
  this combined function to [...]
  -}
  print (mconcat . map Sum $ [(Complex 1 2), (Complex 2 3)])
  print ((mconcat . (map Sum)) [(Complex 1 2), (Complex 2 3)])
demo_monoid1 = do
  print ((Sum (Complex 1 2)) <> mempty)
  print ((Sum (Complex 1 2)) <> ((Sum (Complex 2 3)) <> (Sum (Complex 3 4))))
  print (((Sum (Complex 1 2)) <> (Sum (Complex 2 3))) <> (Sum (Complex 3 4)))
  print (mconcat [(Sum (Complex 1 2)), (Sum (Complex 2 3))])
  print (mconcat (map Sum [(Complex 1 2), (Complex 2 3)]))
  {-
  analysis of precedence:
    1. Function application has higher precedence than any infix operator
    2. infixr 9 .
    3. infixr 0 $
  So first apply map with Sum. Then combine mconcat with (map Sum). Finally apply
  this combined function to [...]
  -}
  print (mconcat . map Sum $ [(Complex 1 2), (Complex 2 3)])
  print ((mconcat . (map Sum)) [(Complex 1 2), (Complex 2 3)])