[GHC] #7788: Recursive type family causes <<loop>>

#7788: Recursive type family causes <<loop>> ----------------------------------------+----------------------------------- Reporter: shachaf | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect result at runtime | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- This file: {{{ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} data Proxy a = Proxy foo :: Proxy (F (Fix Id)) -> () foo = undefined newtype Fix a = Fix (a (Fix a)) newtype Id a = Id a type family F a type instance F (Fix a) = F (a (Fix a)) type instance F (Id a) = F a main :: IO () main = print $ foo Proxy }}} Dies with `<<loop>>`. The type family is recursive, of course: {{{ *Main> :kind! F (Fix Id) F (Fix Id) :: *^CInterrupted. }}} But `<<loop>>` is still not the behavior I'd expect. The actual value is just `undefined`. In the file that this example came up, the situation was even worse -- there was a situation where {{{ moldMapOf l f = runAccessor . l (Accessor . f) main = print $ (flip appEndo [] . moldMapOf (ix 3) (Endo . (:)) $ testVal :: [Int]) -- <<loop>> main = print $ (flip appEndo [] . runAccessor . (ix 3) (Accessor . Endo . (:)) $ testVal :: [Int]) -- undefined }}} I.e. substitution can turn one program (which happens to be ⊥ here, admittedly, but that's not fundamental) into another (`<<loop>>`). This makes it very tricky to track down the recursive type family. If necessary I can hunt down a working test case and post it here -- it's a bit tricky to get working, though. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7788 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7788: Recursive type family causes <<loop>> ----------------------------------------+----------------------------------- Reporter: shachaf | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler (Type checker) | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Incorrect result at runtime Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------------+----------------------------------- Changes (by igloo): * owner: => simonpj * difficulty: => Unknown * component: Compiler => Compiler (Type checker) * milestone: => 7.8.1 Comment: Simon, is this the expected behaviour? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7788#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC