Hi,

I have the following code that builds successfully with "stack build" under GHC 8.10.7 but fails to build under GHC 9.0.1:

https://github.com/jchia/ip-bug

The compiler is switched by commenting/uncommenting the compiler line in stack.yaml.

GHC 9.0.1 gives me the error I paste at the end. Is this expected (maybe as part of "simplified subsumtion" in https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0#compiler-changes)? If so, how can the code be fixed? If not, is it a compiler bug?

(This problem came up while using gi-gtk-3.0.38, where implicit params are used a lot).

Josh

/home/jchia/gh/ip-bug/src/Lib.hs:10:28: error:
    • Couldn't match type ‘(?self::Int) => Char’ with ‘Char’
      Expected: Int -> Char -> Char
        Actual: Int -> ((?self::Int) => Char) -> Char
    • In the expression: foo
      In the expression: (let ?self = x in foo) :: Int -> Char -> Char
      In the expression:
        ((let ?self = x in foo) :: Int -> Char -> Char) x
   |
10 | bar x = ((let ?self = x in foo) :: Int -> Char -> Char) x
   |                            ^^^

/home/jchia/gh/ip-bug/src/Lib.hs:13:26: error:
    • Couldn't match type ‘(?self::Int) => Char’ with ‘Char’
      Expected: Char -> Char
        Actual: ((?self::Int) => Char) -> Char
    • In the expression: foo x
      In the expression: let ?self = x in foo x
      In an equation for ‘baz’: baz x = let ?self = x in foo x
   |
13 | baz x = let ?self = x in foo x
   |                          ^^^^^