[Haskell-cafe] Resources on how to implement (Haskell 98) kind-checking?
benjamin.redelings at gmail.com
Thu Oct 14 14:26:00 UTC 2021
Thanks! Good point.
For kind inference, I think that point won't come in to play unless I
add CUSK's, which are not yet on the radar. For type-inference though
that is a good point.
On 10/13/21 8:58 AM, David Feuer wrote:
> Haskell 2010 defines virtually the same language as Haskell 98. The
> differences are too trivial to worry about. One spot you may wish to
> follow GHC (and I think Hugs, at least) rather than the Report:
> On Tue, Oct 12, 2021, 3:37 PM Benjamin Redelings
> <benjamin.redelings at gmail.com> wrote:
> 1. I'm looking for resources that describe how to implement kind
> 98 checking. Does anyone have any suggestions?
> * I've looked at the PolyKinds paper, but it doesn't cover type
> * I've looked at the source code to GHC, but it is hard to follow
> for a
> variety of reasons. It isn't laid out like an algorithm description,
> and the complexity to handle options like PolyKinds and DataKinds
> the code harder to follow.
> 2. One question that came up is how to handle type variables that are
> present in class methods, but are not type class parameters. If there
> are multiple types/classes in a single recursive group, the kind
> of such
> type variables might not be fully resolved until a later
> is processed. Is there a recommended approach?
> I can see two ways to proceed:
> i) First determine the kinds of all the data types, classes, and type
> synonyms. Then perform a second pass over each type or class to
> determine the kinds of type variables (in class methods) that are not
> type class parameters.
> ii) Alternatively, record the kind of each type variable as it is
> encountered -- even though such kinds may contain unification kind
> variables. After visiting all types-or-classes in the recursive
> replace any kind variables with their definition, or with a * if
> is no definition.
> I've currently implement approach i), which requires doing kind
> inference on class methods twice. Is this the recommended approach?
> 3. Also, is Haskell 98 kind checking the same as Haskell 2010 kind
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe