[GHC] #14093: GHC.Exe Panic (The 'Impossible' happened)

#14093: GHC.Exe Panic (The 'Impossible' happened) -------------------------------------+------------------------------------- Reporter: ColonelTrick | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.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: -------------------------------------+------------------------------------- Unfortunately, I am just learning Haskell, so I do not have the context to narrow this down to a narrow repro. Console Output: PS C:\Haskell> ghc -o creditCard .\CreditCards.hs [1 of 1] Compiling Main ( CreditCards.hs, Credit ghc.exe: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-mingw32): initTc: unsolved constraints WC {wc_insol = [W] n_a1PN :: t_a1PM[tau:1] (CHoleCan: n)} CreditCards.hs {{{#!hs -- Converts a number to digits toDigits :: Integer -> [Integer] toDigits n | n <= 0 = [] | otherwise = n `mod` 10 : toDigits (n `div` 10) -- Converts a number to digits and then reverses it toDigitsRev :: Integer -> [Integer] toDigitsRev n = reverse . toDigits n -- Doubles every other value doubleEveryOther :: [Integer] -> [Integer] doubleEveryOther[] = [] doubleEveryOther ([x:[]]) = [x] doubleEveryOther (x : y : zs) = x : 2 * y : doubleEveryOther zs -- Sums the digits of the credit card. sumDigits :: [Integer] -> [Integer] sumDigits [] = 0 sumDigits (x:xs) | x < 10 = x + sumDigits xs | otherwise = (x `mod` 10) + (x `div` 10) + sumDigits xs --- Inidicates whether the credit card is valid. validate :: [Integer] -> Bool validate x = (sumDigits (doubleEveryOther (toDigitsRev n)) `mod` 10) == 0 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14093 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14093: GHC.Exe Panic (The 'Impossible' happened) -------------------------------------+------------------------------------- Reporter: ColonelTrick | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #13106 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * version: 8.2.1 => 8.0.2 * resolution: => duplicate * related: => #13106 Comment: Thanks for the bug report. This is a duplicate of #13106, which has been fixed in GHC 8.2.1. (On GHC 8.2.1, it would give a proper error that `n` is out of scope in the definition of `validate`.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14093#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC