Hegel: Generics types can't be generic

Created on 23 Apr 2020  路  3Comments  路  Source: JSMonk/hegel

IMHO, this should typecheck

type T<K> = K
type ApplyNumber<T> = T<number>
const x : ApplyNumber<T> = 3
duplicate

Most helpful comment

There appear to be a couple of issues at play here.

  1. Apply undeclareted generic type 'T' on line 2. Ideally, the generic type wouldn't have to be declared and could instead be inferred. But barring that, it would be nice to be able to declare that within the definition of ApplyNumber.
  2. Generic type "T" should be used with type paramteres! on line 3. This is an issue with partially applying generic types.

They're both related to #2, but I don't know that they're necessarily duplicates.

All 3 comments

Oh, okay. Will fix it. Thank you for your contribution ^_^

And also it's duplicate Issue #2

There appear to be a couple of issues at play here.

  1. Apply undeclareted generic type 'T' on line 2. Ideally, the generic type wouldn't have to be declared and could instead be inferred. But barring that, it would be nice to be able to declare that within the definition of ApplyNumber.
  2. Generic type "T" should be used with type paramteres! on line 3. This is an issue with partially applying generic types.

They're both related to #2, but I don't know that they're necessarily duplicates.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Finesse picture Finesse  路  5Comments

Mathspy picture Mathspy  路  5Comments

artalar picture artalar  路  4Comments

jarble picture jarble  路  4Comments

devhammed picture devhammed  路  3Comments