[GHC] #13787: The compiler told me to report this. I have no idea what happened

#13787: The compiler told me to report this. I have no idea what happened -------------------------------------+------------------------------------- Reporter: gleb_dianov | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Linux Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Hi, Here is the error: ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] err_aaeS :: t_aaeR[tau:1] (CHoleCan: err)} {{{#!hs teach :: l ~ S l' => ErrorFunction m -> ErrorFunction o -> LearningRate -> Vector (Example i o) m -> Network i l o -> Either StopCriteria (Either Error Iterations) -> NetowrkArgs i l o -> NetworkArgs i l o teach totalErr errF learnRate examples stopCriteria network args = teachNetwork network 0 where teachNetwork :: Network i l o -> Iterations -> Network i l o teachNetwork net i | not $ shouldStop stopCriteria (networkError net) i = teachNetwork (foldl updateNetworkHelper net examples) (i + 1) | otherwise = net networkError :: Network i l o -> Error networkError = undefined updateNetworkHelper :: Network i l o -> Example i o -> Network i l o updateNetworkHelper net@(layer :~~ netTail) example = if example ^. output == runNetwork net (examples ^. input) then net else snd $ updateNetwork layer netTail errF (example ^. inputs) (example ^. outputs) }}} This function broke the compiler. Here is a link to the git repo with this code (module Network) https://gitlab.com/gleb_dianov/neural-haskell With this project I wanted to show how cool Haskell is, but now I can only show how GHC crashes :( -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13787 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13787: The compiler told me to report this. I have no idea what happened -------------------------------------+------------------------------------- Reporter: gleb_dianov | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by gleb_dianov): * version: 8.0.1 => 8.0.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13787#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13787: The compiler told me to report this. I have no idea what happened -------------------------------------+------------------------------------- Reporter: gleb_dianov | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by gleb_dianov: @@ -37,0 +37,4 @@ + + UPD. + I updated to lts-8.16. Then I commented out the function and compiled the + project and when I uncommented it the compiler didn't crash New description: Hi, Here is the error: ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] err_aaeS :: t_aaeR[tau:1] (CHoleCan: err)} {{{#!hs teach :: l ~ S l' => ErrorFunction m -> ErrorFunction o -> LearningRate -> Vector (Example i o) m -> Network i l o -> Either StopCriteria (Either Error Iterations) -> NetowrkArgs i l o -> NetworkArgs i l o teach totalErr errF learnRate examples stopCriteria network args = teachNetwork network 0 where teachNetwork :: Network i l o -> Iterations -> Network i l o teachNetwork net i | not $ shouldStop stopCriteria (networkError net) i = teachNetwork (foldl updateNetworkHelper net examples) (i + 1) | otherwise = net networkError :: Network i l o -> Error networkError = undefined updateNetworkHelper :: Network i l o -> Example i o -> Network i l o updateNetworkHelper net@(layer :~~ netTail) example = if example ^. output == runNetwork net (examples ^. input) then net else snd $ updateNetwork layer netTail errF (example ^. inputs) (example ^. outputs) }}} This function broke the compiler. Here is a link to the git repo with this code (module Network) https://gitlab.com/gleb_dianov/neural-haskell With this project I wanted to show how cool Haskell is, but now I can only show how GHC crashes :( UPD. I updated to lts-8.16. Then I commented out the function and compiled the project and when I uncommented it the compiler didn't crash -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13787#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13787: The compiler told me to report this. I have no idea what happened -------------------------------------+------------------------------------- Reporter: gleb_dianov | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13106 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate * related: => #13106 Comment: Thanks for the bug report. I don't have time to dig into the internals of your particular project, but there is a 99.9% chance that this is an occurrence of #13106, a known bug which has been fixed in GHC 8.2.1. The underlying cause is usually that you forgot to import some top-level identifier (in your case, probably `err`). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13787#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13787: The compiler told me to report this. I have no idea what happened -------------------------------------+------------------------------------- Reporter: gleb_dianov | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13106 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by gleb_dianov): Replying to [comment:3 RyanGlScott]:
Thanks for the bug report. I don't have time to dig into the internals of your particular project, but there is a 99.9% chance that this is an occurrence of #13106, a known bug which has been fixed in GHC 8.2.1. The underlying cause is usually that you forgot to import some top-level identifier (in your case, probably `err`).
This error didn't occur after I fixed some compile-time errors in the module (didn't have any problems with imports though), so I'm happy -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13787#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC