3 ms·
module Comment where import Control.Exception (assert) class Loveable thing where loves :: Person -> thing -> Bool instance Loveable ScrewDriver wh
by kevbin 16y ago
module Comment where
import Control.Exception (assert)
class Loveable thing where
loves :: Person -> thing -> Bool
instance Loveable ScrewDriver where
_ `loves` PhillipsHead = False
instance Loveable ProgrammingLanguage where
Me `loves` Haskell = True
TheOtherGuy `loves` Haskell = True
_ `loves` _ = False
data ScrewDriver = FlatHead | PhillipsHead | Torx
data ProgrammingLanguage = Haskell | Lisp | Scheme
data Person = You | Me | TheOtherGuy
implies a b = if a then assert True b else assert True True
argument person = (not (person `loves` PhillipsHead)) `implies` (not (person `loves` Haskell))
check a = mapM (print . a) [You, Me, TheOtherGuy]
Comment> check argument
True
False
False