<p><code>*-&gt;*</code> is not a type, but a kind, see <a href="https://wiki.haskell.org/Kind" rel="nofollow noreferrer">https://wiki.haskell.org/Kind</a>.</p>

CC BY-SA 4.0
2022-02-10T16:58:11.430Z
While your answer is intended in the best spirit of helpfulness, I am now convinced that Haskell is a completely foreign language!
XiTouch
CC BY-SA 4.0
2022-02-10T19:58:31.957Z
If you look in Contract.hs, you'll find things like `myTrace :: EmulatorTrace ()`. The use of `::` should tell you that what follows is a type. That type is very similar to `IO ()` that you know from `main :: IO ()`. You just happen to be unlucky here to run into these effects, which are one of the advanced Haskell features that we just use in Plutus without a detailed explanation. Maybe this pointer helps you to some extent: https://reasonablypolymorphic.com/blog/freer-monads/
Mihai Codescu
CC BY-SA 4.0
2022-02-08T21:00:12.610Z
2022-02-08T21:00:12.610Z
Mihai Codescu
<p>I am very familiar with the Haskell language (of which Plutus is a dialect) but not super familiar with this course.</p>
<p>The message</p>
<pre><code>Data constructor not in scope: EmulatorTrace
</code></pre>
<p>means you are using an identifier <code>EmulatorTrace</code> that is a constructor for a value, but that the compiler is not able to find that identifier. This can be because the identifier is spelt incorrectly, but in this case, its more likely that you have not imported the module which defines that constructor.</p>
<blockquote>
<p>How do I know if it is a Data, or a function?</p>
</blockquote>
<p>In Haskell (and Plutus) types and type constructors always begin with an upper case letter and functions always with a lower case letter. However all type constructors are also functions where they operate from the fields that are needed for the constructor to the type the constructor builds.</p>
<blockquote>
<p>What is freer-simple-1.2.1.2 ?</p>
</blockquote>
<p>That is a haskell package you can find <a href="https://hackage.haskell.org/package/freer-simple" rel="nofollow noreferrer">here</a>.</p>
<p>Sorry, I do not have good answers for the rest of the questions.</p>

CC BY-SA 4.0
2022-02-08T07:12:39.540Z
2022-02-08T07:12:39.540Z
Erik de Castro Lopo
<p>I continue to be utterly lost as to how to understand the source and ultimately the concrete foundation of this byzantine mass of constructs.</p>
<p>Example. In Lesson 4, in the Contract.hs module (and Trace.hs), there is a reference to EmulatorTrace. Where does that come from? How do I know if it is a Data, or a function? It has no type (using :t), yet it does have a type (* -&gt; *, using :i). How can I study how it is built and what it does? The :i gives me info, but nothing actually useful. If I try to drill down into the components (are those data types, or are those functions? No way to know) I get more useless verbiage, or error messages.</p>
<p>What is freer-simple-1.2.1.2 ? Where does it come from? it's not anywhere in the code, although freer-extras is in the cabal.project file and plutus-pioneer-program-week04.cabal file. If I do a locate in my zsh shell, I find numerous nix/store files with freer-simple-1.2.1.1 in the title, but not with freer-simple-1.2.1.2. Why would that be? So much of this feels like magic fairy dust, or like being trapped under 40 tons of construction material blindfolded being told how to adjust a programmable thermostat before learning how to procure a construction screw.</p>
<p>The reason I ask is because if I am going to build code that manages thousands (or more!) of ADA, I need to understand how to build these things from scratch, and right now I can barely copy and paste and tweak a reference hoping it will compile.</p>
<pre><code>Prelude Plutus.Trace.Emulator Data.Default Week04.Contract&gt; :t EmulatorTrace

&lt;interactive&gt;:1:1: error:
    • Data constructor not in scope: EmulatorTrace
    • Perhaps you meant variable ‘runEmulatorTrace’ (imported from Plutus.Trace.Emulator)
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract&gt; :i EmulatorTrace
type EmulatorTrace :: * -&gt; *
type EmulatorTrace =
  freer-simple-1.2.1.2:Control.Monad.Freer.Internal.Eff
    '[Plutus.Trace.Effects.RunContract.StartContract,
      Plutus.Trace.Effects.RunContract.RunContract,
      Plutus.Trace.Effects.Assert.Assert,
      Plutus.Trace.Effects.Waiting.Waiting,
      Plutus.Trace.Effects.EmulatorControl.EmulatorControl,
      Plutus.Trace.Effects.EmulatedWalletAPI.EmulatedWalletAPI,
      Control.Monad.Freer.Extras.Log.LogMsg String,
      freer-simple-1.2.1.2:Control.Monad.Freer.Error.Error
        EmulatorRuntimeError]
  :: * -&gt; *
    -- Defined in ‘Plutus.Trace.Emulator’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract&gt; :i Plutus.Trace.Effects.RunContract.RunContract
type role Plutus.Trace.Effects.RunContract.RunContract nominal
type Plutus.Trace.Effects.RunContract.RunContract :: * -&gt; *
data Plutus.Trace.Effects.RunContract.RunContract r where
  Plutus.Trace.Effects.RunContract.CallEndpointP :: (Plutus.Trace.Effects.RunContract.ContractConstraints
                                                       s,
                                                     Plutus.Contract.Request.HasEndpoint l ep s,
                                                     aeson-1.5.6.0:Data.Aeson.Types.ToJSON.ToJSON
                                                       ep) =&gt;
                                                    Data.Proxy.Proxy l -&gt; ContractHandle w s e -&gt; ep
                                                    -&gt; Plutus.Trace.Effects.RunContract.RunContract ()
  Plutus.Trace.Effects.RunContract.GetContractState :: (Plutus.Trace.Effects.RunContract.ContractConstraints
                                                          s,
                                                        aeson-1.5.6.0:Data.Aeson.Types.FromJSON.FromJSON
                                                          e,
                                                        aeson-1.5.6.0:Data.Aeson.Types.FromJSON.FromJSON
                                                          w,
                                                        aeson-1.5.6.0:Data.Aeson.Types.ToJSON.ToJSON
                                                          w) =&gt;
                                                       ContractHandle w s e
                                                       -&gt; Plutus.Trace.Effects.RunContract.RunContract (Plutus.Trace.Emulator.Types.ContractInstanceState
                                                                                                          w
                                                                                                          s
                                                                                                          e
                                                                                                          ())
    -- Defined in ‘Plutus.Trace.Effects.RunContract’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract&gt; :i freer-simple-1.2.1.2:Control.Monad.Freer.Internal.Eff

&lt;interactive&gt;:1:6: error: parse error on input ‘-’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract&gt; :i Control.Monad.Freer.Internal.Eff

&lt;interactive&gt;:1:1: error:
    Not in scope: ‘Control.Monad.Freer.Internal.Eff’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract&gt; 
</code></pre>
<p>And yet the CLI seems to be perfectly logical and transparent and I have no doubt I can craft a complete billing system using other tools, built around the CLI. That's why I am so shocked that Plutus is so difficult.</p>

<plutus-pioneer-program><haskell>
Continue to be utterly disoriented as to where these magic words come from and how they might be connected
# Continue to be utterly disoriented as to where these magic words come from and how they might be connected

(Asked by: username_0 on 2022-02-08)

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.hs), there is a reference to EmulatorTrace. Where does that come from? How do I know if it is a Data, or a function? It has no type (using :t), yet it does have a type (* -> *, using :i). How can I study how it is built and what it does? The :i gives me info, but nothing actually useful. If I try to drill down into the components (are those data types, or are those functions? No way to know) I get more useless verbiage, or error messages.
What is freer-simple-1.2.1.2 ? Where does it come from? it's not anywhere in the code, although freer-extras is in the cabal.project file and plutus-pioneer-program-week04.cabal file. If I do a locate in my zsh shell, I find numerous nix/store files with freer-simple-1.2.1.1 in the title, but not with freer-simple-1.2.1.2. Why would that be? So much of this feels like magic fairy dust, or like being trapped under 40 tons of construction material blindfolded being told how to adjust a programmable thermostat before learning how to procure a construction screw.
The reason I ask is because if I am going to build code that manages thousands (or more!) of ADA, I need to understand how to build these things from scratch, and right now I can barely copy and paste and tweak a reference hoping it will compile.
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract> :t EmulatorTrace

:1:1: error:
    • Data constructor not in scope: EmulatorTrace
    • Perhaps you meant variable ‘runEmulatorTrace’ (imported from Plutus.Trace.Emulator)
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract> :i EmulatorTrace
type EmulatorTrace :: * -> *
type EmulatorTrace =
  freer-simple-1.2.1.2:Control.Monad.Freer.Internal.Eff
    '[Plutus.Trace.Effects.RunContract.StartContract,
      Plutus.Trace.Effects.RunContract.RunContract,
      Plutus.Trace.Effects.Assert.Assert,
      Plutus.Trace.Effects.Waiting.Waiting,
      Plutus.Trace.Effects.EmulatorControl.EmulatorControl,
      Plutus.Trace.Effects.EmulatedWalletAPI.EmulatedWalletAPI,
      Control.Monad.Freer.Extras.Log.LogMsg String,
      freer-simple-1.2.1.2:Control.Monad.Freer.Error.Error
        EmulatorRuntimeError]
  :: * -> *
    -- Defined in ‘Plutus.Trace.Emulator’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract> :i Plutus.Trace.Effects.RunContract.RunContract
type role Plutus.Trace.Effects.RunContract.RunContract nominal
type Plutus.Trace.Effects.RunContract.RunContract :: * -> *
data Plutus.Trace.Effects.RunContract.RunContract r where
  Plutus.Trace.Effects.RunContract.CallEndpointP :: (Plutus.Trace.Effects.RunContract.ContractConstraints
                                                       s,
                                                     Plutus.Contract.Request.HasEndpoint l ep s,
                                                     aeson-1.5.6.0:Data.Aeson.Types.ToJSON.ToJSON
                                                       ep) =>
                                                    Data.Proxy.Proxy l -> ContractHandle w s e -> ep
                                                    -> Plutus.Trace.Effects.RunContract.RunContract ()
  Plutus.Trace.Effects.RunContract.GetContractState :: (Plutus.Trace.Effects.RunContract.ContractConstraints
                                                          s,
                                                        aeson-1.5.6.0:Data.Aeson.Types.FromJSON.FromJSON
                                                          e,
                                                        aeson-1.5.6.0:Data.Aeson.Types.FromJSON.FromJSON
                                                          w,
                                                        aeson-1.5.6.0:Data.Aeson.Types.ToJSON.ToJSON
                                                          w) =>
                                                       ContractHandle w s e
                                                       -> Plutus.Trace.Effects.RunContract.RunContract (Plutus.Trace.Emulator.Types.ContractInstanceState
                                                                                                          w
                                                                                                          s
                                                                                                          e
                                                                                                          ())
    -- Defined in ‘Plutus.Trace.Effects.RunContract’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract> :i freer-simple-1.2.1.2:Control.Monad.Freer.Internal.Eff

:1:6: error: parse error on input ‘-’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract> :i Control.Monad.Freer.Internal.Eff

:1:1: error:
    Not in scope: ‘Control.Monad.Freer.Internal.Eff’
Prelude Plutus.Trace.Emulator Data.Default Week04.Contract> 

And yet the CLI seems to be perfectly logical and transparent and I have no doubt I can craft a complete billing system using other tools, built around the CLI. That's why I am so shocked that Plutus is so difficult.

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

---

## 2 answers

### Answer by username_2 on 2022-02-08. Score: 3

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 identifier EmulatorTrace that is a constructor for a value, but that the compiler is not able to find that identifier. This can be because the identifier is spelt incorrectly, but in this case, its more likely that you have not imported the module which defines that constructor.

How do I know if it is a Data, or a function?

In Haskell (and Plutus) types and type constructors always begin with an upper case letter and functions always with a lower case letter. However all type constructors are also functions where they operate from the fields that are needed for the constructor to the type the constructor builds.

What is freer-simple-1.2.1.2 ?

That is a haskell package you can find here.
Sorry, I do not have good answers for the rest of the questions.


---

### Answer by username_1 on 2022-02-08. Score: 2

`*->*` is not a type, but a kind, see <https://wiki.haskell.org/Kind>.

> **Comments:**
> **username_0**: While your answer is intended in the best spirit of helpfulness, I am now convinced that Haskell is a completely foreign language!  
> **username_1**: If you look in Contract.hs, you'll find things like `myTrace :: EmulatorTrace ()`. The use of `::` should tell you that what follows is a type. That type is very similar to `IO ()` that you know from `main :: IO ()`. You just happen to be unlucky here to run into these effects, which are one of the advanced Haskell features that we just use in Plutus without a detailed explanation. Maybe this pointer helps you to some extent: https://reasonablypolymorphic.com/blog/freer-monads/  

---

