Skip to content

Use ExtraText from output-blocks#349

Open
JNAOB wants to merge 5 commits intofmidue:masterfrom
JNAOB:use-ExtraText-from-output-blocks
Open

Use ExtraText from output-blocks#349
JNAOB wants to merge 5 commits intofmidue:masterfrom
JNAOB:use-ExtraText-from-output-blocks

Conversation

@JNAOB
Copy link
Collaborator

@JNAOB JNAOB commented Jan 23, 2026

CLOSE #281

where
extraText onNo _ NoExtraText = onNo
extraText _ func (Static s) = func s
extraText _ func (Collapsible _ s _) = func s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks suspicious. Information is being lost here, and then cannot be reconstructed in src/Formula/Parsing.hs. The printing and parsing should have a roundtrip property (printing an instance and then parsing it gives the back the original instance), which requires injectivity of the behavior here.

bonusText <- option NoExtraText (tokenSymbol "," *> (parser :: Parser ExtraText))
char ')'
pure $ PickInst cs (read index) (read printSol) (fromList . read <$> bonusText)
pure $ PickInst cs (read index) (read printSol) bonusText
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I‘m now wondering why all this parsing and pretty-printing work is happening in this repo at all.

@patritzenfeld, shouldn‘t this be handled on the Autotool side, using Reader and ToDoc instances, instead? That would likely obviate much of the code in the Parsing and Printing modules here.

Copy link
Member

@patritzenfeld patritzenfeld Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These instances for PickInst are indeed not required. This is an ancient relic from my bachelor's thesis. Deriving ToDoc and Reader in Autotool should provide the same functionality (and ExtraText is already an instance of those classes as well).

So all of the printing and parsing code for PickInst and ExtraText here can be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess PickInst is not the only type to which this applies, then?

Maybe there should be a separate pull request which removes (almost?) all of Parser.hs and Printing.hs, coordinated with corresponding changes in Autotool when calling the affected logic-tasks task types.

That other pull request could then be merged before this one here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, some of the types will still need custom instances instead of derived ones (mostly student input related). Since we now have the required Autotool libraries already in the stack.yaml, we could also define these Reader and ToDoc instances in this repo, just like modelling-tasks does.

In that case, instead of deleting the code, it could just be adapted slightly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we now have the required Autotool libraries already in the stack.yaml

I don't think that's true.

Let's make the minimal change here (in a separate PR): Remove all the parsing and printing that could instead be done with Reader and ToDoc instances in Autotool. Why that's not all of them, I don't yet understand, i.e., what student input has to do with it or prevents simply makinge all of the instances being written and parsed with just the generic/derived instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use collapsed for extraTexts

3 participants