xor in Haskell

Haskell

Public Domain

xor function/operator in Haskell

Download (right click, save as, rename as appropriate)

Embed

1
2
3
4
infixr 2 `xor`  -- same precedence & associativity as (||)
xor :: Bool -> Bool -> Bool
xor True p = not p
xor False p = p