I'm getting the following error, if I try to execute my x_length
function, that should measure the length of a given list:
Exception: test.hs:2:1-36: Non-exhaustive patterns in function x_length
I load my test.hs
file into ghci with Prelude>:l test.hs
.
The implementation of the x_length
function is (within the test.hs
file):
x_length :: [Int] -> Int
x_length (x:xs) = 1 + x_length xs
I've already figured out, that it has to do something with loading the test.hs
file, but I haven't figured out, how to solve this issue.
The actual function call I do with x_length [1,2,3,4]
.