[Haskell-cafe] UNS: Re: Promoting associated data types

Kosyrev Serge _deepfire at feelingofgreen.ru
Mon Jun 29 12:31:10 UTC 2015


Richard Eisenberg <eir at cis.upenn.edu> writes:
> On Jun 28, 2015, at 7:11 PM, Kosyrev Serge <_deepfire at feelingofgreen.ru> wrote:
>> Sadly, even this doesn't fly, because:
>> 
>>> The first argument of a tuple should have kind '*', but 'a' has kind 'CatName'.
>> 
>> ..which doesn't really change even if I replace the tuple with a product type
>> within the CatEntry itself.
>> 
>> Basically GHC refuses to constrain the kind of constructor argument types
>> beyond the granularity provided by '*'.
>> 
>> And so I wonder if this is one restriction among those that you aim to remove.. : -)
>
> No -- this restriction leads to the best definition for tuples, in my
> opinion. Instead, you probably want a promoted tuple: put a ' before the
> open-parenthesis, and see if that works for you.

> data CatEntry where
>     CatEntry ∷ Category a ⇒ '(a, CatX a) → CatEntry

yields:

> Expected a type, but ‘'(a, CatX a)’ has kind ‘(,) CatName *’
> In the type ‘'(a, CatX a)’

whereas:

> data CatEntry where
>     CatEntry ∷ Category a ⇒ a → CatX a → CatEntry

yields:

> Expected a type, but ‘a’ has kind ‘CatName’
> In the type ‘a’

-- 
respectfully,
Косырев Серёга


More information about the Haskell-Cafe mailing list