Skip to content

Type-level multiplication parsed as application at kind *, no guidance provided

Summary

Location of documentation issue: GHC error message

To reproduce:

Prelude> :set -XDataKinds -XTypeOperators
Prelude> import GHC.TypeNats 
Prelude GHC.TypeNats> :k 2 * 4

<interactive>:1:1: error:
    • Expected kind ‘* -> GHC.Types.Nat -> k0’,
        but ‘2’ has kind ‘GHC.Types.Nat’
    • In the type ‘2 * 4’

The error message is correct, but useless for someone getting started working at the type level. At the very least, a suggestion of adding NoStarIsType is in order.

Proposed improvements or changes

In a kinding error of form "expected * -> r, found s" with StarInType, suggest that this error might be the due to StarInType.

Environment

  • GHC version used (if appropriate): 8.6.5. Asked on IRC, and @Solonarv checked this still exists in 8.8
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information