Write a Projection Function
Let's enrich our HelloWorld application by adding functionality that allows us to read the label we have just created.
To achieve this, we add a special type of function, a projection function. You can think of it as a read function and you can find more details about it under Interface.
We're adding a new file to accomodate our projection function.
~/HelloWorld/
We can now specify GetMessage.juvix
. It will take an encodedResource
parameter of type Nat
. As the name suggests, this is an encoded resource object which we will first apply anomaDecode
to, then access its label via Resource.label
. We finally retrieve the underlying String
type by applying another anomaDecode
.
GetMessage.juvix
In the following chapter, we will compile and "deploy" our code locally.
Last updated