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?