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,865
    • Issues 4,865
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 461
    • Merge requests 461
  • 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
  • #21319
Closed
Open
Created Mar 30, 2022 by Ryan Scott@RyanGlScottMaintainer

HEAD fails to compile futhark-0.21.8 after "Kill derived constraints" patch

After commit a599abba, GHC HEAD is no longer able to compile the futhark-0.21.8 library on Hackage. Here is a minimized example of the problem:

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where

type family F x

f :: (F a ~ Maybe a, Show (F a)) => a -> IO ()
f _ = pure ()

g :: (F a ~ Maybe a, Show (F a)) => a -> IO ()
g = go
  where
    go = f

While GHC 9.2 and earlier are able to compile this, HEAD rejects it with:

$ ~/Software/ghc-9.3.20220328/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o ) [Source file changed]

Bug.hs:13:10: error:
    • Could not deduce (Show a) arising from a use of ‘f’
      from the context: (F a ~ Maybe a, Show (F a))
        bound by the type signature for:
                   g :: forall a. (F a ~ Maybe a, Show (F a)) => a -> IO ()
        at Bug.hs:10:1-46
      Possible fix:
        add (Show a) to the context of
          the type signature for:
            g :: forall a. (F a ~ Maybe a, Show (F a)) => a -> IO ()
    • In the expression: f
      In an equation for ‘go’: go = f
      In an equation for ‘g’:
          g = go
            where
                go = f
   |
13 |     go = f
   |          ^

The release notes entries in a599abba didn't appear to mention this kind of program behavior changing, so I thought it best to file a GHC issue about this. @rae, should this be expected to work?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking