[GHC] #14477: the 'impossible' happened, initTc: unsolved constraints

GHC ghc-devs at haskell.org
Thu Nov 16 21:15:31 UTC 2017


#14477: the 'impossible' happened, initTc: unsolved constraints
-------------------------------------+-------------------------------------
        Reporter:  bmusin            |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:  duplicate         |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13106            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * status:  new => closed
 * resolution:   => duplicate
 * related:   => #13106


Old description:

> Compile simple program using stack: stack ghc Main.hs
>
> code:
> import Control.Monad.Writer.Strict
>
> logNumber :: Int -> Writer [String] Int
> logNumber x = Writer (x, ["Got number: " ++ show x])
>
> multWithLog :: Writer [String] Int
> multWithLog = do
>   a <- logNumber 3
>   b <- logNumber 5
>   tell ["Gonnay multiply these two"]
>   return (a*b)
>
> [1 of 1] Compiling Main             ( Main.hs, Main.o )
> ghc: panic! (the 'impossible' happened)
>   (GHC version 8.0.2 for x86_64-unknown-linux):
>         initTc: unsolved constraints
>   WC {wc_insol = [W] Writer_a19y :: t_a19x[tau:1] (CHoleCan: Writer)}
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

New description:

 Compile simple program using stack: stack ghc Main.hs

 code:
 {{{#!hs
 import Control.Monad.Writer.Strict

 logNumber :: Int -> Writer [String] Int
 logNumber x = Writer (x, ["Got number: " ++ show x])

 multWithLog :: Writer [String] Int
 multWithLog = do
   a <- logNumber 3
   b <- logNumber 5
   tell ["Gonnay multiply these two"]
   return (a*b)
 }}}
 {{{
 [1 of 1] Compiling Main             ( Main.hs, Main.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.2 for x86_64-unknown-linux):
         initTc: unsolved constraints
   WC {wc_insol = [W] Writer_a19y :: t_a19x[tau:1] (CHoleCan: Writer)}

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

--

Comment:

 Thanks for the bug report. This is a duplicate of #13106, and has been
 fixed in GHC 8.2:

 {{{
 $ /opt/ghc/8.2.1/bin/ghci Bug.hs
 GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:4:15: error:
     • Data constructor not in scope:
         Writer :: (Int, [[Char]]) -> Writer [String] Int
     • Perhaps you meant one of these:
         ‘WriterT’ (imported from Control.Monad.Writer.Strict),
         variable ‘writer’ (imported from Control.Monad.Writer.Strict)
   |
 4 | logNumber x = Writer (x, ["Got number: " ++ show x])
   |               ^^^^^^
 }}}

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


More information about the ghc-tickets mailing list