I'm trying to return a Maybe value from a function that uses do notation, but I can't seem to get it to work. This function takes a string (The "filename") and a Path to search in...
findIn :: String -> Path -> Maybe Path
findIn search start = do
file <- ls start
if ((filename file) == search)
then Just file
else Nothing
Where...
ls :: Path -> Array Path
filename :: Path -> String
But I keep getting the error "Count not match Type Array with type Maybe", so it looks like the compiler is expecting the do notation to return an array. How would I return a maybe value?