Skip to content

Qualified Holes

Let us consider the following example code:

import qualified Data.Map as M

main :: IO ()
main = print (M._ (\k v acc -> k + v + acc) 0 myMap)

myMap :: Map Int Int
myMap = ...

This errors with Not in scope: M._. It would cool if GHC instead treated M._ as a hole but only gave suggestions from the module Data.Map. So, in this case, it would suggest things like Data.Map.foldrWithKey and Data.Map.foldlWithKey.

Trac metadata
Trac field Value
Version 8.4.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information