Skip to content

GitLab

  • Menu
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 4,862
    • Issues 4,862
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • 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 Compiler
  • GHCGHC
  • Issues
  • #9622
Closed
Open
Created Sep 21, 2014 by Krzysztof Gogolewski@monoidalDeveloper

GHCi command to solve a constraint

It would be nice to have a :solve command for ghci that took a class constraint and returned either its derivation or an error message. A possible interface could look like so:

ghci> :solve Eq (Maybe Type1, Bool)
1) Eq Type1                 -- Defined in ‘MyModule’
2) Eq a => Eq (Maybe a)     -- Defined in ‘GHC.Classes’
3) Eq (Maybe Type1)         -- Put a ~ Int in 2) and use 1)
4) Eq Bool                  -- Defined in ‘GHC.Classes’
5) (Eq a, Eq b) => Eq (a,b) -- Defined in ‘GHC.Classes’
6) Eq (Maybe Type1, Bool)   -- Put a ~ Maybe Type1, b ~ Bool in 5) and use 3), 4) 
ghci> :solve Eq (Int -> Int)
No instance for Eq (Int -> Int)
Edited Mar 09, 2019 by Krzysztof Gogolewski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking