Skip to content

Hole-fit suggestions don't include implicit parameters

If I have this program:

{-# LANGUAGE ImplicitParams #-}

f :: (?x :: Int) => Int
f = _

GHC will produce these hole-fit suggestions:

$ ghc-9.2 Bug.hs
[1 of 1] Compiling Main             ( Bug.hs, Bug.o )

Bug.hs:4:5: error:
    • Found hole: _ :: Int
    • In an equation for ‘f’: f = _
    • Relevant bindings include f :: Int (bound at Bug.hs:4:1)
      Constraints include ?x::Int (from Bug.hs:3:1-23)
      Valid hole fits include
        f :: Int (bound at Bug.hs:4:1)
        maxBound :: forall a. Bounded a => a
          with maxBound @Int
          (imported from ‘Prelude’ at Bug.hs:1:1
           (and originally defined in ‘GHC.Enum’))
        minBound :: forall a. Bounded a => a
          with minBound @Int
          (imported from ‘Prelude’ at Bug.hs:1:1
           (and originally defined in ‘GHC.Enum’))
  |
4 | f = _
  |     ^

I would have expected ?x to appear in the Valid hole fits include section.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information