I want to do Integer pattern matching on-chain but always get an error:

GHC Core to PLC plugin: E042:Error: Unsupported feature: Use of Haskell Integer equality, possibly via the Haskell Eq typeclass Context: Compiling expr...

It seems to relate to this piece of code:

checkMint :: Integer -> Bool
checkMint (1)  = True
checkMint (-1) = True
checkMint _    = False

It seems that it uses the Prelude Integer equality operator instead of PlutusTx.Prelude. But how can I change that instead of rewriting the function and make it us PlutusTx.Prelude (==) instead?

  • 1
    Have you tried adding the pragma {-# LANGUAGE NoImplicitPrelude #-} ? This make sure that the standard prelude is not imported. This prevents the use of the Haskell Eq type class instead of the Plutus one.
    – Fermat
    Jul 12, 2022 at 7:20
  • 1
    Yes, good point. It was indeed the problem of using the standard haskell == pattern match. I resolved it by slightly rewriting this function bc I still need the Haskell Prelude in my code.
    – Will
    Jul 12, 2022 at 11:48

1 Answer 1


There is problem with pattern matching on Integer types according to Input Output Global. The Plutus compiler will currently reject any pattern matching on Integer types.

Therefore the best solution is to adjust the code in the following way:

checkMint :: Integer -> Bool
checkMint i
    | i == 1    = True
    | i == -1   = True
    | otherwise = False

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.