Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,242
    • Issues 5,242
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 564
    • Merge requests 564
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13365
Closed
Open
Issue created Mar 02, 2017 by Eric Crockett@crockeeaReporter

Notify user when adding a CUSK might help fix a type error

With -XPolyKinds, GADTs require kind signatures where they should be inferred. Moreover, the error when these kind sigs are omitted is baffling.

{-# LANGUAGE PolyKinds, GADTs #-}

import GHC.TypeLits

data Foo
  (x :: k)
  a
  where
    C1 :: (KnownNat x) => a -> Foo x a
    C2 :: a -> Foo Int a
error:
  • Expected kind ‘k’, but ‘x1’ has kind ‘Nat’
  • In the first argument of ‘Foo’, namely ‘x’
    In the type ‘Foo x a’
    In the definition of data constructor ‘C1’

From this error, I would never expect that putting a kind signature on a would help here. But a signature shouldn't be required at all: it's clear from the GADT constructors that a :: *.

Edited Mar 10, 2019 by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking