0

in my cabal repl, i'm getting the following error from trying to replicate the week1 demo of Plutus-pioneer-program. I'm also unable to simulate the example scenario in the playground (i can see genesis transaction, but none of the subsequent bids), but I'm hoping the issue lies here:

Prelude Ledger.TimeSlot Week01.EnglishAuction> slotToEndPOSIXTime 10

<interactive>:10:20: error:
    • No instance for (Num SlotConfig) arising from the literal ‘10’
    • In the first argument of ‘slotToEndPOSIXTime’, namely ‘10’
      In the expression: slotToEndPOSIXTime 10
      In an equation for ‘it’: it = slotToEndPOSIXTime 10
Prelude Ledger.TimeSlot Week01.EnglishAuction> 

1 Answer 1

0

That error occurs because your code has a number literal (ie 10) in a code position where a value of type SlotCOnfig is expected and the the compiler can't figure out how to convert the literal to a SlotConfig (ie "No instance for (Num SlotConfig)").

I would need to see more of the code (possibly all of it) to figure out a solution.

Ah, so the type of slotToEndPOSIXTime is:

slotToEndPOSIXTime :: SlotConfig -> Slot -> POSIXTime

Getting a correct SlotConfig value is going to be tricky, but the good news is that Slot does have a Num instance, so the literal 10 is a valid slot.

3
  • I'm not sure what other context to provide. The complete one-line command was simply that: slotToEndPOSIXTime 10
    – tyvan266
    Dec 15, 2022 at 0:19
  • Five lines, the like to error occurs on and two lines before and after. Also what is the type of the function slotToEndPOSIXTime ? Dec 15, 2022 at 0:57
  • I expanded the answer I gave above. Basically the problem is that you can calling the slotToEndPOSIXTime with one parameter (10) when it really needs two parameters; a SlotConfig type and then the 10 that you are currently giving it. Dec 15, 2022 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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