3 ms·
"Have the data flow in one direction" is a good rule of thumb in writing clear Haskell code. That said, your conversion away from $ changes the meaning here (i
by dllthomas 7y ago
"Have the data flow in one direction" is a good rule of thumb in writing clear Haskell code.
That said, your conversion away from $ changes the meaning here (in a way that doesn't typecheck, I think - remember that regular function application binds tightest whereas dollar binds loosest) and you still don't achieve your goal.
Instead, maybe
return . fromMaybe defaultPort $ readMaybe =<< maybeEnvPort
or even
return $ fromMaybe defaultPort $ readMaybe =<< maybeEnvPort
If you still don't like the dollar signs, we can parenthesize instead in two correct ways, although I don't find them more readable:
(return . fromMaybe defaultPort) (readMaybe =<< maybeEnvPort)
return (fromMaybe defaultPort (readMaybe =<< maybeEnvPort))