Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

map _1 _2 #311

Closed
kazu-yamamoto opened this issue Aug 12, 2014 · 6 comments
Closed

map _1 _2 #311

kazu-yamamoto opened this issue Aug 12, 2014 · 6 comments

Comments

@kazu-yamamoto
Copy link
Collaborator

@serras You said "Added a new refinement command which rewrites a hole or undefined via an expression, including any new holes that may be needed. For example, if a hole _ is rewriten by map, the hole will change into map _1 _2" in #296.

I don't understand this. Please give me a more concrete example?

@serras
Copy link
Contributor

serras commented Aug 12, 2014

Let's say you have the following code in the file:

filterNothing :: [Maybe a] -> [a]
filterNothing xs = _body

Now, you put the cursor over _body and start the refining command. It asks you for an expression to refine. Say you say, filter, for example. Since filter has type (a -> Bool) -> [a] -> [a], it needs two more parameters for you to get a [a], thus the code changes to:

filterNothing xs = filter _body_1 _body_2

Note that if you instead had written the code as

filterNothing = _body

(without any argument), it notices that you only need one parameter and would change the body to filter _body_1.

@kazu-yamamoto
Copy link
Collaborator Author

Ah, we need to type C-cC-f, right?

@serras
Copy link
Contributor

serras commented Aug 12, 2014

Yep.

@serras
Copy link
Contributor

serras commented Aug 12, 2014

As mentioned in #308, I think that refine should stay in its own key binding C-c C-f instead of being merged with M-t.

@kazu-yamamoto
Copy link
Collaborator Author

I think it is reasonable because refine requires user input while M-t does not. :-)

@kazu-yamamoto
Copy link
Collaborator Author

Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants