Skip to content

"unresolved constraints" when import and main missing

I gut a weird error because I forgot an import and the main method. (the commented lines in the code below)

GHCi told me to post a bug about this, so... :-)

Steps to reproduce:

> ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Prelude> :l bug.hs
[1 of 1] Compiling Main             ( bug.hs, interpreted )
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 8.0.2 for x86_64-unknown-mingw32):
        initTc: unsolved constraints
  WC {wc_insol = [W] printf_a2MG :: t_a2MF[tau:1] (CHoleCan: printf)}

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

File bug.hs:

module Main where

import Test.Hspec
import Test.QuickCheck

-- import Text.Printf

testMovie :: Int -> Int -> Double -> Int -> Spec
testMovie card ticket perc s = 
    it (printf "should return Movie for card: %d, ticket: %d perc %s " card ticket (show perc)) $
        movie card ticket perc `shouldBe` s

movie :: Int -> Int -> Double -> Int
movie card ticket perc = 4

-- main :: IO ()
-- main = undefined

Expected behavior: Useful error message.

Actual behavior: "panic" error message.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
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