Opened 7 years ago

Closed 7 years ago

#7838 closed bug (fixed)

ghc(i) crashes on instance declaration

Reported by: alios Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.2
Keywords: MultiParamTypeClasses Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

multiple lines, ''no wiki''

{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, ConstraintKinds, UndecidableInstances, FunctionalDependencies, FlexibleInstances #-}


{-
after declaring the instance 

instance TS TST TT m where

below my ghci crashes on arch linux x86_64, if you comment it out no crash happens.

ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.2 for x86_64-unknown-linux):
	getClassPredTys
<<details unavailable>>

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
-}



module Crash where

class T t where
  type TPI t :: *
       
class (T t, C (TPI t) m (TPI t)) => TC c t m | c -> t

class (T t, C (TPI t) m (TPI t)) => TS s t m | s -> t
  
data C i m o

data TST

data TT

instance TS TST TT m where

Change History (1)

comment:1 Changed 7 years ago by monoidal

Resolution: fixed
Status: newclosed

Thanks for the report. The bug is already fixed in HEAD. Now you get:

A.hs:28:13:
    Expected a constraint, but ‛C (TPI t) m (TPI t)’ has kind ‛*’
    In the class declaration for ‛TS’

Here's a reduced version:

{-# LANGUAGE ConstraintKinds, UndecidableInstances, FlexibleInstances #-}

module Crash where

data C m

class (C m) => TS m
 
instance TS m where

Once you change "data C m" to "class C m", there's no panic. Sometimes 7.6 does not enforce the difference between kinds Constraint and * during type-checking.

Note: See TracTickets for help on using tickets.