Skip to content

Instantly share code, notes, and snippets.

@tel
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tel/9070be588f9cb159ee14 to your computer and use it in GitHub Desktop.
Save tel/9070be588f9cb159ee14 to your computer and use it in GitHub Desktop.
instance Monoid Bool where
mempty = True
x <> y = x == y
[ mempty <> x == x ]
True <> True == True
True <> False == False
[ x <> mempty == x ]
-- dispatched by symmetry of (==)
[ (x <> y) <> z == x <> (y <> z) ]
x y z x <> y y <> z (x <> y) <> z x <> (y <> z)
T T T T T T T
T T F T F F F
T F T F F F F
T F F F T T T
F T T F T F F
F T F F F T T
F F T T F T T
F F F T T F F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment