
#9554: Pathological type family turns type error into runtime loop -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): Another look at this revealed it's not as bad as I thought: the `Show` instance for `Proxy` is ''lazy'' in its argument. So, `foo` was never being evaluated. But, consider this: {{{#!hs {-# LANGUAGE TypeFamilies, UndecidableInstances #-} import Data.Proxy type family F a where F a = F (F a) foo :: Proxy (F Bool) -> Proxy (F Int) foo x = x main = case foo Proxy of Proxy -> putStrLn "Made it!" }}} This ''does'' properly force `foo`, and the result is a runtime loop. The core is similar to that in the original post, in that it contains clearly looping coercions. This is bad: it means that `-XUndecidableInstances` allows programs to go wrong, contrary to my (and many others') assumptions about `-XUndecidableInstances`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9554#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler