GHC 8.6+ loops infinitely on an UndecidableInstances error message
This regression was introduced in commit e1b5a117 (Fix a nasty bug in piResultTys
), which is present in the ghc-8.6
and master
branches. To observe the issue, try compiling the following program:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
-- {-# LANGUAGE UndecidableInstances #-}
module Bug where
type family Undefined :: k where {}
type family LetInterleave xs t ts is (a_ahkO :: [a]) (a_ahkP :: [[a]]) :: [[a]] where
LetInterleave xs t ts is y z = Undefined y z
You'll get this far:
$ ~/Software/ghc4/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:11:3: error:
• Variables ‘a, a’ occur more often
in the type family application
Before GHC hangs. (I was unable to kill this with Ctrl+C; I had to resort to kill -9
.)
Interestingly, the commit f8618a9b (Remove the type-checking knot.
) does not appear to have an effect on this.
Trac metadata
Trac field | Value |
---|---|
Version | 8.5 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | highest |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | simonpj |
Operating system | |
Architecture |