Skip to main content
Bumped by Community user
Bumped by Community user
change the title to explain better the question
Link

How string value Why is String being transformed tointerpreted as a type?

add haskell identifier
Source Link

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" andand @"grab" are actually typesomething 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
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?

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 type, 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?

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?

fix incorrect assumption and code
Source Link

How string value is being transformed to a type constructor?

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
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 type constructors, 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 is ahas kind Symbol. Why this is working with TypeApplications? Can I can use this "give" and "grab" as type and/or type constructors anywhere in my code?

How string value is being transformed to a type constructor?

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 type constructors, 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 is a Symbol. Why this is working with TypeApplications? I can use this "give" and "grab" as type constructors anywhere in my code?

How string value is being transformed to a type?

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 type, 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?

more tags
Link
Loading
Source Link
Loading