#5012: haskell 98 program does not typecheck when compiled with -XTypeFamilies ---------------------------------+------------------------------------------ Reporter: jcpetruzza | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.0.2 | Keywords: Testcase: | Blockedby: Os: Unknown/Multiple | Blocking: Architecture: Unknown/Multiple | Failure: GHC rejects valid program ---------------------------------+------------------------------------------ Consider the following valid Haskell 98 function:
{{{ f x = do let apply p r = mapM p (r x) a <- apply id fst b <- apply return snd return (a ++ b) }}} It compiles fine with both ghc 6.12.x and ghc 7. However, if I add the -XTypeFamilies flag to ghc 7 it is rejected with: {{{ mono.hs:5:17: Occurs check: cannot construct the infinite type: a0 = m0 a0 Expected type: m0 a0 -> m0 a0 Actual type: m0 a0 -> m0 (m0 a0) In the first argument of `apply', namely `return' In a stmt of a 'do' expression: b <- apply return snd }}} If one adds a type signature, the error message gets more intimidating. A project of mine uses Type Families in some modules so TypeFamilies is listed as an extension in cabal's configuration file; therefore, it is being passed to every module. That is how I stumbled upon this problem. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5012> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs