Hot answers tagged

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 ...
sorki's user avatar
  • 497
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 ...
Matthias Sieber's user avatar
  • 1,557
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 ...
Robertino's user avatar
  • 141
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 ...
Mitchell Turner's user avatar
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/
Samuel Leathers's user avatar
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 ...
Fermat's user avatar
  • 1,872
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 ...
vcwebco's user avatar
  • 480
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 ...
eddex's user avatar
  • 3,798
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 ...
Sjoerd Visscher's user avatar
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 ...
Christian Schmitz's user avatar
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 ...
vcwebco's user avatar
  • 480
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/...
Stanislav Zhdanovich's user avatar
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 ...
thebrandre's user avatar
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 ...
Matthias Sieber's user avatar
  • 1,557
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)) }
Chrismo's user avatar
  • 524
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 ...
KenA's user avatar
  • 161
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 ...
Mitchell Turner's user avatar
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 ...
kolam's user avatar
  • 385
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 ...
Mitchell Turner's user avatar
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=...
Robertino's user avatar
  • 141
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 (<$>).
Erik de Castro Lopo's user avatar
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 ...
hsteamroller's user avatar
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, ...
Mihai Codescu's user avatar
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 ...
Erik de Castro Lopo's user avatar
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 ([]...
kindofdev's user avatar
  • 1,304
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 ...
kindofdev's user avatar
  • 1,304
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 ...
kindofdev's user avatar
  • 1,304
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 ...
waalge's user avatar
  • 403
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 ...
c21253's user avatar
  • 146

Only top scored, non community-wiki answers of a minimum length are eligible