Skip to content

Enable plinth-tx-plugin to be built with ghc912#7558

Merged
zeme-wana merged 20 commits intomasterfrom
plinth912
Feb 11, 2026
Merged

Enable plinth-tx-plugin to be built with ghc912#7558
zeme-wana merged 20 commits intomasterfrom
plinth912

Conversation

@zeme-wana
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread plutus-tx-plugin/plutus-tx-plugin.cabal Outdated
buildable: False
-- if (impl(ghc <9.6) || impl(ghc >=9.7))
-- buildable: False
buildable: True
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Temporary: proper if guard to be added later

-- we won't accept any applications of fromString that aren't creating literals of
-- the types we support.
(strip -> GHC.Var (GHC.idDetails -> GHC.ClassOpId cls))
(strip -> GHC.Var (GHC.idDetails -> GHC.ClassOpId cls True))
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Haddock for ClassOpId:

True <=> given a non-bottom dictionary, the class op will
definitely return a non-bottom result
and Note [exprOkForSpeculation and type classes]
in GHC.Core.Utils

Copy link
Copy Markdown
Collaborator Author

@zeme-wana zeme-wana left a comment

Choose a reason for hiding this comment

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

Added comments

@zeme-wana zeme-wana added the No Changelog Required Add this to skip the Changelog Check label Feb 2, 2026
@zeme-wana zeme-wana force-pushed the plinth912 branch 2 times, most recently from dc4660f to b6eed25 Compare February 4, 2026 17:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 4, 2026

Execution Budget Golden Diff

fdddd7d (master) vs 8ba005e

output

This comment will get updated when changes are made.

@zeme-wana zeme-wana linked an issue Feb 4, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Member

@zliu41 zliu41 left a comment

Choose a reason for hiding this comment

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

Do we have 9.12 in CI? It's hard to tell.

-- we won't accept any applications of fromString that aren't creating literals of
-- the types we support.
(strip -> GHC.Var (GHC.idDetails -> GHC.ClassOpId cls))
(strip -> GHC.Var cls)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the reason for this change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

GHC912 changed how overloaded strings are compiled, they use fromString @_... "" which I wasn't able to match if I had it match ClassOpId.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then this variable should not be called "cls" anymore, since it is no longer a Class. It is now an IdDetails.

consume li >>= traverse compileExpr
buildList _ = err

{- FOURMOLU_DISABLE -} -- Fourmolu can't parse non-top-level #if directives
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Disabling fourmolu for such a large function isn't ideal. You can create a PlutusTx.Compiler.Compat module and put all the CPP there.

@zeme-wana zeme-wana force-pushed the plinth912 branch 3 times, most recently from b05da95 to 97acd9d Compare February 6, 2026 09:13
Copy link
Copy Markdown
Member

@zliu41 zliu41 left a comment

Choose a reason for hiding this comment

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

Looks good, just two minor comments

-- we won't accept any applications of fromString that aren't creating literals of
-- the types we support.
(strip -> GHC.Var (GHC.idDetails -> GHC.ClassOpId cls))
(strip -> GHC.Var cls)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then this variable should not be called "cls" anymore, since it is no longer a Class. It is now an IdDetails.

`GHC.App` _dict
`GHC.App` (strip -> content)
| GHC.getName cls == GHC.isStringClassName -> do
| GHC.getName cls == GHC.isStringClassName || GHC.getName cls == GHC.fromStringName -> do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cls can no longer possibly match GHC.isStringClassName since it is no longer a Class.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should be able to simply bind this variable on the GHC.Var itself, i.e., (strip -> var)

@zeme-wana zeme-wana merged commit ea541ef into master Feb 11, 2026
8 checks passed
@zeme-wana zeme-wana deleted the plinth912 branch February 11, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support GHC 9.12 for plutus-tx-plugin

3 participants