I am trying to learn Haskell. Currently I am making a function that should take a [String] and 'char' and return in how many strings this char presents.
count [] _ = 0
count (x:xs) v
| elem v x = 1 + count xs
| otherwise = 0 + count xs
How is it done correctly?
!EDIT
I get this error ::
Occurs check: cannot construct the infinite type: a ~ a1 -> a
Relevant bindings include
v :: a1 (bound at prog.hs:7:14)
xs :: [t a1] (bound at prog.hs:7:10)
x :: t a1 (bound at prog.hs:7:8)
count :: [t a1] -> a1 -> a (bound at prog.hs:6:1)
In the second argument of `(+)', namely `count xs'
In the expression: 1 + count xs