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
  • #17295
Closed
Open
Created Oct 03, 2019 by James Payor@jamespayor

Non-confluence with QuantifiedConstraints

EDIT: The ticket was original discovered in the context of the ambiguity checker, and it took some time to figure out that this has nothing to do with ambiguity: it's just about non-confluence in the constraint solver. See helpful examples in #17295 (comment 226331) and #17295 (comment 237871)

The ambiguity checker seems to be doing strange things in the presence of quantified constraints. In particular, you can cause it to try and start solving for arbitrary equalities, which I find strange. And it won't listen to AllowAmbiguousTypes.

[edit @Ericson2314 comment with smaller example: #17295 (comment 231973)]

Here's a minimized example:

{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE AllowAmbiguousTypes #-} -- This fails with and without AllowAmbiguousTypes...

data A
data B

foo :: (A ~ B => a ~ A) => (a ~ A => ()) -> ()
foo _ = ()

GHC reports:

 error:
    • Couldn't match type ‘A’ with ‘B’
    • In the ambiguity check for ‘foo’
      In the type signature:
        foo :: (A ~ B => a ~ A) => (a ~ A => ()) -> ()

I haven't been able to provoke this behaviour without quantified constraints.

I've tested the above with GHC 8.8.1, though it's also likely broken on HEAD too.

Edited Nov 14, 2019 by Richard Eisenberg
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking