all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,18 @@
module ShortCircuit where
import Prelude hiding ((&&), (||))
import Debug.Trace
False && _ = False
True && False = False
_ && _ = True
True || _ = True
False || True = True
_ || _ = False
a p = trace ("<a " ++ show p ++ ">") p
b p = trace ("<b " ++ show p ++ ">") p
main = mapM_ print ( [ a p || b q | p <- [False, True], q <- [False, True] ]
++ [ a p && b q | p <- [False, True], q <- [False, True] ])

View file

@ -0,0 +1,7 @@
_ && False = False
False && True = False
_ && _ = True
_ || True = True
True || False = True
_ || _ = False

View file

@ -0,0 +1,11 @@
p && q = case p of
False -> False
_ -> case q of
False -> False
_ -> True
p || q = case p of
True -> True
_ -> case q of
True -> True
_ -> False