11
votes
Accepted
What does @ prefix means?
It means type application.
In this case, the function is polymorphic with the following type:
logInfo :: forall a effs. Member (LogMsg a) effs => a -> Eff effs ()
by using TypeApplications ...
8
votes
Accepted
How can I find the Haskell source code for the sqrt function?
By entering :i sqrt using ghci, we can see that sqrt is
-- Defined in ‘GHC.Float’
A quick google shows that the source code repo is on https://gitlab.haskell.org/ghc/ghc.
Entering sqrt in the search ...
8
votes
Accepted
Why not just simply use Haskell instead of Plutus?
There are many reasons. For example:
You need tooling for the communication between the on-chain and the off-chain code and many other tasks.
You need tooling that generates code where the on-chain ...
5
votes
Logging in validator
You're running into trouble because logInfo is meant to be used inside the Contract monad. The Wallet code uses the Contract monad but the validator code doesn't.
If you're not familiar with how ...
5
votes
Accepted
Meaning of <$> notation
It's a functor map which is essentially an fmap function for the functor class. This might be of some use: https://www.fpcomplete.com/haskell/tutorial/operators/
5
votes
How to properly start a new Plutus project, from scratch
A well formatted question deserves a well formatted answer! I will go into some depths, but also keep some things at a “magical” level. This is a long read so take your time!
Before we start, it is ...
4
votes
Accepted
Understanding do notation with Monads in Plutus Pioneer Week 04
The 'secret' is in the bindWriter function that drive the Writer monad.
instance Monad Writer where
return a = Writer a []
(>>=) = bindWriter
It is the bindWriter function that ...
4
votes
Is there documentation on the Prerequisites for Plutus Pioneer code?
There are instructions on the official input-output-hk/plutus-pioneer-program repo in the exercises chapter here: https://github.com/input-output-hk/plutus-pioneer-program#exercises
I think you may be ...
4
votes
Accepted
What do unusual symbols "@" and ".\/" in off-chain code mean?
@String is from TypeApplications. logInfo has type logInfo :: forall a effs. Member (LogMsg a) effs => a -> Eff effs (), so logInfo @String fixes a to be String. (That this is needed here is ...
4
votes
How to properly start a new Plutus project, from scratch
Since this question was posted Plutus-alternatives have been developed by the community that allow doing DApp development in JavaScript only. One such library is https://github.com/hyperion-bt/Helios
...
3
votes
Accepted
Pioneer Lecture 4 recursion - how is it not infinite?
payContract blocks on the first line of the do block until the pay endpoint is invoked. The input of the invocation is put in pp.
pp <- endpoint @"pay"
It then executes the endpoint ...
3
votes
Accepted
Haskell IDE INLINABLE error help
The way HLS is enabled without plugin errors is discussed here:
https://github.com/input-output-hk/plutus-starter/pull/23
https://github.com/input-output-hk/plutus-starter/pull/29
https://github.com/...
3
votes
Haskell IDE INLINABLE error help
The pragma {-# LANGUAGE NoImplicitPrelude #-} and
import PlutusTx.Prelude might help.
It replaces the implicitly defined functions in Haskell by inlinable alternatives. Here is an example for Boolean ...
3
votes
What does two consecutive apostrophes mean in Haskell and Plutus?
The apostrophe(s) in Haskell (and thus Plutus) are part of the name; they do not hold any specific meaning.
Haskell as a functional programming language borrows from mathematical notation. An ...
3
votes
Accepted
How can I convert `Slot` to `TokenName`
I've just run this in the REPL with success. Not sure if it is the best way, though.
TokenName { unTokenName = Data.ByteString.Char8.pack $ show (toInteger (getSlot 1)) }
3
votes
haskell-language-server used in VSCode Haskell extension produces spurious INLINABLE compilation error message
I found a workaround that is sufficient to get my IDE usable.
**WORKAROUND: ** By comparing the cabal files for Plutus week10 (which compiles OK in IDE) with week07 (error), I discovered that adding ...
3
votes
Type instance syntax
This code is implementing the ValidatorTypes "Typeclass" for the Auctioning datatype.
Typeclasses are Haskell's way of handling polymorphism, like abstract classes in an OO language. In this ...
3
votes
Accepted
The PAB is no longer working after upgrading the Plutus version
Plutus is still in active development, so changes in the API can occur every week.
For your case, go look at a similar example in the PAB.
In your specific case, you'll need to change your handlers ...
3
votes
Accepted
Insufficient funds when trying to use script unspent output
expected: Value (Map [(,Map [(\\\"\\\",3242)])])\")"
Try adding a few zeros to the starting balances. It's saying it doesn't have enough to pay the fees.
I'm surprised that the ...
3
votes
Accepted
Where is the Haskell course mentioned by Lars?
Lars's courses are spread around various Youtube channels. I think that the one you are referring to is "Crypto Mongolia". Here it is:
https://youtube.com/playlist?list=...
3
votes
Meaning of <$> notation
For Haskell questions of this sort Hoogle is the ultimate resource.
For operators like <$> you need to enclose them in parenthesis eg (<$>).
3
votes
Accepted
Lesson 3 - unsure how "sigs" is created or where txInfoSignatories comes from or how it works
TxInfo is a Record type and one of the fields of the TxInfo-record is txInfoSignatories. The fields in the records work as "getters". You may refer e.g. to learnyouhaskell-records for an ...
3
votes
Accepted
What's the difference between Ledger.CurrencySymbol and Plutus.V1.Ledger.Value.CurrencySymbol?
If you look at the source of Ledger, you will see that it reexports CurrencySymbol from the Value module, so yes, they are the same:
module Ledger (
module Export,
AssetClass,
...
3
votes
Continue to be utterly disoriented as to where these magic words come from and how they might be connected
I am very familiar with the Haskell language (of which Plutus is a dialect) but not super familiar with this course.
The message
Data constructor not in scope: EmulatorTrace
means you are using an ...
3
votes
Accepted
Understand purpose of tx-out-datum-hash in Lars' lobster NFT minting example
That value is the hash value of an empty list. You can calculate it in the repl as follows:
import Ledger qualified
import PlutusTx qualified
emptyListDatum = Ledger.Datum $ PlutusTx.toBuiltinData ([]...
3
votes
Accepted
What is a library stanza?
I recommend you this article:
https://vrom911.github.io/blog/common-stanzas
Take into account that stanzas is a cabal thing (not Haskell, not Plutus). However Plutus projects can be created using ...
3
votes
Accepted
Empty TokenName Literal Overloading in Week05 Homework2
After digging into Plutus source, I think I've found why tn == "" crashes at runtime.
The problem might be that the instance of TokenName IsString doesn't use the INLINABLE pragma in the ...
3
votes
Accepted
Haskell + Blockfrost toolchain?
I think you want the cardano-api, part of the cardano-node repo. Most things that can be done, it can do. At the very least its the place to start.
The cardano-cli provides a set of examples of how to ...
3
votes
Accepted
Installing GHC on WSL
The recommended way to install Haskell on Linux is by using GHCUP. Using apt may install an old version of GHC.
Simply enter the following command on your WSL terminal:
curl --proto '=https' --tlsv1.2 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
haskell × 102plutus × 57
plutus-pioneer-program × 32
smart-contract × 24
cabal × 10
cardano-cli × 7
nft × 4
plutus-playground × 4
plutustx × 4
vscode × 4
validator × 4
on-chain × 4
wallet × 3
marlowe × 3
pab × 3
monad × 3
blockchain × 2
testnet × 2
nix × 2
blockfrost × 2
nix-shell × 2
ide × 2
ubuntu × 2
marketing × 2
plutus-starter × 2