Tutorial "Hello World" won't compile

Just started working through the Plutus Playground tutorial:

https://playground.plutus.iohkdev.io/tutorial/tutorials/plutus-playground.html

The Hello world example from the tutorial:

-- | A 'Contract' that logs a message.
hello :: Contract BlockchainActions T.Text ()
hello = logInfo @String "Hello, world"

Generates the error:

 error:
    Variable not in scope: schemas :: [FunctionSchema FormSchema]
   |
31 | main = printSchemas (schemas, registeredKnownCurrencies, iotsDefinitions)
   |                      ^^^^^^^

Looks like some default main code is added? None of the import statements that I tried resolve this.

I just popped on the playground and it compiled for me … did you remove any of the imports or make changes not shown in your post?

import qualified Data.Text                 as T
import           Language.Plutus.Contract  hiding (when)
import           Language.PlutusTx.Prelude
import           Playground.Contract

-- | A 'Contract' that logs a message.
hello :: Contract BlockchainActions T.Text ()
hello = logInfo @String "Hello, world"

endpoints :: Contract BlockchainActions T.Text ()
endpoints = hello

mkSchemaDefinitions ''BlockchainActions

$(mkKnownCurrencies [])

1 Like

Ohh, yep that works fine. I assumed I should delete the contract boilerplate. Thanks :slight_smile:

Classic case of cart before the horse then :wink:

Try not to think of it like traditional development where snippets can be executed out of context. In purely functional programming paradigms the context or your inputs and outputs is pretty much everything!

The snippet of declaring and assigning the hello variable here is meaningless without the text parameter being passed into the logInfo function which is curried as a blockchain action which is part of a playground contract that has a schema and so on and so forth.