I have a string and a list lst of string and I should return nothing if the lst does not contains the given string or just list' where list' is identic to the lst except that the first occurene of the given string removed.
allExcept :: [Char] -> [[Char]] -> Maybe [[Char]]
allExcept ch1 chars
| ch1 `notElem` chars = Nothing
allExcept ch [] = []
allExcept ch (x:xs)
| ch /= x = Just(x:(fromJust(allExcept ch xs)))
| otherwise = Just(xs)
the result of my code is : Not in scope: `fromMaybe'
You need to import the Data.Maybe module:
import Data.Maybe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With