<p>The extension that you are after is not <code>TypeAplications</code>, but <code>DataKinds</code>. I liked the explanations here: <a href="https://stackoverflow.com/questions/20558648/what-is-the-datakinds-extension-of-haskell">https://stackoverflow.com/questions/20558648/what-is-the-datakinds-extension-of-haskell</a></p>

CC BY-SA 4.0
2022-02-21T18:44:43.467Z
`DataKinds` explains why `Endpoint` can receive a type as argument and return a concret type, but it does not explain why I am allowed to use `"give"` and `"grab"` as type references on `@` operator argument
Walker Leite
CC BY-SA 4.0
2022-02-21T19:12:32.920Z
No, because of `DataKinds` you can use `"give"` as a type, both in `Endpoint` and in the type application. Because of the `DataKinds`extension, `String` becomes a kind and the values of type `String` become types of kind `String`.
Mihai Codescu
CC BY-SA 4.0
2022-02-21T19:37:04.907Z
Also see the example Lars gave in the lecture https://youtu.be/qoUfgaHs1CI?list=PLNEK_Ejlx3x230-g-U02issX5BiWAgmSi&t=855:
1. type application allows us to disambiguate the type of callEndpoint
2. data kinds allows us to use type-level strings
Mihai Codescu
CC BY-SA 4.0
2022-02-21T15:38:12.683Z
2022-02-21T15:38:12.683Z
Mihai Codescu
<p>According <a href="https://gitlab.haskell.org/ghc/ghc/-/wikis/type-application" rel="nofollow noreferrer">type applications</a>, this extension <code>allows to give explicit type arguments to a polymorphic function</code>.</p>
<pre><code>type VestingSchema =
             Endpoint &quot;give&quot; GiveParams
         .\/ Endpoint &quot;grab&quot; ()
-- ...
endpoints :: Contract () VestingSchema Text ()
endpoints = awaitPromise (give' `select` grab') &gt;&gt; endpoints
   where
     give' = endpoint @&quot;give&quot; give
     grab' = endpoint @&quot;grab&quot; $ const grab
</code></pre>
<p>This does not allows to give values to a polymorphic function, so I have figured out that actually those &quot;strings&quot; at <code>@&quot;give&quot;</code> and <code>@&quot;grab&quot;</code> are actually something similar to types, because the type <code>Endpoint</code> has this type/kind signature:</p>
<pre><code>type Endpoint :: ghc-prim-0.6.1:GHC.Types.Symbol
                 -&gt; * -&gt; row-types-1.0.1.2:Data.Row.Internal.Row *
type Endpoint l a =
  l
  row-types-1.0.1.2:Data.Row.Internal..== (Wallet.Types.EndpointValue
                                             a,
                                           Plutus.Contract.Effects.ActiveEndpoint)
  :: row-types-1.0.1.2:Data.Row.Internal.Row *
        -- Defined in ‘Plutus.Contract.Request
</code></pre>
<p>So that <code>l</code> has kind <code>Symbol</code>. Why this is working with TypeApplications? Can I use this &quot;give&quot; and &quot;grab&quot; as type and/or type constructors anywhere in my code?</p>

<plutus><plutus-pioneer-program><haskell><plutus-pab>
Why is String being interpreted as a type?
# Why is String being interpreted as a type?

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

According type applications, this extension allows to give explicit type arguments to a polymorphic function.
type VestingSchema =
             Endpoint "give" GiveParams
         .\/ Endpoint "grab" ()
-- ...
endpoints :: Contract () VestingSchema Text ()
endpoints = awaitPromise (give' `select` grab') >> endpoints
   where
     give' = endpoint @"give" give
     grab' = endpoint @"grab" $ const grab

This does not allows to give values to a polymorphic function, so I have figured out that actually those "strings" at @"give" and @"grab" are actually something similar to types, because the type Endpoint has this type/kind signature:
type Endpoint :: ghc-prim-0.6.1:GHC.Types.Symbol
                 -> * -> row-types-1.0.1.2:Data.Row.Internal.Row *
type Endpoint l a =
  l
  row-types-1.0.1.2:Data.Row.Internal..== (Wallet.Types.EndpointValue
                                             a,
                                           Plutus.Contract.Effects.ActiveEndpoint)
  :: row-types-1.0.1.2:Data.Row.Internal.Row *
        -- Defined in ‘Plutus.Contract.Request

So that l has kind Symbol. Why this is working with TypeApplications? Can I use this "give" and "grab" as type and/or type constructors anywhere in my code?

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

---

## 1 answers

### Answer by username_1 on 2022-02-21. Score: 0 | Accepted answer

The extension that you are after is not `TypeAplications`, but `DataKinds`. I liked the explanations here: <https://stackoverflow.com/questions/20558648/what-is-the-datakinds-extension-of-haskell>

> **Comments:**
> **username_0**: `DataKinds` explains why `Endpoint` can receive a type as argument and return a concret type, but it does not explain why I am allowed to use `"give"` and `"grab"` as type references on `@` operator argument  
> **username_1**: No, because of `DataKinds` you can use `"give"` as a type, both in `Endpoint` and in the type application. Because of the `DataKinds`extension, `String` becomes a kind and the values of type `String` become types of kind `String`.  
> **username_1**: Also see the example Lars gave in the lecture https://youtu.be/qoUfgaHs1CI?list=PLNEK_Ejlx3x230-g-U02issX5BiWAgmSi&t=855: 1. type application allows us to disambiguate the type of callEndpoint 2. data kinds allows us to use type-level strings  

---

