I'm a beginner learning Haskell, and I'm trying to write a function that does the same thing as the following function (rmCharsRec) using foldr:
rmChar :: Char -> String -> String
rmChar char xs = filter (/=char) xs
rmCharsRec :: String -> String -> String
rmCharsRec [] (y:ys) = (y:ys)
rmCharsRec (x:xs) (y:ys) = rmChar x (rmCharsRec xs (y:ys))
I'm not quite sure how can I make the infixed function in foldr check each Char in the second string.
Or am I going in the wrong direction here?