GHC panic
I like to mix features to make code fail, code inspired by T10318:
-- /tmp/panic.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
class (Frac (Frac a) ~ Frac a, Fractional (Frac a), ID (Frac a)) => ID a where
type Frac a
embed :: a -> Frac a
instance ID Rational where
type Frac Rational = Int
embed :: Rational -> Rational
embed = undefined
When running it with defer-type-errors
it causes GHC to panic:
% ghci -fdefer-type-errors -ignore-dot-ghci panic.hs &> panic.log
actual error included in panic.log. GHC asks me to report this as a bug and I do as I'm told.
Trac metadata
Trac field | Value |
---|---|
Version | 7.11 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |