-
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
Split debug options #2094
Split debug options #2094
Conversation
* closes #1324
Autopause does not work well, let's wait for #2094 to clear things up.
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.
Looks great! Definitely a big improvement over the status quo.
@@ -64,10 +67,11 @@ cliParser = | |||
pausedAtStart <- paused | |||
autoPlay <- autoplay | |||
speed <- speedFactor | |||
debugOptions <- debug |
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.
I suggest something like this:
debugOptions <- debug | |
initialDebugOptions <- debug | |
let debugOptions = Set.union cheatMode initialDebugOptions |
Then we can get rid of the lambda + record update in the final return
.
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.
I might have underestimated the powers of ApplicativeDo after last issues. I will try this. 👍
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.
Nope, this is not accepted by ApplicativeDo.
app/game/Main.hs:62:13: error:
• No instance for (Monad Parser) arising from a use of ‘return’
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.
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.
Nope, that also needs a monad. I suppose it makes sense, how else would you write it in a a <$> ... <*> ...
style?
I added a comment and made the return a bit nicer.
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.
Oh, right, because it's referring to cheatMode
which is the result of a previous action. Actually, I now understand why let debug = Set.union cheatMode ...
is not accepted either---for the same reason.
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.
Now I don't even understand why the existing code works.
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.
@byorgey I imagine GHC constucts a suitable a
that puts everything in the right place:
(\c d o -> A (c + d) o) <$> cheat <*> debug <*> others
_uiCheatMode :: Bool
with_uiDebugOptions :: (Set DebugOption)
uiHideGoals
withuiIsAutoPlay
and debug optionShowGoalDialogsInAutoPlay
--debug
and make--cheat
an alias for--debug=creative
onlyIt even has shell completions:
--cheat
CLI option #1324