Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,322
    • Issues 4,322
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 367
    • Merge Requests 367
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13677

Closed
Open
Opened May 09, 2017 by Ryan Scott@RyanGlScottMaintainer

Incorrect parenthesization of type in error message

If you compile this program:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}

import GHC.Exts (Constraint)

data Dict a where
  Dict :: a => Dict a

foo :: Dict (Int ~ Int) => Int
foo = undefined

In GHC 8.0.1, 8.0.2, 8.2.1, or HEAD, it will give this error message:

GHCi, version 8.3.20170509: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Main             ( Bug2.hs, interpreted )

Bug2.hs:9:8: error:
    • Expected a constraint, but ‘Dict Int ~ Int’ has kind ‘*’
    • In the type signature: foo :: Dict (Int ~ Int) => Int
  |
9 | foo :: Dict (Int ~ Int) => Int
  |        ^^^^^^^^^^^^^^^^

But Dict Int ~ Int is not parenthesized correctly!

This is a regression, as GHC 7.10.3 and earlier parenthesize it correctly:

GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Bug2.hs, interpreted )

Bug2.hs:9:8:
    Expected a constraint, but ‘Dict (Int ~ Int)’ has kind ‘*’
    In the type signature for ‘foo’: foo :: Dict (Int ~ Int) => Int
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
8.2.1
Milestone
8.2.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#13677