Ticket #4358 (closed bug: fixed)
infinite loop on unification with a type family context
Description
The following throws ghc (and ghci) in a loop (ghc-7.0.0.20100925 for i386-unknown-mingw32) and it eventually aborts with "ghc.exe: out of memory".
> {-# LANGUAGE TypeFamilies, Rank2Types, FlexibleContexts #-}
> type family T a
> t2 :: forall a. ((T a ~ a) => a) -> a
> t2 = t
> t :: forall a. ((T a ~ a) => a) -> a
> t = undefined
Using ghc 6.12.1 we do not get a loop, but a puzzling error:
typeBug.lhs:9:7:
Couldn't match expected type `(T a ~ a) => a'
against inferred type `(T a ~ a) => a'
Expected type: (T a ~ a) => a Inferred type: (T a ~ a) => a
In the expression: t In the definition of `t2': t2 = t
I presume that the non-injectivity of type family T triggers the problem however the following produces no errors in either version of the compiler.
> ok2 :: forall a. T a -> a > ok2 = ok > ok :: forall a. T a -> a > ok = undefined
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

