I want to return a String in a list that contains only Digits. I am trying to use the find function to achieve this but am having trouble creating the predicate. Here is what I have attempted:
getYear str | hasYear str = fromJust $ find (map and $ (map.map) isDigit ws) ws
| otherwise = "0"
where ws = words str
I have noticed that my predicate
map and $ (map.map) isDigit ws
returns a [Bool] with True if one of the Strings contains only digits but isn’t designed correctly for use in this instance.
There is also the handy
which can be used to write your function