Questions tagged [haskell]

For Haskell programming questions specifically related to Cardano. For more generic programming questions about Haskell, please consider using Stack Overflow instead.

Filter by
Sorted by
Tagged with
0 votes
2 answers
18 views

Installing GHC on WSL

I just installed Ubuntu on WSL for Windows 10 in order to get ready for the Marlowe Pioneers Program. I figure I will need to install GHC and Cabal next in order to install the Cardano-CLI and Marlowe-...
user avatar
1 vote
1 answer
22 views

Haskell + Blockfrost toolchain?

I am looking for a Haskell alternative to the cardano-serialization-lib, which can work in conjunction with blockfrost-haskell. So ideally, it should be able to easily create wallet keys, transactions,...
user avatar
0 votes
1 answer
8 views

Can someone help to understand how to use handleChainIndexClient?

I'm not guru with Eff system under Haskell. What i got that method could contains the constraints for monad that should be used with. module ChainIndexHelper where import Plutus.ChainIndex.Client ...
user avatar
0 votes
0 answers
13 views

What does collectFromScript return?

I am not very familiar with Haskell and can't figure out what this function returns. collectFromScript :: forall i o. Map TxOutRef ChainIndexTxOut -> i -> TxConstraints I o is it a list of ...
user avatar
0 votes
1 answer
26 views

How to check whether my two pubkeyHash is different or not using Haskell?

I'm using this script to check but this doesn't works for me import Prelude hiding (Eq) mkPolicy :: PubKeyHash -> PubKeyHash -> TokenName -> BuiltinData -> ScriptContext -> Bool ...
user avatar
0 votes
1 answer
60 views

Cardano DB Sync - RTS Options

After successfully with previous question, where I tried to make cardano-node and cardano-db-sync run as a services, I tried to play around with +RTS ... -RTS option on cardano-db-sync, specifically ...
user avatar
  • 45
0 votes
1 answer
56 views

haskell quite hard [closed]

i'm newbie and trying to learn haskell, but i'm having a problem in the Data.List chapter of learnyouahaskell as follows: let xs = [1..6] in sum xs / genericLength xs -- > it works Now I try to ...
user avatar
1 vote
1 answer
22 views

How to know which module to import?

Let's say my smartcontract needs BuiltinData. Quicksearch in documentation reveals that BuiltinData is in: Plutus.V1.Ledger.Api Plutus.V2.Ledger.Api PlutusTx.Builtins.Internal PlutusTx PlutusTx....
user avatar
0 votes
0 answers
7 views

Is Haskell used for hardware embedded systems and controllers? How about DSL like Plutus?

Is Haskell used at all for hardware embedded systems and controllers, such as for applications of robotics and control systems? Currently C dominates. Or perhaps a better question, could you use smart ...
user avatar
  • 175
0 votes
1 answer
37 views

Why is String being interpreted as a type?

According type applications, this extension allows to give explicit type arguments to a polymorphic function. type VestingSchema = Endpoint "give" GiveParams .\/ ...
user avatar
0 votes
1 answer
64 views

Unable to install Gloss on Mac M1

I just learning about Haskell and trying to create Haskell project with Cabal, but when I tried install Gloss, it always return an error -- error ... ghc: could not execute: opt cabal: Failed to build ...
user avatar
  • 11
1 vote
1 answer
117 views

Is type String truly equal to type [Char], and is Haskell truly "pure"?

One fundamental of Haskell is that a string is really a list of characters. Another fundamental is referential transparency, in that a pure function must always give the exact same result when given ...
user avatar
  • 177
0 votes
1 answer
29 views

How to define the return type of `callEndPoint` appropriately?

In homework of week4, I refactored my solution: payTrace :: Integer -> Integer -> EmulatorTrace () payTrace payment1 payment2 = do contract1 <- activateContractWallet (knownWallet 1) ...
user avatar
  • 172
0 votes
2 answers
25 views

Using `void` vs using `>>` (then) operator

Given a do block which contains these expressions: void $ submitTx tx payContract Would it be feasible to reformat this lines using the then operator, and thus telling the compiler to do something, ...
user avatar
1 vote
3 answers
171 views

Please explain types with multiple outputs

I understand basic type signatures like myFunction :: Int -> String myFunction a = "Always produce this string" But in the week 5 lesson, in Free.hs (and similar in the other hs files), ...
user avatar
  • 177
0 votes
0 answers
58 views

VS Code Haskell Language Server configuration: pass flag to cabal?

I'm working with the plutus-starter repo (https://github.com/input-output-hk/plutus-starter) and this is working with VS Code on my Macbook Pro and running in a Docker devcontainer. HSL even shows ...
user avatar
  • 195
3 votes
2 answers
150 views

Empty TokenName Literal Overloading in Week05 Homework2

This doesn't work mkPolicy oref () ctx = traceIfFalse "UTxO not consumed" hasUTxO && traceIfFalse "wrong amount minted" checkMintedAmount ...
user avatar
  • 125
2 votes
1 answer
32 views

What is a library stanza?

I deduce what stanza definitions are but I was struggling to find an exact definition and explanation why this is used in Haskell/Plutus. What exactly is a stanza? Can you compile code Haskell/Plutus ...
user avatar
1 vote
1 answer
61 views

Understand purpose of tx-out-datum-hash in Lars' lobster NFT minting example

When the Alonzo era started on mainnet, Lars deployed a smart contract example, in which he minted a lobster NFT as part of a lobster naming challenge. In the policy script used to mint the lobster ...
user avatar
0 votes
2 answers
89 views

Continue to be utterly disoriented as to where these magic words come from and how they might be connected

I continue to be utterly lost as to how to understand the source and ultimately the concrete foundation of this byzantine mass of constructs. Example. In Lesson 4, in the Contract.hs module (and Trace....
user avatar
  • 177
2 votes
1 answer
58 views

What's the difference between Ledger.CurrencySymbol and Plutus.V1.Ledger.Value.CurrencySymbol?

I'm a bit confused about CurrencySymbol type. In the documentation it appears twice in 2 modules: Plutus.V1.Ledger.Value (first image) and Ledger. (second image) Are they the same type? When import ...
user avatar
  • 1,124
1 vote
1 answer
47 views

What is the correct way to compare DatumHash?

What is the correct way to compare DatumHash? I imported the Eq function from PlutusTx import PlutusTx.Prelude (Eq((==))) ... checkDatumHash :: TxOut -> Bool checkDatumHash txOut = ...
user avatar
  • 21
1 vote
1 answer
71 views

Lesson 3 - unsure how "sigs" is created or where txInfoSignatories comes from or how it works

Spoiler Alert! The solution for lesson 3 includes the following: {-# INLINABLE mkValidator #-} -- This should validate if either beneficiary1 has signed the transaction and the current slot is before ...
user avatar
  • 177
1 vote
2 answers
66 views

Meaning of <$> notation

I see the <$> notation often in the Plutus/Haskell code but have no idea what it means. I understand that $ alone is a parenthesis replacement. Is <$> similar? Does it suggest enclosing ...
user avatar
  • 177
1 vote
1 answer
22 views

Mongolia Course - Slides, Homework and Solutions

Does anyone know if we have access to the Mongolia course slides, homework and solutions? If so where can we find them? If not, please could they be made available? I think the homework exercises with ...
user avatar
  • 25
0 votes
1 answer
85 views

What is the correct way to compare two instances of Value data type?

Question What is the correct way to compare two instances of Value data type? Context I would like to check if outgoing transaction identified by PubKeyHash has the same Value as Value which was ...
user avatar
0 votes
2 answers
39 views

GHC-version for Plutus

This is a short question and probably easy to answer. Where in the Plutus GitHub repository can I check which GHC-version is needed to compile Plutus ?
user avatar
  • 1,276
2 votes
1 answer
129 views

What do unusual symbols "@" and ".\/" in off-chain code mean?

I was wondering about syntax I am not used to in the off-chain code. What does @ mean in the following context? logInfo @String $ printf "made a gift" What does .\/ mean in the following ...
user avatar
  • 165
1 vote
0 answers
51 views

Applycode to untyped validator, template Haskell

I am trying to learn the basics of the PlutusTx module. In this module is a function applyCode which maps the signatures CompiledCodeIn uni fun (a -> b) -> CompiledCodeIn uni fun a -> ...
user avatar
  • 803
1 vote
1 answer
37 views

VS Code Remote VM IntelliSense Issues

I was having trouble getting Plutus running properly on Windows & WSL2, so I spun up an Ubuntu Server VM on my Proxmox server and set everything up there. I use VS Code via SSH to connect from ...
user avatar
  • 11
0 votes
1 answer
22 views

Can GTK libraries used with Plutus?

Interested in GUI interfaces, is their restriction's in using GTK Haskell libraries with Plutus. Am only starting on Journey so wanted general feedback that might help guide me down right path.
user avatar
0 votes
0 answers
89 views

How can I mint/sell bundles of NFTs as a pack?

There are many use cases for bundling NFTS. Example: If I am creating a Trading card game and have packs of multiple NFTs (6 cards). How do I make users purchase my packs of of 6 cards. I thought pre-...
user avatar
2 votes
2 answers
80 views

How are values in UTXO's stored

Are values in UTXO's stored in a set manner for example if 50 Tokens with metadata and 50 tokens without metadata had the same Token Name and currency symbol and were to be handed out from a script 1 ...
user avatar
  • 446
0 votes
0 answers
28 views

How can I configure Ale so it finds Plutus libraries?

I'm using nvim with Ale, no particular config other than: Plug 'w0rp/ale' let g:ale_sign_error = '●' let g:ale_sign_warning = '●' It looks like works out of the box for Haskell, but cannot find ...
user avatar
  • 101
0 votes
1 answer
23 views

What is the purpose of placing () at the end of the function declaration?

In week02 Iteration 3 there is a function that has (). What is the purpose of that? Is it so that the function can't be used maliciously? mkValidator :: Data -> Data -> Data -> ()
user avatar
  • 1
0 votes
1 answer
75 views

new type and JSON

Working on Week 2 Homework 1, I tried to define a new type DuBool. The following is the relevant portion of the code, with the more traditional version commented out immediately above each line that ...
user avatar
  • 177
1 vote
0 answers
42 views

plutus example of interacting with wallet on testnet using haskell

Can anyone proivde an example of how to create a wallet that can be used in the Main.hs file when connected to the testnet? I have working code for Emulator and Simulator, but all examples against ...
user avatar
  • 131
1 vote
1 answer
82 views

Where is the Haskell course mentioned by Lars?

In the welcome video, Lars mentions about a 10-week Haskell course recording. Where can I get the link for that course? It would be good for other beginners as well.
user avatar
1 vote
1 answer
53 views

How do I `:reload` in `ghci`

I copied the plutus-starter template: https://github.com/input-output-hk/plutus-starter and created a file BasicPlutusTx.hs (and added it under exposed-modules in the .cabal file). Then I started ...
user avatar
  • 123
0 votes
1 answer
32 views

Does the redeemer have to be from a wallet address/contract?

Could a contract be programmed such that the redeemer seemingly comes from nowhere from what the node / someone monitoring the blockchain could tell? I am thinking if you gave the contract some ada ...
user avatar
0 votes
1 answer
49 views

Question about Plutus smart contract which always succeeds

Can anyone explain in detail why this script, https://github.com/james-iohk/Alonzo-testnet/blob/update-cabal-1.29.0/resources/plutus-sources/plutus-alwayssucceeds/src/Cardano/PlutusExample/...
user avatar
  • 115
2 votes
1 answer
78 views

Best practice for testing smart contract

Let's say you have your haskell code ready to test as a smart contract on the testnet, what is the best practice to go about testing if your smart contract works as intended? Does the same process ...
user avatar
  • 115
0 votes
2 answers
60 views

Ambiguous type variable ‘e0’ arising from a use of ‘endpoints’

I'm writing emulator trace tests for the spacebudz contracts. Here is a minimum example: {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ...
user avatar
4 votes
3 answers
107 views

Where is the best place to start looking for Haskell Developers?

I'm looking to hire developers for a project and most people I speak with have experience with Solidity and therefore trying to convince me to focus on the Ethereum ecosystem. I like what the Cardano ...
user avatar
2 votes
1 answer
54 views

Retrieve only digit from TokenName and use onchain

How can I make the following function to retrieve only digit portion from the TokenName and use it on chain? For example I want to retrieve the number 123 from "AAA123" (TokenName) {-# ...
user avatar
  • 21
1 vote
1 answer
82 views

How to fix Duplicate instance declaration error in byron-spec-ledger package?

I'm trying to add cardano-wallet-core as a dependency to my Haskell project, so I can use the servant client. But I get this error when cabal builds the byron-spec-ledger package: [ 6 of 16] Compiling ...
user avatar
  • 131
4 votes
2 answers
210 views

Developing on Cardano as a beginner

Is there a roadmap to learn Cardano Development as a beginner? I checked the Cardano Developer Portal but I could not find the following: What is the order in which one should learn things? For ...
user avatar
  • 43
2 votes
2 answers
103 views

Insufficient funds when trying to use script unspent output

I was following the example from the basic split app and changing it a bit to try to make a simple sell/buy NFT transaction. For now I'm just trying to transfer the NFT from one wallet to another. My ...
user avatar
  • 166
0 votes
1 answer
75 views

How to validate the correctness of another parameterized script address on-chain

I would like to write a factory script that can initialize another parameterized script address by sending it an NFT. The factory validator gets the parameters of the target script as redeemer and has ...
user avatar
  • 83
1 vote
0 answers
32 views

Error When Running stack ghci on my MacOS Terminal

I am getting this error when I try to run stack ghci on my Mac Termina. How do I resolve this? I've run stack upgrade and stack update. Downloading lts-18.13 build plan ...RedownloadFailed Request { ...
user avatar