[GHC] #14639: "unresolved constraints" when import and main missing

GHC ghc-devs at haskell.org
Fri Jan 5 18:05:17 UTC 2018


#14639: "unresolved constraints" when import and main missing
-------------------------------------+-------------------------------------
           Reporter:  bainewedlock   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  8.0.2
           Keywords:                 |  Operating System:  Windows
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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:
 {{{#!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.

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


More information about the ghc-tickets mailing list