------------------------- if then else ----------------------- --------------------------- correct ------------------------- if (head [True, False]) then "true" else ['t','r', 'u', 'e'] if (head [True, False]) then 1 else 0 if True then 1 else 0 if True then (head [True, False]) else False if True then True else (head [False, True]) if True then "true" else ['t','r', 'u', 'e'] ------------------------- if then else ----------------------- --------------------------- wrong ------------------------- if (head (False, True)) then "true" else ['t','r', 'u', 'e'] if 1 then 1 else 0 if True then (head (True, False)) else False if True then True else (head (False, True)) if True then ('t','r', 'u', 'e') else ['t','r', 'u', 'e'] ------------------------- infix operation ----------------------- --------------------------- correct ------------------------- (head [1,2])+3 3+(head [1,2]) 1+2 ------------------------- infix operation ----------------------- --------------------------- wrong ------------------------- (head (1,2))+3 3+(head (1,2)) 1+'a' ------------------------- function operation ----------------------- --------------------------- correct ------------------------- (head [1,2])+3 (head [(+), (-), (*)]) 1 2 ------------------------- function operation ----------------------- --------------------------- wrong ------------------------- (head (1,2))+3 (head ((+), (-), (*))) 1 2 --------------------------- Uminus ----------------------- --------------------------- correct ------------------------- -1 --------------------------- Uminus ----------------------- --------------------------- wrong ------------------------- -[1] --------------------------- leftSection ----------------------- --------------------------- correct ------------------------- map ((head [10])-) [1,2] map ("string"++) ["lit"] --------------------------- leftSection ----------------------- --------------------------- wrong ------------------------- map ((head 10)-) [1,2] map ('s'++) ["lit"] --------------------------- List ----------------------- -------------------------- correct ------------------------- [(head [1,2]), 2] [1,(head [2,3]), 3] [(head [(+),(*)]), (-)] --------------------------- List ----------------------- -------------------------- wrong ------------------------- [(head (1,2)), 2] [1,(head (2,3)), 3] [(head [(+),(*)]), (++)] --------------------------- tuple ----------------------- -------------------------- correct ------------------------- ((head [1]), 2) (1,(head [2])) (1,(head [2]),3,4,5) -------------------------- tuple ----------------------- -------------------------- wrong ------------------------- ((head 1), 2) (1,(head 2)) (1,(head 2),3,4,5) -------------------------- arithSeq----------------------- --------------------------- correct ------------------------- [(head [1])..10] [1,(head [3])..10] [1,3..(head [10])] -------------------------- arithSeq----------------------- --------------------------- wrong ------------------------- [(head 1)..10] ['a'..10] [1,(head 3)..10] [1,'a'..10] [1,2..(head 10)] [1,3..'a'] -- Following are several invalid list expressions. -- they should return errors ... from the command line parser. 2:[True] True:[1] -- Following are several invalid expressions. -- they should return errors ... from the command line parser. fst () fst (1) fst (1,2,3) snd () snd (1) snd (1,2,3)