[GHC] #11407: -XTypeInType uses up all memory when used in data family instance

GHC ghc-devs at haskell.org
Mon Jan 11 16:46:31 UTC 2016


#11407: -XTypeInType uses up all memory when used in data family instance
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           Keywords:  TypeInType     |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  performance bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Compiling this code with GHC 8.1 causes all my memory to be used very
 quickly:

 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE TypeInType #-}
 module TypeInTypeEatsAllMemory where

 import Data.Kind

 type Const a b = a

 data family UhOh (f :: k1) (a :: k2) (b :: k3)
 data instance UhOh (f :: * -> * -> *) (a :: forall a) (b :: Const * a) =
 UhOh
 }}}

 On the other hand, this code compiles without issue:

 {{{#!hs
 {-# LANGUAGE TypeInType #-}
 module TypeInTypeEatsAllMemory where

 import Data.Kind

 type Const a b = a

 data UhOh (f :: * -> * -> *) (a :: forall a) (b :: Const * a) = UhOh
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11407>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list