How to avoid checking for empty value in Haskell?
I'm trying to grasp how Haskell programs can avoid testing for "empty
value". I am struggling to get rid of case expression in this program:
main = do url:outputPath:[] <- getArgs
let maybeUri = parseURI url
case maybeUri of
Just uri -> download uri outputPath
Nothing -> return ()
My very rough understanding is that I should use monad transformer so that
I can use single mappend on Maybe value within IO monad and 'do' syntax
should be able to support it. How can I achieve this?
No comments:
Post a Comment