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 Read and Show derivation for Route _ optional #1773

Open
parsonsmatt opened this issue Jul 7, 2022 · 4 comments
Open

Make Read and Show derivation for Route _ optional #1773

parsonsmatt opened this issue Jul 7, 2022 · 4 comments

Comments

@parsonsmatt
Copy link
Contributor

We've identified that Read is particularly slow to derive - twice as slow as Eq or Show. A 1000 constructor sum type with a single Int parameter in each constructor takes about 2.5s on my laptop to compile, while Eq is a mere 0.8s and no derivation is 0.2s (for reference).

If I remove the Read derivation in the mkYesod functions, all tests in yesod-core pass fine, and all tests pass in the work repository with this change too.

#1203 is related - by dropping the Read derivation, we no longer need Read in elements in the path pieces.

@snoyberg
Copy link
Member

No objection from me, seems like a reasonable change. How were you thinking of indicating this? The route syntax may be a good place

@parsonsmatt
Copy link
Contributor Author

I was probably going to port the code from persistent that allows you to specify deriving stuff by default for keys and models, which would introduce new named functions mkYesod{,Dispatch,etc}With that accept that record as an argument

@snoyberg
Copy link
Member

Cool, sounds like a good plan.

@dten
Copy link
Contributor

dten commented Sep 12, 2023

@parsonsmatt did you give this a try? We would also like to not require Read

parsonsmatt pushed a commit that referenced this issue Oct 23, 2023
…tances are generated for a route (#1819)

* remove read from the list of derived instances, partially closing #1773, #1203

* bump version

* adjusting a version bound because the next version breaks compilation

* make a RouteOpts type that allows for finer control over what instances are derived for a Route

* some lintings

* adjust versioning and changelog

* actually a more major version bump

* verified that export list is complete

* add @ since
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