Skip to content

Instantly share code, notes, and snippets.

View ab9rf's full-sized avatar

Kelly Kinkade ab9rf

  • Western Suburban Chicagoland, Illinois
  • 23:25 (UTC -05:00)
View GitHub Profile
@Solonarv
Solonarv / bool-is-a-number.hs
Last active August 2, 2018 03:14
Silly instances.
{-# language LambdaCase #-}
-- Note: this is just the GF(2) field.
instance Num Bool where
(+) = (/=) -- XOR
(*) = (&&)
abs = id
signum = id
fromInteger = (/= 0) . (`mod` 2)