valid substitutions for holes

Simon Peyton Jones simonpj at
Tue Nov 7 23:00:10 UTC 2017

I'm not sure why pure and return are reported now when they weren't before.  Characterising that would be helpful.

But yes, it's an experimental feature, so I don't think you should hold up the train for it.  You should talk to the author.


| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at] On Behalf Of Richard
| Eisenberg
| Sent: 27 October 2017 02:43
| To: ghc-devs <ghc-devs at>
| Subject: valid substitutions for holes
| Hi all,
| GHC HEAD currently suggests valid in-scope single-identifier
| substitutions for typed holes (underscores in terms). Some unrelated work
| somehow changed the output, and I'm wondering if this is a change for the
| better or for the worse.
| The test case is this:
| > f :: Int -> Int -> Int
| > f x y = _ x y
| With my patch, GHC now suggests `pure` and `return` as replacements for _
| (along with the other top contenders of (-), asTypeOf, and const). (You
| can also increase the number of suggestions, which will then include (+)
| and (*) among others.) It's true that `pure` and `return` fit the bill,
| noting that ((->) Int) is an Applicative. But I doubt these suggestions
| will help the user.
| I'm not keen to make fixing this "valid suggestions" feature (which I do
| really like) a dependency of finishing my patch, but I also don't want
| the change to output to go unnoticed. So, I'm asking: when I merge my
| patch, should I post a bug asking for perhaps a priority ordering of
| suggestions?
| Thanks,
| Richard
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at
| devs&
| 53ba6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636447174270553152&sda
| ta=bGgYpNvuhR7rWnubjsYG5FKfza5gmbP0PPu6bNcJBUs%3D&reserved=0

More information about the ghc-devs mailing list