
18 Nov
2017
18 Nov
'17
12:15 p.m.
Hey guys, Thiis is my function below: notThe :: String -> Maybe String notThe word | word /= "the" = Just word | word == [] = Just [] | otherwise = Nothing replaceThe :: String -> String replaceThe word = go (words word) where go (x:xs) | notThe x == Just [] = [] | notThe x == Just word = word ++ go xs | notThe word == Nothing = " a " ++ go xs
replaceThe "what" "what*** Exception: chap12.hs:(13,13)-(16,55): Non-exhaustive patterns in function go
I thought I covered all the potential patterns in my replaceThe function. I'm not sure what pattern I've missed, any thoughts? Best regards, Jim