-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use forM_/mapM_ #2273
Use forM_/mapM_ #2273
Conversation
bb8122b
to
fa4d9b5
Compare
case capProviders of | ||
Nothing -> throwError $ Incapable FixByEquip (R.singletonCap cap) (TConst c) | ||
Just rawCosts -> payExerciseCost c rawCosts | ||
gets @Robot (constCapsFor c) >>= mapM_ go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, does it work to write gets @Robot (constCapsFor c) >>= mapM_ \cap -> do ...
? Either is fine though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that works, and I've changed it. However, I was unable to make the same change here (perhaps due to the $
operator).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's odd. Oh well.
getNormalizedCurrentScenarioPath >>= mapM_ go | ||
where | ||
go p = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot inline the lambda here
fa4d9b5
to
d58d237
Compare
Searched for instances of
return ()
andpure ()
, especiallyNothing -> return ()
, which uncovered several opportunities to usewhen/unless
andmapM_/forM_
.