Skip to content

Type checker rejects ambiguous top level declaration.

It doesn't seem like a serious problem, but I report it anyway.

With stack's project template, I just removed main and someFunc's type signature and changed someFunc's definition to return (). stack build worked well, but stack repl emitted this error message.

D:\ghc-corePrepPgm\app\Main.hs:6:1: warning: [-Wdeferred-type-errors]
    • Couldn't match type ‘ghc-prim-0.5.0.0:GHC.Prim.Any’ with ‘IO’
      Expected type: IO ()
        Actual type: ghc-prim-0.5.0.0:GHC.Prim.Any ()
    • In the expression: main
      When checking the type of the IO action ‘main’
ghc.EXE: panic! (the 'impossible' happened)
  (GHC version 8.0.2 for x86_64-unknown-mingw32):
        corePrepPgm
  [False] cobox_r1bo = typeError
                         @ 'VoidRep
                         @ (Any :: (* -> *)) ~# (IO :: (* -> *))
                         "D:\\ghc-corePrepPgm\\app\\Main.hs:6:1: error:\n\
                         \    \\226\\128\\162 Couldn't match type \\226\\128\\152ghc-prim-0.5.0.0:GHC.Prim.Any\\226\\128\\153 with \\226\\128\\152IO\\226\\128\\153\n\
                         \      Expected type: IO ()\n\
                         \        Actual type: ghc-prim-0.5.0.0:GHC.Prim.Any ()\n\
                         \    \\226\\128\\162 In the expression: main\n\
                         \      When checking the type of the IO action \\226\\128\\152main\\226\\128\\153\n\
                         \(deferred type error)"#

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
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 Windows
Architecture
Edited by Tamar Christina
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information