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?