Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the simplifier do let specialisation #35

Open
ollef opened this issue Oct 19, 2017 · 1 comment
Open

Make the simplifier do let specialisation #35

ollef opened this issue Oct 19, 2017 · 1 comment

Comments

@ollef
Copy link
Owner

ollef commented Oct 19, 2017

If a function let binding is always called with the same argument, specialise it to that.

@ollef
Copy link
Owner Author

ollef commented Dec 6, 2017

To expand on this, the idea is that if we have

let f = \x y z. foo x y z in bar (f a 1 b) (f c 1 d)

then we can specialise fs y parameter and get:

let f = \x z. foo x 1 z in bar (f a b) (f c d)

This can help e.g. if a let binding has its type generalised and is then used repeatedly with the same typeclass dictionary.

Some care has to be taken with termination, to not turn a lambda into something that is potentially non-terminating.

This might be a good issue to look at for someone who wants to dive into the compiler internals, since the scope of it is limited.

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

No branches or pull requests

1 participant