Opened 9 years ago

Closed 8 years ago

#2767 closed bug (fixed)

Type family bug ?

Reported by: test Owned by: chak
Priority: normal Milestone: 6.12 branch
Component: Compiler (Type checker) Version: 6.10.1
Keywords: Cc: tom.schrijvers@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: T2767
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I get this error when compiling a program with associated type families:

$ ghc --make Queens_v2.hs 
[1 of 5] Compiling Domain           ( Domain.hs, Domain.o )
[2 of 5] Compiling Solver           ( Solver.hs, Solver.o )
[3 of 5] Compiling FD               ( FD.hs, FD.o )
[4 of 5] Compiling SearchTree       ( SearchTree.hs, SearchTree.o )
[5 of 5] Compiling Main             ( Queens_v2.hs, Queens_v2.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.1 for i386-apple-darwin):
	idInfo co{v a629} [tv]

Tom Schrijvers

Change History (6)

comment:1 Changed 9 years ago by test

I've narrowed down the problem to the code below. The problem is one of type inference.

If either type signature is added, then it compiles fine.

{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fglasgow-exts #-}
module Main where

main = return ()

-- eval' :: Solver solver => Tree solver a -> [(Label solver,Tree solver a)] -> solver [a]
eval' (NewVar f) wl = do v <- newvarSM
                         eval' (f v) wl
eval' Fail       wl = continue wl

-- continue :: Solver solver => [(Label solver,Tree solver a)] -> solver [a] 
continue ((past,t):wl) = do gotoSM past
                            eval' t wl
data Tree s a
                = Fail
                | NewVar (Term s -> Tree s a)

class Monad solver => Solver solver where
        type Term solver        :: *
        type Label solver       :: *
        newvarSM        :: solver (Term solver)
        gotoSM          :: Label solver -> solver ()

comment:2 Changed 9 years ago by test

Cc: tom.schrijvers@… added

comment:3 Changed 9 years ago by chak

Operating System: MacOS XUnknown/Multiple
Owner: set to chak

comment:4 Changed 9 years ago by igloo

difficulty: Unknown
Milestone: 6.10.2

comment:5 Changed 9 years ago by igloo

Milestone: 6.10.26.12 branch

comment:6 Changed 8 years ago by chak

Resolution: fixed
Status: newclosed
Test Case: T2767
Note: See TracTickets for help on using tickets.