You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
At the moment any application is desugared to the
_ap
combinator. This seems like a good ideabut 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? Ifx :: r a
then it is already lifted but what aboutx :: 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
orpure
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
andpure
now at the expense of a slightly more verbose program.The text was updated successfully, but these errors were encountered: