Skip to content

Context reduction stack overflow can take very long

The following code, taken from the "Haskell Type Constraints Unleashed" paper:

{-# LANGUAGE TypeFamilies #-}

type family TF a :: *
type instance TF (a,b) = (TF a, TF b)

t :: (a ~ TF (a,Int)) => Int
t = undefined

fails almost immediately with Context reduction stack overflow on GHC 7.2, but seems to loop forever with 7.4.1-rc2. Setting -fcontext-stack to 20 results in near immediate termination with the same error. But #5395 (closed) raised the context stack size default to 200, which makes this code (that does not use -XUndecidableInstances) take "forever" to compile.

Trac metadata
Trac field Value
Version 7.4.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information