I am new to functional programming and Haskell. Trying to learn it. Not sure what is wrong with the following definition:
Function definition in test.h
drop5 [a] = drop 5 [a]
Trying to use this function I get Program error
$:load test.h
$drop5 [2,3,4,5,6,7,8]
Program error: pattern match failure: drop5 [2,3,4,5,6,7,8]
$:t drop5
drop5 :: [a] -> [a]
When I change the definition to following it works; meaning it takes a list and drops first 5 elements of the list
drop5 ns = drop 5 ns
And in this case when print type I see:
$:t drop5
drop5 :: [a] -> [a]
I am not sure why is the first definition different than second? And what does the error "Program error: pattern match failure means"?