#14477 closed bug (duplicate)

the 'impossible' happened, initTc: unsolved constraints

Reported by: bmusin Owned by:
Priority: high Milestone:
Component: Compiler Version: 8.0.2
Keywords: Cc: mbulatka@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash or panic Test Case:
Blocked By: Blocking:
Related Tickets: #13106 Differential Rev(s):
Wiki Page:

Description (last modified by RyanGlScott)

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 

Change History (3)

comment:1 Changed 13 months ago by bmusin

Description: modified (diff)

Completed ticked description, initially submitted incomplete bug by mistake.

comment:2 Changed 13 months ago by bmusin

Type of failure: None/UnknownCompile-time crash or panic

Add type of failure

comment:3 Changed 13 months ago by RyanGlScott

Description: modified (diff)
Resolution: duplicate
Status: newclosed

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])
  |               ^^^^^^
Note: See TracTickets for help on using tickets.