Skip to content

panic! initTc: unsolved constraints

New haskeller here, I was doing an exercise at http://exercism.io/exercises/haskell/rotational-cipher/readme and got the following error message from the compiler.

Compiling Main             ( RotationalCipher.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/build/Main.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.2 for x86_64-unknown-linux):
	initTc: unsolved constraints
  WC {wc_insol =
        [W] find_a7hU :: t_a7hT[tau:1] (CHoleCan: find)
        [W] find_a7iF :: t_a7iE[tau:1] (CHoleCan: find)}

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Progress: 16/17
--  While building custom Setup.hs for package rotational-cipher-1.1.0.1 using:
      /home/websterw/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0 build lib:rotational-cipher test:test --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

I was using the normal project setup that exercism uses for this problem, with my code residing a file called RotationalCipher.hs. The contents of this file are as follows.

rotate :: Int -> String -> String
rotate n = map (rot n) 

rot :: Int -> Char -> Char
rot i c 
  | c `elem` ['a'..'z'] = let translate = zip (lowershift n) ['a'..'z'] in
      fst (find (\x -> snd x == c) translate)
  | c `elem` ['A'..'Z'] = let translate = zip (uppershift n) ['A'..'Z'] in
      fst (find (\x -> snd x == c) translate)
  | otherwise = c
  where lowershift n = take 26 $ drop n $ cycle ['a'..'z']
        uppershift n = take 26 $ drop n $ cycle ['A'..'Z']

The error occured when I ran stack test

I am using fedora linux as my operating system on x86_64

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information