haskell - How to use non-monadic functions in a bind operation -
i sense should know this, how utilize frommaybe
in 1 line instead of breaking 2 let
?
main = maybeport <- lookupenv "port" allow port = frommaybe "4020" maybeport putstrln $ "listening on:" ++ port
you can utilize fmap
or <$>
this:
import control.applicative ((<$>)) main = port <- frommaybe "4020" <$> lookupenv "port" putstrln $ "listening on:" ++ port
haskell monads
No comments:
Post a Comment