plutus icon indicating copy to clipboard operation
plutus copied to clipboard

`asData` should generate INLINEABLE pragmas

Open ana-pantilie opened this issue 11 months ago • 0 comments

The idea is to avoid having to add pragmas by hand in the case of asData. Sometimes GHC renames the TH generated pattern synonyms or the functions from the TH generated pattern synonym records and we don't want that. This can be done in this code: https://github.com/IntersectMBO/plutus/blob/e9b258319b09c2fa657b56841db6ab1cb9db4c6d/plutus-tx/src/PlutusTx/AsData.hs#L146.

I've tried to do this but for some reason GHC is fine when defining it manually in Haskell with <PatternName> but the constructor names we have access to in TH are of the form <PatternName>_<number>. Example error:

src/PlutusLedgerApi/V3/Data/Contexts.hs:515:1: error: [GHC-55017]
    Illegal variable name: 'TxInfo'
    When splicing a TH declaration: {-# INLINABLE TxInfo_0 #-}
    |
515 | PlutusTx.asData

ana-pantilie avatar Dec 13 '24 15:12 ana-pantilie