How to remove the parentheses marked with ^
, without introducing new names? (better if it can be splitted into multiple lines)
liftM2 (+) (somefunc arg1 (get arg2)) (somefunc arg3 (get arg3))
^ ^ ^ ^
-
You can get rid of the last one by using $
, but the other one cannot obviously be removed without introducing new names. A better solution may be to use the fact that any Monad m
should also be Applicative
and Functor
(and will be, come GHC 7.10)
Your example then becomes
import Control.Applicative ((<$>), (<*>))
(+) <$> somefunc arg1 (get arg2) <*> somefunc arg3 (get arg3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With