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

Replace Proxy with TypeApplications #1273

Open
poscat0x04 opened this issue Feb 15, 2020 · 5 comments
Open

Replace Proxy with TypeApplications #1273

poscat0x04 opened this issue Feb 15, 2020 · 5 comments

Comments

@poscat0x04
Copy link

poscat0x04 commented Feb 15, 2020

#390 there was a proposal 4 years ago on removing Proxy but was rejected . I think the extension TypeApplications is stable enough now so can we reconsider the proposal?

@poscat0x04 poscat0x04 changed the title Replace Proxy with TypeApplication Replace Proxy with TypeApplications Apr 9, 2020
@dmjio
Copy link
Member

dmjio commented Jun 6, 2020

@poscat0x04, I'm not completely convinced the gains provided are worth the implementation effort, breakage / loss of backwards compatibility, adoption hindrance, ease-of type inference. The tangible gains are essentially the removal of a few characters of boilerplate. It's also possible to use TypeApplications with Proxy in the current implementation to save a few characters. Besides aesthetics, what gains does this really provide that doesn't come at the aforementioned costs? The gains must offset all the aforementioned costs in my opinion, otherwise we risk some form of regression.

api1 = serve (Proxy :: Proxy API) handlers -- old
api2 = serve (Proxy @ API) handlers        -- current
api3 = serve @API handlers                 -- proposed

@poscat0x04
Copy link
Author

Well I don't think backward compatibility is much of a issue since

  1. we already have a package versioning policy that prevents breaking packages with backward incompatible changes
  2. it is possible to have a smooth transition, ie. we could first provide serve' that uses TypeApplications and deprecate serve and eventually replace serve with serve'

@dmjio
Copy link
Member

dmjio commented Jun 7, 2020

@poscat0x04 what tangible benefits does this provide besides boilerplate reduction of a few characters? This change requires modifying every instance of every interpretation for every package. Also, symbolVal and natVal still use Proxy.

@codygman
Copy link

codygman commented Jul 19, 2021

I feel like the answer is no, but I'll ask anyway:

Do TypeApplications have any advantage in compiled time resource usage over Proxy? My uneducated guess is no because TypeApplications might be implemented by desugaring to Proxy.

For contact, I came here after my work code base encountered issues with this compile performance issue: #986

@codygman
Copy link

I feel like the answer is no, but I'll ask anyway:

Do TypeApplications have any advantage in compiled time resource usage over Proxy? My uneducated guess is no because TypeApplications might be implemented by desugaring to Proxy.

For contact, I came here after my work code base encountered issues with this compile performance issue: #986

It looks like the answer is actually yes... though I'd want to test to be totally sure.

https://gitlab.haskell.org/ghc/ghc/-/issues/18902#note_324353

I found out type applications are basically implemented in core and were exposed upward, so this isn't so shocking with that information.

It seems possible this could help servant compile times.

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

3 participants