valid substitutions for holes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

valid substitutions for holes

Richard Eisenberg-4
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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

RE: valid substitutions for holes

GHC - devs mailing list
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.

Simon

| -----Original Message-----
| From: ghc-devs [mailto:[hidden email]] On Behalf Of Richard
| Eisenberg
| Sent: 27 October 2017 02:43
| To: ghc-devs <[hidden email]>
| 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
| [hidden email]
| https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask
| ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
| devs&data=02%7C01%7Csimonpj%40microsoft.com%7Cabcb64569709446adb0808d51d5
| 53ba6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636447174270553152&sda
| ta=bGgYpNvuhR7rWnubjsYG5FKfza5gmbP0PPu6bNcJBUs%3D&reserved=0
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs