[GHC] #14371: ghc: panic! when reloading file with code

GHC ghc-devs at haskell.org
Wed Oct 18 21:17:42 UTC 2017


#14371: ghc: panic! when reloading file with code
-------------------------------------+-------------------------------------
           Reporter:  xvrbka1        |             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:
-------------------------------------+-------------------------------------
 Hello,

 I have no idea what causes it (maybe my mistake) so I probably will give
 you more code then necessaty. Sorry for that.
  \\
 **I had working code:**

 {{{
 f :: [[Bool]] -> ([Bool], [[Bool]])
 f [] = ([True], g [])
 f (x:xs) = (g x, g xs)

 g :: [a] -> [a]
 g [] = []
 g x = x

 listITE :: [Bool] -> [a] -> [a] -> [a]
 listITE [] _ _ = []
 listITE _ _ [] = []
 listITE _ [] _ = []
 listITE (b:bs) (x:xs) (y:ys) = [(if b then x else y)] ++ listITE bs xs ys
 --zipWith (\x,y -> if  ) ;

 firstMatch :: (a -> a -> Bool) -> [a] -> a -> a
 firstMatch _ [] y = y
 firstMatch p (x:s) y =  if index >= (length (x:s)) then y  else (x:s) !!
 index
                             where index = indexOf True (zipWith p (x:s) s)

 indexOf :: (Eq a) => a -> [a] -> Int
 indexOf _ [] = 10
 indexOf c (x:s) = if c==x then 0 else 1 + indexOf c s
 }}}
 that I could load, run and reload.
 \\

 **
 After I wrote this and tried to reload:**
 {{{
 countInversions :: (Ord a) => [a] -> Int
 countInversions [] = 0
 countInversions (x:s) = (countSame (True==) (map (x>) s)) +
 countInversions s

 countSame :: (Ord a) => (a -> Bool) [a] -> Int
 countSame _ [] = 0;
 countSame p (x:s) = (if p x then 1 else 0) + indexOf c s

 }}}
 \\

 **I get error:**
 ''ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.1 for x86_64-unknown-linux):
         repSplitAppTys
   a_a6Xb[sk:1]
   Bool
   []
   Call stack:
       CallStack (from HasCallStack):
         prettyCurrentCallStack, called at
 compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
         callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
 ghc:Outputable
         pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type''
 \\

 I hope I found u a bug :)
 \\


 Have a nice day

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14371>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list