IntersectMBO / plutus

The Plutus language implementation and tools
Apache License 2.0
1.57k stars 476 forks source link

Plutus.V1.Ledger.Value uses OverloadedLists #4517

Closed phadej closed 2 years ago

phadej commented 2 years ago

Summary

... and sometimes when GHC does (or doesn't) something the code using that module fails to compile:

GHC Core to PLC plugin: E042:Error: Unsupported feature: Irreducible type family application: GHC.Exts.Item
Context: Compiling type: GHC.Exts.Item
                           [(Plutus.V1.Ledger.Value.CurrencySymbol,
                             PlutusTx.AssocMap.Map
                               Plutus.V1.Ledger.Value.TokenName GHC.Integer.Type.Integer)]

cc @brunjlar

Steps to reproduce the behavior

write scripts. In case I see, GHC produces coercions from [GHC.Exts.Item ...] to [(CurrencySymbol, AssocMap TokenName Integer)]. In other words, GHC doesn't see any reason to reduce Item type-family as it is just an intermediate type.

Actual Result

-

Expected Result

compilation works.

Describe the approach you would take to fix this

don't use OverloadedLists in plutus code.

System info

phadej commented 2 years ago

We are constantly hit by this bug. It's hard to reproduce as it seems to happen in incremental builds.

Please don't use OverloadedLists in plutus code (or make plutux-tx-plugin able to handle it).

bezirg commented 2 years ago

This is is resolved in master.

KristianBalaj commented 2 years ago

@bezirg Could you please link to a PR/commit that fixed this issue?

bezirg commented 2 years ago

@KristianBalaj it is the commit 4e0d6ed332b782367e68510808c38de90e04343c . The file change is https://github.com/input-output-hk/plutus/commit/4e0d6ed332b782367e68510808c38de90e04343c#diff-3b8075ee5603b10864a2c007bce39918b864164c81b94315607541f634203990

bezirg commented 2 years ago

@KristianBalaj Do you still run into a similar issue and needs to be reopened?

KristianBalaj commented 2 years ago

@bezirg sorry for the late reply, I've missed a notification.

No need to reopen I've checked whether the https://github.com/input-output-hk/plutus/commit/4e0d6ed332b782367e68510808c38de90e04343c commit hash is in the git log of this commit of plutus we're using https://github.com/input-output-hk/plutus/commit/a56c96598b4b25c9e28215214d25189331087244 It seems it's not. So it's okay that we're still experiencing the error.