
#7788: Recursive type family causes <<loop>> -------------------------------------+------------------------------------- Reporter: shachaf | Owner: simonpj Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler (Type | Version: 7.6.2 checker) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | Blocking: Blocked By: | Differential Revisions: Related Tickets: | -------------------------------------+------------------------------------- Comment (by int-e): Replying to [comment:6 goldfire]:
But, with 7.10, the following doesn't:
{{{ type family F a where F a = F a
id2 :: F a -> F a id2 x = x }}}
This is slightly disturbing because `id2` is merely a specialization of `id`.
I think this is wrong: `id2` does not have a type at all, and therefore does not specialize `id`. The same is true for the original example. If one looks at the code generated by ghc-7.8.3, it tries to produce a witness for {{{F (Fix Id)}}} being a type, and `foo` checks that witness (which fails, producing the observed {{{<<loop>>}}}) before producing `undefined`: {{{ -- core, with some non-essential parts omitted cobox_rVz :: Main.F (Main.Fix Main.Id) ~ GHC.Prim.Any cobox_rVz = cobox_rVz foo :: Main.Proxy (Main.F (Main.Fix Main.Id)) -> () foo = case cobox_rVz of GHC.Types.Eq# _ -> undefined }}} That said it's unfortunate that GHC 7.10 loops rather than erroring out for these examples. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7788#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler