I wrote a function to find if a character is a duplicate in a string.
The way it is defined, the function when called
isDuplicate 'b' "abbey" False it will return
How can it refactored to eliminate
Bool as one of the arguments/parameters?
Defining a helper function will get the job done, but is that the only solution?
isDuplicate : Char -> String -> Bool -> Bool isDuplicate xs word_ foundAlready = case ( String.uncons word_, foundAlready ) of ( Nothing, _ ) -> False ( Just ( first, rest ), _ ) -> let foundNow = Char.toLower first == xs in if foundNow && foundAlready then True else isDuplicate xs rest (foundNow || foundAlready)