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,262
    • Issues 4,262
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 419
    • Merge Requests 419
  • 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
  • #7173

Closed
Open
Opened Aug 21, 2012 by Simon Peyton Jones@simonpjDeveloper

Unnecessary constraints in inferred type

Carter Schonwald reports: when playing with the current hackage versions of Epic and Idris to make them play nice with ghc7.6rc1

  • http://hackage.haskell.org/package/idris-0.9.2.1
  • http://hackage.haskell.org/package/epic-0.9.3 (current version on github now builds on ghc 7.6, https://github.com/edwinb/EpiVM)

I ran into some funny type inference problems. Namely, using the idris-0.9.2.1 source and iteratively seeing how ghc complains, I repeated found that ghc would infer extraneous class constraints with variables that don't appear in the function type! eg (Num a, Ord a) => PArg -> Doc, when the correct type to infer would be PArg -> Doc.

Here are some gists with links to more info https://gist.github.com/3365312 https://gist.github.com/3365073 https://gist.github.com/3364775 Anyways, I'm not sure what to make of this, is this a reasonable artifact of type inference getting confused on functions with a large number of case analyses when various typeclass extensions are enabled? Or Is this a bug in terms of what inference should be able to handle?

Edited Mar 09, 2019 by Simon Peyton Jones
Assignee
Assign to
7.6.1
Milestone
7.6.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#7173