Implementation of function “member” using “foldr” in Haskell
问题 I tried like that: member e [] = False member e xs = foldr (==) e xs and then: member 3 [1,2,3,4,5] and I get this error message: No instance for (Num Bool) arising from the literal `3' In the first argument of `memb', namely `3' I don't know what it means... can someone help me? PS: member is a function that, given a element and a list of elements, returns whether the element belongs to that list or not. The usual implementation is: member a [] = False member a (x:xs) | (a == x) = True |