hd :: [a] -> a hd (x : _) = x main :: IO () main = do print (Main.reverse ([1,2,3]::[Int])) print (hd []::[String]) reverse :: [a] -> [a] reverse l = reverseAcc l [] where reverseAcc [] a = a reverseAcc (x:xs) a = reverseAcc xs (x:a)