There might be some more advanced library helpers, but I think you should first learn how to handle Maybe
s in the most basic (and general) way: use pattern matching.
case lookup situacio edges of Nothing -> [] -- not found, how do you want to handle this case? Just locs -> map describePath locs
Oftentimes, one wants instead to rewrap the result in another Maybe
, e.g.:
case lookup situacio edges of Nothing -> Nothing -- not found Just locs -> Just (map describePath locs)
and in such case, we can use a library helper function to shorten the code:
map describePath <$> lookup situacio edges