Why is the following not allowed?
revList :: [Integer] -> [Integer]
revList [] = []
revList = go []
where
go acc [] = acc
go acc (x:xs) = go (x:acc) xs
I get that removing the second line lets is compile, but I'd like to understand why. The type for revList
is the same for both definitions, no? Also, I thought I could put has many patterns as I like, and the first match will be chosen. So I don't quite understand what is the problem here.