Skip to content

Bad origin in error message: mkExport

The following program, found during investigation of #23426 (closed), gives a bad error message in master:

module M where

class C a where
    f :: a -> a

indent :: C a => a -> a
indent n = doText n
    where
      doText x = const (f x) doTail
      doTail _ = const n doText
$ ./stage1/bin/ghc M
[1 of 1] Compiling M                ( M.hs, M.o )

M.hs:9:7: error: [GHC-39999]
    • Could not deduce ‘C a0’
        << This should not appear in error messages. If you see this
        in an error message, please report a bug mentioning ‘mkExport’ at
        https://gitlab.haskell.org/ghc/ghc/wikis/report-a-bug >>
      from the context: C a
        bound by the type signature for:
                   indent :: forall a. C a => a -> a
        at M.hs:6:1-23
      The type variable ‘a0’ is ambiguous
    • In an equation for ‘indent’:
          indent n
            = doText n
            where
                doText x = const (f x) doTail
                doTail _ = const n doText
  |
9 |       doText x = const (f x) doTail
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information