-
Notifications
You must be signed in to change notification settings - Fork 44
Add option to turn an arbitrary log entry into an error #2298
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
Add option to turn an arbitrary log entry into an error #2298
Conversation
kore/src/Kore/Log/KoreLogOptions.hs
Outdated
-} | ||
] | ||
|
||
notError :: String -> Bool |
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'm not really sure about this function, if the convention of how we name entry types ever changes we might forget to change this function as well. What do you think?
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.
Maybe we could split the registry from Registry into a collection of types which are errors and a collection with those which are not. This way, we can use the types directly here. Does this make sense and do you think this would be better?
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 didn't split registry
but entryTypeReps
and entryHelpDocs
. What do you think?
kore/src/Kore/Log/Registry.hs
Outdated
let textToType = (Map.fromList . map register) entryTypeReps | ||
let textToType = | ||
(Map.fromList . map register) | ||
$ entryTypeRepsNoErr <> entryTypeRepsErr |
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.
Why not entryTypeReps
?
kore/src/Kore/Log/Registry.hs
Outdated
|
||
entryTypeRepsErr, entryTypeRepsNoErr :: [SomeTypeRep] | ||
entryHelpDocsErr, entryHelpDocsNoErr :: [Pretty.Doc ()] | ||
((entryTypeRepsNoErr, entryHelpDocsNoErr), (entryTypeRepsErr, entryHelpDocsErr)) |
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.
Could this be formatted on multiple lines? I think it's kind of long and hard to read.
kore/src/Kore/Log/KoreLogOptions.hs
Outdated
@@ -201,12 +205,15 @@ parseEntryTypes = | |||
[ "Log entries: logs entries of supplied types" | |||
, "Available entry types:" | |||
, (OptPretty.indent 4 . OptPretty.vsep) | |||
(OptPretty.text <$> getEntryTypesAsText) | |||
( OptPretty.text | |||
<$> getNoErrEntryTypesAsText <> getErrEntryTypesAsText |
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 think this could remain getEntryTypesAsText
, and that function could be implemented in Registry
.
( (entryTypeRepsNoErr, entryHelpDocsNoErr) | ||
, (entryTypeRepsErr, entryHelpDocsErr) ) |
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.
( (entryTypeRepsNoErr, entryHelpDocsNoErr) | |
, (entryTypeRepsErr, entryHelpDocsErr) ) | |
( (entryTypeRepsNoErr, entryHelpDocsNoErr) | |
, (entryTypeRepsErr, entryHelpDocsErr) | |
) |
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.
This doesn't compile
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.
Ok, I was just thinking this would look nicer, but it's fine either way imo. Everything else looks ok to me.
Fixes #2285
Review checklist
The author performs the actions on the checklist. The reviewer evaluates the work and checks the boxes as they are completed.