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
1 answer
21 views

Cabal - could not resolve dependencies error

I have completed the pioneer program and am writing my own app. I've created my react front end and now am trying to serialize my smart contract in Haskell for a minting policy I wrote. The problem ...
mrsargent's user avatar
  • 121
0 votes
1 answer
25 views

I am getting error while using "cabal build all" cmd

I am new to plutus. I am trying to learn plutus for which I am using "plutus-starter" code to begin. while using "cabal build" i am getting following error: Resolving dependencies.....
krishna babu's user avatar
0 votes
1 answer
16 views

A Simple stack language

I'm working through IOHK Haskell course from 2020, and I'm stuck on problem assignment W3.1, full description linked here: https://github.com/iohkedu/w03 I do not understand how the instructions type ...
tyvan266's user avatar
0 votes
1 answer
31 views

UnsafeFromData instance for custom type

I want to use a custom type for one of my policy parameters, which will be applied by a tool like Lucid. Example of param: data CoinParams = CoinParams { policyOwner :: PubKeyHash, tokenName ::...
zing's user avatar
  • 135
0 votes
1 answer
18 views

how to use ownPubKey and RedeemerType and DatumType

My code is here. {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ...
Anton Begas's user avatar
2 votes
1 answer
18 views

Expecting one more argument to ‘RedeemerType’

My code is here marketConstraints :: Market -> TxConstraints (RedeemerType -> ScriptContext -> Bool) (DatumType, ()) marketConstraints market = mustValidateIn (to $ scriptAddress market) I ...
Anton Begas's user avatar
0 votes
1 answer
23 views

Denied Cabal Access to pictures. Now Getting error

Accidentally denied Cabal Access to pictures through a prompt given. Now, when I try to cabal Init I get this message "User/******/Library/Application Support/MobileSync: getDirectoryContents:...
marcus gray's user avatar
1 vote
0 answers
30 views

setup a Plutus project use haskell.nix Error on Mac M1

I'm trying to set up a Plutus project with flake on my Macbook by IOHK document I did the following steps: create default.nix enter command nix flake init --template templates#haskell-nix --impure ...
nik's user avatar
  • 11
1 vote
1 answer
48 views

Error when trying to build my Plutus project

I am getting the following error after trying to execute cabal build: cabal: Could not resolve dependencies: [__0] next goal: cardano-crypto-class (user goal) [__0] rejecting: cardano-crypto-class-2.0....
Falcon Stakepool's user avatar
1 vote
1 answer
153 views

How to deploy the Plutus smart contract

I am following Plutus-pioneer-program to learn smart contract development in Cardano. I have tried the onchain and offchain code, compiled and tested in Plutus playground and also in emulator trace. ...
duaa azhar's user avatar
0 votes
0 answers
79 views

Data from Mesh to Plutus

I created this datum with Mesh const datumMD: Data = new Map<Data, Data>(); datumMD.set('name', assetName ); datumMD.set('question', input); datumMD.set('answers', []); datumMD.set('...
Kavvadias's user avatar
0 votes
0 answers
29 views

Error when running nix-shell on WSL

I'm a newcomer to Cardano trying to learn Plutus. After cloning IOHK's Plutus-apps (https://github.com/input-output-hk/plutus-apps) repo and already installing nix, I found this error when running nix-...
3ORZ's user avatar
  • 31
10 votes
3 answers
251 views

How to properly start a new Plutus project, from scratch

I'm from ETH's ecosystem and recently just decided to get into Cardano development, specifically Plutus dev work thanks to Demeter.Run, and after going through the Plutus starters on there, I noticed ...
0xDaito's user avatar
  • 101
0 votes
1 answer
43 views

Printing a plutus validators cborhex to a file

I was hoping to get some advice re printing a plutus validators cborhex to a file. Im kinda basing my logic off of an example in week03 in the pioneer program but need to make some adaptations. Below ...
NaeriKailash's user avatar
0 votes
1 answer
26 views

Plutus Playground - mustPayToTheScript - unexpected char escapes - 0 converted to \NUL, 1 to \SOH

I am having trouble with the mustPayToTheScript function - I am getting this error Contract instance stopped with error: "WalletError (InsufficientFunds \"Total: Value (Map [(,Map [(\\\"...
NaeriKailash's user avatar
3 votes
3 answers
217 views

How to turn (compile) “script.hs” into “script.plutus”?

I have a script that is developed in Plutus Playground. It is working well and now I want to deploy it to the Cardano blockchain via cardano-cli. Following this answer, I have to use cabal to turn my ...
Adam's user avatar
  • 343
1 vote
2 answers
78 views

Plutus playground error when running simulator: WalletContractError ToCardanoError (Tag \"toCardanoPolicyId\" (Tag \"1 bytes\" DeserialisationError))

Plutus-apps v2022-04-06 My smart contract compiles successfully however when i run the simulator i get this error Contract instance stopped with error: "WalletContractError (ToCardanoError (Tag \&...
NaeriKailash's user avatar
2 votes
3 answers
146 views

Calculate tx fees via Blockfrost or any other provider?

Is there a way to calculate transaction fees without having to go through cardano-cli? Maybe something like Blockfrost? or any other API providers? I don't want to run a local node to do that.
Attilah's user avatar
  • 421
0 votes
1 answer
66 views

Cardano transaction builder library in Haskell

Is there a way besides cardano-cli that I can use to construct a transaction using Haskell? Something like Lucid-cardano npm package, but in Haskell land? Said library should allow me to construct a ...
Attilah's user avatar
  • 421
4 votes
2 answers
142 views

Why not just simply use Haskell instead of Plutus?

I can think of two major reasons as to why Cardano chose a strongly-typed functional language for it's Blockchain: Strongly-typed - because as the capabilities of the Blockchain and scripts become ...
Igodlab's user avatar
  • 488
1 vote
0 answers
28 views

How Will the Atala Plutus Integration Work?

I know that Atala prism will be used as the basis of Cardanos DiD but whenever I ask someone how it will work with Plutus, I end up hearing some new infrastructure needs to be built out. My question ...
KryptoKing's user avatar
1 vote
1 answer
106 views

How Do You Convert Math Symbols in Haskell?

So i heard you can use denotational semantics to write Haskell code using math notation for example circle in place of . to denote function composition. My question is in four parts: how do I use/...
KryptoKing's user avatar
0 votes
1 answer
40 views

Can I Use TraceIfFalse in deployment?

So I use traceIfFalse to test a lot of my smart contracts now I'm ready to deploy some of then and I want to know if this is for development only or if its fine to have a smart contract use this ...
KryptoKing's user avatar
3 votes
2 answers
65 views

What is Type Safety?

In the Haskell programming language there are a number of concepts that must be understood by anyone wishing to learn and use the maximum potential of the language. One of these what is is type safety....
KryptoKing's user avatar
0 votes
1 answer
64 views

Cannot wrap my head on NFTs

I am running through the Plutus Pioneer Program and I have reached week 5. Also as a reference, I will use the LobsterChallenge repository. I am a bit confused about how NFTs work for the Cardano ...
Kaloyan Yosifov's user avatar
1 vote
1 answer
61 views

How do I test my smart-contract on Cardano

I'm from EVM background and I've started learning about Cardano lately. I was just wondering how do I write unit tests for my smart-contract written in Haskell? Since i've been doing unit testing in ...
Muhammad Usman's user avatar
2 votes
3 answers
79 views

Is there a place where we can find the Haskell library for Marlowe?

I investigated some Code examples, in haskell for Marlowe smart-contract, and used the "cabal repl" with the " :i " command, like this: *Main> :i ValueEQ type Observation :: * ...
Gilles Flandrinck's user avatar
2 votes
2 answers
54 views

Whats Your Mental Model For Monads?

I was asked by a friend trying to learn plutus what a monad was, so I began talking about category theory. It seems that this confused him further how would you explain monads to a noob? Whats your ...
KryptoKing's user avatar
0 votes
1 answer
108 views

Can't create ```TokenName``` using ```tokenName``` with error ```GHC Core to PLC plugin: E042:Error: Unsupported feature: ...```

I'm not sure is relevant but the code in question is for a generic Validator (with Datums and Redeemers) used to get a forwarded minting policy the problem should be clear from the title, I can't get ...
Michele Nuzzi's user avatar
0 votes
0 answers
26 views

Tutorial for Haskell Restful-API Webserver

Using free and open source Haskell and with minimal or ideally no external libraries, I need to build a very simple RESTful-API/database server and a CLI to manage it. I need to use it for serving up ...
John Shearing's user avatar
0 votes
3 answers
993 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-...
John Shearing's user avatar
3 votes
1 answer
62 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,...
Sean Ishan's user avatar
0 votes
1 answer
17 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 ...
ViktorYasterbov's user avatar
0 votes
1 answer
33 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 ...
Karthikeyan Balusamy's user avatar
0 votes
1 answer
135 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 ...
wandyyd's user avatar
  • 55
0 votes
1 answer
63 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 ...
tienty muctieu's user avatar
1 vote
1 answer
52 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....
KugisMugis's user avatar
1 vote
1 answer
57 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 .\/ ...
Walker Leite's user avatar
-1 votes
1 answer
141 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 ...
Irwan's user avatar
  • 9
1 vote
1 answer
242 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 ...
XiTouch's user avatar
  • 349
0 votes
1 answer
31 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) ...
Kurt Sys's user avatar
  • 172
0 votes
2 answers
27 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, ...
joaquimgamero's user avatar
1 vote
3 answers
176 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), ...
XiTouch's user avatar
  • 349
3 votes
2 answers
193 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 ...
Roofi's user avatar
  • 125
2 votes
1 answer
51 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 ...
joaquimgamero's user avatar
2 votes
1 answer
124 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 ...
Kurt Hartmann's user avatar
0 votes
2 answers
98 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....
XiTouch's user avatar
  • 349
2 votes
1 answer
84 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 ...
kindofdev's user avatar
  • 1,294
1 vote
1 answer
94 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 = ...
17159's user avatar
  • 21
1 vote
1 answer
86 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 ...
XiTouch's user avatar
  • 349