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

Remove automatic application overloading #1

Open
mpickering opened this issue Aug 22, 2018 · 0 comments
Open

Remove automatic application overloading #1

mpickering opened this issue Aug 22, 2018 · 0 comments

Comments

@mpickering
Copy link
Owner

At the moment any application is desugared to the _ap combinator. This seems like a good idea
but in practice it doesn't work very well as you end up writing pure (+) n (pure 1).

The "obvious" solution which is very hairy is to also automatically lift variables by wrapping them with pure.
The results of this can be seen on the https://github.com/mpickering/lift-plugin/tree/wrap branch. The problem here is that when you observe a variable x, how do we decide whether we want to lift it or not? If x :: r a then it is already lifted but what about x :: IO a, is that lifted? The implementation got very out of hand anyway with a very ad-hoc type checker plugin.

So, the solution here is to overload neither ap or pure and use idiom brackets when we want to overload either. The idiom bracket overloading is provided by Oleg's plugin which we just run at the start.
This is the only way which we overload ap and pure now at the expense of a slightly more verbose program.

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

No branches or pull requests

1 participant