<p>It was newbie mistake. There are these lines at the top</p>
<pre><code>{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveAnyClass             #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE NoImplicitPrelude          #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE RecordWildCards            #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TemplateHaskell            #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE TypeFamilies               #-}
{-# LANGUAGE TypeOperators              #-}
</code></pre>
<p>I ran the following in the repl</p>
<pre><code>:set -XDataKinds
:set -XDeriveAnyClass
:set -XDeriveGeneric
:set -XDerivingStrategies
:set -XFlexibleContexts
:set -XGeneralizedNewtypeDeriving
:set -XLambdaCase
:set -XMultiParamTypeClasses
:set -XNoImplicitPrelude
:set -XOverloadedStrings
:set -XRecordWildCards
:set -XScopedTypeVariables
:set -XTemplateHaskell
:set -XTypeApplications
:set -XTypeFamilies
:set -XTypeOperators
</code></pre>
<p>and then simply evaluated the expression and it worked!</p>
<pre><code>&gt; Ledger.ValidatorHash &quot;f&quot;
66
</code></pre>

CC BY-SA 4.0
2022-01-14T09:58:19.393Z
2022-01-14T10:04:07.350Z
2022-01-14T10:04:07.350Z
Roofi
<p>Somewhere you have a typo. &quot;ByString&quot; should be &quot;ByteString&quot;.</p>

CC BY-SA 4.0
2022-01-14T09:10:02.677Z
thanks, I changed my final question to address it.
Roofi
CC BY-SA 4.0
2022-01-14T08:58:55.110Z
2022-01-14T08:58:55.110Z
Erik de Castro Lopo
<blockquote>
<p>Perhaps you need to add ‘bytestring’ to the build-depends in your .cabal file.</p>
</blockquote>
<p>Do you have a cabal file somewhere? If so, you need to add the <code>bytestring</code> package.</p>

CC BY-SA 4.0
2022-01-14T09:48:19.330Z
Instead of making bytestring work, can I just evaluate `ValidatorHash "f"`? Or do I need to setup some flags (like maybe `:set -XTemplateHaskell`)? I was successfully able to compile week01 so I was trying to run this expression in the repl.
Roofi
CC BY-SA 4.0
2022-01-14T09:45:56.377Z
2022-01-14T09:45:56.377Z
Erik de Castro Lopo
<p>I am new to haskell and I am trying to run a few expressions from the <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs" rel="nofollow noreferrer">English Auction Contract</a> in the repl.</p>
<p>So if I want to run <code>ValidatorHash &quot;f&quot;</code> from the second last line of the Contract in week01, how do I do it in the repl here <code>[nix-shell:~/plutus-pioneer-program/code/week01]$ cabal repl</code>?</p>
<p>What I tried</p>
<pre><code>&gt; import Ledger.ValidatorHash
&gt; Ledger.ValidatorHash &quot;f&quot;
error: Couldn't match expected type ‘PlutusTx.Builtins.Internal.BuiltinByteString’
                  with actual type ‘[Char]’
</code></pre>
<p>then</p>
<pre><code>&gt; import PlutusTx.Builtins.Internal
&gt; Ledger.ValidatorHash (BuiltinByteString &quot;f&quot;)
error: Couldn't match expected type ‘bytestring-0.10.12.0:Data.ByteString.Internal.ByteString’
                  with actual type ‘[Char]’
</code></pre>
<p>then</p>
<pre><code>&gt; import Data.ByString as BS
error: Could not find module ‘Data.ByString’
    Perhaps you meant
      Data.ByteString (needs flag -package-key bytestring-0.10.12.0)
      Data.String (from base-4.14.1.0)
</code></pre>
<p>So do I really need to close this repl and figure out the way to open the repl with the flag?
Or is there something very obvious that I am missing?</p>
<hr />
<p>Edit #1: added non-typo error for bytestring</p>
<pre><code>&gt; import Data.ByteString as BS
error: Could not load module ‘Data.ByteString’
    It is a member of the hidden package ‘bytestring-0.10.12.0’.
    Perhaps you need to add ‘bytestring’ to the build-depends in your .cabal file.
</code></pre>
<p>Looks like bytestring is hidden. Is it still possible to run <code>ValidatorHash &quot;f&quot;</code> using any other means?</p>
<hr />
<p>Edit #2</p>
<p>My question was initially specific to find out the origin of <code>66</code> when using the token in week01 code as <code>ValidatorHash &quot;f&quot;</code> is taken from this statement in the contract <code>myToken = KnownCurrency (ValidatorHash &quot;f&quot;) &quot;Token&quot; (TokenName &quot;T&quot; :| [])</code>. But I was unable to evaluate it.</p>

<plutus><plutus-pioneer-program><cabal>
Running week01 expressions in repl
# Running week01 expressions in repl

(Asked by: username_0 on 2022-01-14)

I am new to haskell and I am trying to run a few expressions from the English Auction Contract in the repl.
So if I want to run ValidatorHash "f" from the second last line of the Contract in week01, how do I do it in the repl here [nix-shell:~/plutus-pioneer-program/code/week01]$ cabal repl?
What I tried
> import Ledger.ValidatorHash
> Ledger.ValidatorHash "f"
error: Couldn't match expected type ‘PlutusTx.Builtins.Internal.BuiltinByteString’
                  with actual type ‘[Char]’

then
> import PlutusTx.Builtins.Internal
> Ledger.ValidatorHash (BuiltinByteString "f")
error: Couldn't match expected type ‘bytestring-0.10.12.0:Data.ByteString.Internal.ByteString’
                  with actual type ‘[Char]’

then
> import Data.ByString as BS
error: Could not find module ‘Data.ByString’
    Perhaps you meant
      Data.ByteString (needs flag -package-key bytestring-0.10.12.0)
      Data.String (from base-4.14.1.0)

So do I really need to close this repl and figure out the way to open the repl with the flag?
Or is there something very obvious that I am missing?

Edit #1: added non-typo error for bytestring
> import Data.ByteString as BS
error: Could not load module ‘Data.ByteString’
    It is a member of the hidden package ‘bytestring-0.10.12.0’.
    Perhaps you need to add ‘bytestring’ to the build-depends in your .cabal file.

Looks like bytestring is hidden. Is it still possible to run ValidatorHash "f" using any other means?

Edit #2
My question was initially specific to find out the origin of 66 when using the token in week01 code as ValidatorHash "f" is taken from this statement in the contract myToken = KnownCurrency (ValidatorHash "f") "Token" (TokenName "T" :| []). But I was unable to evaluate it.

**Tags:** plutus, plutus-pioneer-program, cabal

---

## 3 answers

### Answer by username_0 on 2022-01-14. Score: 1 | Accepted answer

It was newbie mistake. There are these lines at the top
{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveAnyClass             #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE NoImplicitPrelude          #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE RecordWildCards            #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TemplateHaskell            #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE TypeFamilies               #-}
{-# LANGUAGE TypeOperators              #-}

I ran the following in the repl
:set -XDataKinds
:set -XDeriveAnyClass
:set -XDeriveGeneric
:set -XDerivingStrategies
:set -XFlexibleContexts
:set -XGeneralizedNewtypeDeriving
:set -XLambdaCase
:set -XMultiParamTypeClasses
:set -XNoImplicitPrelude
:set -XOverloadedStrings
:set -XRecordWildCards
:set -XScopedTypeVariables
:set -XTemplateHaskell
:set -XTypeApplications
:set -XTypeFamilies
:set -XTypeOperators

and then simply evaluated the expression and it worked!
> Ledger.ValidatorHash "f"
66


---

### Answer by username_1 on 2022-01-14. Score: 1

Somewhere you have a typo. "ByString" should be "ByteString".

> **Comments:**
> **username_0**: thanks, I changed my final question to address it.  

---

### Answer by username_1 on 2022-01-14. Score: 0

> Perhaps you need to add ‘bytestring’ to the build-depends in your .cabal file.

Do you have a cabal file somewhere? If so, you need to add the `bytestring` package.

> **Comments:**
> **username_0**: Instead of making bytestring work, can I just evaluate `ValidatorHash "f"`? Or do I need to setup some flags (like maybe `:set -XTemplateHaskell`)? I was successfully able to compile week01 so I was trying to run this expression in the repl.  

---

