[GHC] #12866: GHC internal error while building darcsden

#12866: GHC internal error while building darcsden -------------------------------------+------------------------------------- Reporter: simonmic | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I get an internal error while building darcsden with GHC 8.0.1: $ darcs get hub.darcs.net:simon/darcsden-ghc8 $ cd darcsden-ghc8 $ stack --stack-yaml=stack-ghc8.yaml build ... [12 of 56] Compiling DarcsDen.Backend.Transient ( src/DarcsDen/Backend/Transient.hs, .stack- work/dist/i386-linux/Cabal-1.24.0.0/build/DarcsDen/Backend/Transient.o ) /home/simon/src/darcsden/src/DarcsDen/Backend/Transient.hs:10:33: error: • GHC internal error: ‘BackendTransientM’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [ajE2 :-> Type variable ‘bt’ = bt] • In the first argument of ‘MonadIO’, namely ‘BackendTransientM bt’ In the type ‘(BT bt, MonadIO (BackendTransientM bt))’ In the type declaration for ‘BTIO’ /home/simon/src/darcsden/src/DarcsDen/Backend/Transient.hs:44:1: error: • Non type-variable argument in the constraint: Functor (BackendTransientM bt) (Use FlexibleContexts to permit this) • In the context: (Functor (BackendTransientM bt), Monad (BackendTransientM bt)) While checking the super-classes of class ‘BackendTransient’ In the class declaration for ‘BackendTransient’ -- While building package darcsden-1.1.99 using: /home/simon/.stack/setup-exe-cache/i386-linux/setup-Simple- Cabal-1.24.0.0-ghc-8.0.1 --builddir=.stack- work/dist/i386-linux/Cabal-1.24.0.0 build lib:darcsden exe:darcsden exe :darcsden-post-hook exe:da... Process exited with code: ExitFailure 1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12866 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12866: GHC internal error while building darcsden -------------------------------------+------------------------------------- Reporter: simonmic | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmic): View code at http://hub.darcs.net/simon/darcsden- ghc8/browse/src/DarcsDen/Backend/Transient.hs#10 : {{{ 9 type BT bt = (BackendTransient bt, ?backendTransient :: bt) 10 type BTIO bt = (BT bt, MonadIO (BackendTransientM bt)) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12866#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12866: GHC internal error while building darcsden -------------------------------------+------------------------------------- Reporter: simonmic | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * component: Compiler => Compiler (Type checker) * milestone: => 8.2.1 @@ -2,1 +2,1 @@ - + {{{ @@ -34,0 +34,1 @@ + }}} New description: I get an internal error while building darcsden with GHC 8.0.1: {{{ $ darcs get hub.darcs.net:simon/darcsden-ghc8 $ cd darcsden-ghc8 $ stack --stack-yaml=stack-ghc8.yaml build ... [12 of 56] Compiling DarcsDen.Backend.Transient ( src/DarcsDen/Backend/Transient.hs, .stack- work/dist/i386-linux/Cabal-1.24.0.0/build/DarcsDen/Backend/Transient.o ) /home/simon/src/darcsden/src/DarcsDen/Backend/Transient.hs:10:33: error: • GHC internal error: ‘BackendTransientM’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [ajE2 :-> Type variable ‘bt’ = bt] • In the first argument of ‘MonadIO’, namely ‘BackendTransientM bt’ In the type ‘(BT bt, MonadIO (BackendTransientM bt))’ In the type declaration for ‘BTIO’ /home/simon/src/darcsden/src/DarcsDen/Backend/Transient.hs:44:1: error: • Non type-variable argument in the constraint: Functor (BackendTransientM bt) (Use FlexibleContexts to permit this) • In the context: (Functor (BackendTransientM bt), Monad (BackendTransientM bt)) While checking the super-classes of class ‘BackendTransient’ In the class declaration for ‘BackendTransient’ -- While building package darcsden-1.1.99 using: /home/simon/.stack/setup-exe-cache/i386-linux/setup-Simple- Cabal-1.24.0.0-ghc-8.0.1 --builddir=.stack- work/dist/i386-linux/Cabal-1.24.0.0 build lib:darcsden exe:darcsden exe :darcsden-post-hook exe:da... Process exited with code: ExitFailure 1 }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12866#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12866: GHC internal error while building darcsden -------------------------------------+------------------------------------- Reporter: simonmic | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Can you try with HEAD? See #12867 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12866#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12866: GHC internal error while building darcsden -------------------------------------+------------------------------------- Reporter: simonmic | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by simonmic: @@ -3,1 +3,1 @@ - $ darcs get hub.darcs.net:simon/darcsden-ghc8 + $ darcs get http://hub.darcs.net/simon/darcsden-ghc8 [--lazy] New description: I get an internal error while building darcsden with GHC 8.0.1: {{{ $ darcs get http://hub.darcs.net/simon/darcsden-ghc8 [--lazy] $ cd darcsden-ghc8 $ stack --stack-yaml=stack-ghc8.yaml build ... [12 of 56] Compiling DarcsDen.Backend.Transient ( src/DarcsDen/Backend/Transient.hs, .stack- work/dist/i386-linux/Cabal-1.24.0.0/build/DarcsDen/Backend/Transient.o ) /home/simon/src/darcsden/src/DarcsDen/Backend/Transient.hs:10:33: error: • GHC internal error: ‘BackendTransientM’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [ajE2 :-> Type variable ‘bt’ = bt] • In the first argument of ‘MonadIO’, namely ‘BackendTransientM bt’ In the type ‘(BT bt, MonadIO (BackendTransientM bt))’ In the type declaration for ‘BTIO’ /home/simon/src/darcsden/src/DarcsDen/Backend/Transient.hs:44:1: error: • Non type-variable argument in the constraint: Functor (BackendTransientM bt) (Use FlexibleContexts to permit this) • In the context: (Functor (BackendTransientM bt), Monad (BackendTransientM bt)) While checking the super-classes of class ‘BackendTransient’ In the class declaration for ‘BackendTransient’ -- While building package darcsden-1.1.99 using: /home/simon/.stack/setup-exe-cache/i386-linux/setup-Simple- Cabal-1.24.0.0-ghc-8.0.1 --builddir=.stack- work/dist/i386-linux/Cabal-1.24.0.0 build lib:darcsden exe:darcsden exe :darcsden-post-hook exe:da... Process exited with code: ExitFailure 1 }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12866#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12866: GHC internal error while building darcsden -------------------------------------+------------------------------------- Reporter: simonmic | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12867 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => fixed * related: => #12867 Comment: Here's (what I believe to be) a minimal test case: {{{#!hs {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ConstraintKinds #-} -- {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ImplicitParams #-} module T12866 where import Control.Monad.IO.Class type BT bt = (BackendTransient bt, ?backendTransient :: bt) type BTIO bt = (BT bt, MonadIO (BackendTransientM bt)) class (Functor (BackendTransientM bt), Monad (BackendTransientM bt)) => BackendTransient bt where type BackendTransientM bt :: * -> * }}} Running this with GHC 8.0.1/8.0.2 yields: {{{ [1 of 1] Compiling T12866 ( Bug.hs, interpreted ) Bug.hs:11:33: error: • GHC internal error: ‘BackendTransientM’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [a142 :-> Type variable ‘bt’ = bt] • In the first argument of ‘MonadIO’, namely ‘BackendTransientM bt’ In the type ‘(BT bt, MonadIO (BackendTransientM bt))’ In the type declaration for ‘BTIO’ Bug.hs:13:1: error: • Non type-variable argument in the constraint: Functor (BackendTransientM bt) (Use FlexibleContexts to permit this) • In the context: (Functor (BackendTransientM bt), Monad (BackendTransientM bt)) While checking the super-classes of class ‘BackendTransient’ In the class declaration for ‘BackendTransient’ }}} But in GHC HEAD, there's no internal error: {{{ [1 of 1] Compiling T12866 ( Bug.hs, interpreted ) Bug.hs:11:1: error: • Non type-variable argument in the constraint: MonadIO (BackendTransientM bt) (Use FlexibleContexts to permit this) • In the type synonym declaration for ‘BTIO’ Bug.hs:13:1: error: • Non type-variable argument in the constraint: Functor (BackendTransientM bt) (Use FlexibleContexts to permit this) • In the context: (Functor (BackendTransientM bt), Monad (BackendTransientM bt)) While checking the super-classes of class ‘BackendTransient’ In the class declaration for ‘BackendTransient’ }}} The workaround is simple: just enable `FlexibleContexts`. That makes it compile without issue on GHC 8.0.1, 8.0.2, and HEAD. For completeness's sake, I was able to reproduce the issue when building `darcsden` with GHC 8.0.1, and I confirmed that enabling `FlexibleContexts` at the top of the file made the internal error go away. I don't have time to build everything again with GHC HEAD, but I think the story would be pretty similar. In conclusion, this is a much more elaborate example of #12867. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12866#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC