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,265
    • Issues 5,265
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 570
    • Merge requests 570
  • 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
  • #12668
Closed
Open
Issue created Oct 06, 2016 by Ben Gamari@bgamari🐢Maintainer

Program that fails Core Lint terribly

While looking for a testcase for another unrelated compiler bug (see D2577) I had the pleasure of encountering this specimen,

{-# LANGUAGE TypeInType #-}
{-# LANGUAGE RankNTypes #-}
module Hi where

import GHC.Exts

data Some r = Some (TYPE r -> TYPE r)

doSomething :: forall (r :: RuntimeRep). forall (a :: TYPE r). ()
            => Int -> (a -> Int) -> a -> a
doSomething n f =
    case n of
      1 -> error "hello"
      3 -> error "hello"

GHC 465c6c5d and 8.0.1 seem to let this program typecheck, but if you enable Core Lint it soon becomes clear that not all is well. Here's a sampling of the carnage,

$ ghc hi.hs -fforce-recomp -dcore-lint -O0
[1 of 1] Compiling Hi               ( hi.hs, hi.o )
*** Core Lint errors : in result of Desugar (after optimization) ***
<no location info>: warning:
    In the type ‘a_a2ON -> Int’
    Ill-kinded argument in type or kind ‘a_a2ON -> Int’
    type or kind ‘a_a2ON -> Int’ kind: TYPE r_a2OM
<no location info>: warning:
    In the type ‘a_a2ON -> a_a2ON’
    Ill-kinded argument in type or kind ‘a_a2ON -> a_a2ON’
    type or kind ‘a_a2ON -> a_a2ON’ kind: TYPE r_a2OM
<no location info>: warning:
    In the type ‘a_a2ON -> a_a2ON’
    Ill-kinded argument in type or kind ‘a_a2ON -> a_a2ON’
    type or kind ‘a_a2ON -> a_a2ON’ kind: TYPE r_a2OM
<no location info>: warning:
    In the expression: patError
                         @ 'PtrRepLifted @ (a_a2ON -> a_a2ON) "hi.hs:(12,5)-(14,24)|case"#
    Ill-kinded argument in type or kind ‘a_a2ON -> a_a2ON’
    type or kind ‘a_a2ON -> a_a2ON’ kind: TYPE r_a2OM
...
Edited Mar 10, 2019 by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking