I want use Haskell higher order function Foldr to calculate the length of a string
stringlength = foldr (\_n -> 1 + n) 0
it give following error.what is the problem with this code?
Unresolved top-level overloading
*** Binding : stringlength
*** Outstanding context : (Num b, Num (b -> b))
You need to add a space to your pattern matching
currently you are matching against a single variable
_ninstead of against_andn, as you probably want to.