[GHC] #13927: Panic!

#13927: Panic! -------------------------------------+------------------------------------- Reporter: Deus | 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, I'm using haskell for an assignment and I createt this (which told me to do a bug report): [1 of 1] Compiling Main ( plant.hs, plant.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] true_a1Gg :: t_a1Gf[tau:1] (CHoleCan: true) [W] false_a1Gj :: t_a1Gi[tau:1] (CHoleCan: false) [W] true_a1Qq :: t_a1Qp[tau:1] (CHoleCan: true)} {{{#!hs data Farbe = Rot | Rosa | Weis | Blau | Lila | Grun | Gelb deriving (Show, Eq) data Pflanze = Blatt | Blute Farbe | Stiel Pflanze Pflanze deriving (Show, Eq) fold_pflanze :: (a -> a -> a) -> (Farbe -> a) -> a -> Pflanze -> a fold_pflanze f g x (Blatt) = x fold_pflanze f g x (Blute fa) = (f x (g fa)) fold_pflanze f g x (Stiel p1 p2) = fold_pflanze f g (fold_pflanze f g x p1) p2 --4. farbezuliste :: Farbe -> [Farbe] farbezuliste f = [f] appendlisten :: [Farbe] -> [Farbe] -> [Farbe] appendlisten f1 f2 = f1 ++ f2 blutenfarben :: Pflanze -> [Farbe] blutenfarben p = fold_pflanze appendlisten farbezuliste [] p --5. fold_pflanze2 :: (Farbe -> Int) -> Int -> Pflanze -> Int fold_pflanze2 f x (Blatt) = x + 1; fold_pflanze2 f x (Blute fa) = x + (f fa) fold_pflanze2 f x (Stiel p1 p2) = (-2) + (fold_pflanze2 f (fold_pflanze2 f x p1) p2) evaluatefarbe :: Farbe -> Int evaluatefarbe Rot = 2 evaluatefarbe Rosa = 3 evaluatefarbe Weis = 5 evaluatefarbe Blau = 1 evaluatefarbe Lila = 10 evaluatefarbe Grun = -1 evaluatefarbe Gelb = 0 schonheit :: Pflanze -> Int schonheit p = fold_pflanze2 evaluatefarbe 0 p --6. istrosa :: Farbe -> Bool istrosa Rosa = true istrosa otherwise = false und :: Bool -> Bool -> Bool und x y = x && y rosabluhend :: Pflanze -> Bool rosabluhend p = fold_pflanze und istrosa true p }}} I tryed to add the code as attechment bug it crashed (It also told me to do a bug report but I have an assignment to do). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13927 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13927: Panic! -------------------------------------+------------------------------------- Reporter: Deus | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 Deus: @@ -73,0 +73,3 @@ + + EDIT: + It seems to be the part that belongs to 6 New description: Hi, I'm using haskell for an assignment and I createt this (which told me to do a bug report): [1 of 1] Compiling Main ( plant.hs, plant.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] true_a1Gg :: t_a1Gf[tau:1] (CHoleCan: true) [W] false_a1Gj :: t_a1Gi[tau:1] (CHoleCan: false) [W] true_a1Qq :: t_a1Qp[tau:1] (CHoleCan: true)} {{{#!hs data Farbe = Rot | Rosa | Weis | Blau | Lila | Grun | Gelb deriving (Show, Eq) data Pflanze = Blatt | Blute Farbe | Stiel Pflanze Pflanze deriving (Show, Eq) fold_pflanze :: (a -> a -> a) -> (Farbe -> a) -> a -> Pflanze -> a fold_pflanze f g x (Blatt) = x fold_pflanze f g x (Blute fa) = (f x (g fa)) fold_pflanze f g x (Stiel p1 p2) = fold_pflanze f g (fold_pflanze f g x p1) p2 --4. farbezuliste :: Farbe -> [Farbe] farbezuliste f = [f] appendlisten :: [Farbe] -> [Farbe] -> [Farbe] appendlisten f1 f2 = f1 ++ f2 blutenfarben :: Pflanze -> [Farbe] blutenfarben p = fold_pflanze appendlisten farbezuliste [] p --5. fold_pflanze2 :: (Farbe -> Int) -> Int -> Pflanze -> Int fold_pflanze2 f x (Blatt) = x + 1; fold_pflanze2 f x (Blute fa) = x + (f fa) fold_pflanze2 f x (Stiel p1 p2) = (-2) + (fold_pflanze2 f (fold_pflanze2 f x p1) p2) evaluatefarbe :: Farbe -> Int evaluatefarbe Rot = 2 evaluatefarbe Rosa = 3 evaluatefarbe Weis = 5 evaluatefarbe Blau = 1 evaluatefarbe Lila = 10 evaluatefarbe Grun = -1 evaluatefarbe Gelb = 0 schonheit :: Pflanze -> Int schonheit p = fold_pflanze2 evaluatefarbe 0 p --6. istrosa :: Farbe -> Bool istrosa Rosa = true istrosa otherwise = false und :: Bool -> Bool -> Bool und x y = x && y rosabluhend :: Pflanze -> Bool rosabluhend p = fold_pflanze und istrosa true p }}} I tryed to add the code as attechment bug it crashed (It also told me to do a bug report but I have an assignment to do). EDIT: It seems to be the part that belongs to 6 -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13927#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13927: Panic! -------------------------------------+------------------------------------- Reporter: Deus | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: | -------------------------------------+------------------------------------- Comment (by goldfire): Thanks very much for reporting! I believe this bug has been fixed (see #12921), but I also cannot reproduce it. Are there `import` statements or the `module` header at the top of your file? We'd need to be able to reproduce the error in order to verify that it's fixed. Thanks. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13927#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13927: Panic! -------------------------------------+------------------------------------- Reporter: Deus | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: | -------------------------------------+------------------------------------- Comment (by Deus): Thats the hole code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13927#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13927: Panic! -------------------------------------+------------------------------------- Reporter: Deus | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): This is a duplicate of #13106. It panics in 8.0.2 (you need to compile with `ghc`, not `ghci`) but not in GHC 8.2.1: {{{ $ /opt/ghc/8.2.1/bin/ghc -fforce-recomp Bug.hs [1 of 1] Compiling Main ( Bug.hs, Bug.o ) Bug.hs:1:1: error: The IO action ‘main’ is not defined in module ‘Main’ | 1 | data Farbe = Rot | Rosa | Weis | Blau | Lila | Grun | Gelb | ^ Bug.hs:46:16: error: • Variable not in scope: true :: Bool • Perhaps you meant data constructor ‘True’ (imported from Prelude) | 46 | istrosa Rosa = true | ^^^^ Bug.hs:47:21: error: • Variable not in scope: false :: Bool • Perhaps you meant data constructor ‘False’ (imported from Prelude) | 47 | istrosa otherwise = false | ^^^^^ Bug.hs:53:42: error: • Variable not in scope: true :: Bool • Perhaps you meant data constructor ‘True’ (imported from Prelude) | 53 | rosabluhend p = fold_pflanze und istrosa true p | ^^^^ }}} Alternatively, you can make the panic go away by just adding `module Plant where` at the top of the file. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13927#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13927: Panic! -------------------------------------+------------------------------------- Reporter: Deus | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13927#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC