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

Please, add to/fromList conversion tests #26

Open
Anton-Latukha opened this issue Nov 22, 2021 · 0 comments
Open

Please, add to/fromList conversion tests #26

Anton-Latukha opened this issue Nov 22, 2021 · 0 comments

Comments

@Anton-Latukha
Copy link
Contributor

Anton-Latukha commented Nov 22, 2021

During DList use I had a difficulty to reason about:

https://github.com/haskell/haskell-language-server/blob/2e61b7c0ba64cded22cf0fb80b089eaf328528e6/ghcide/src/Development/IDE/Core/Compile.hs#L475-L483

Because DList docs state:

fromList: ... This function is implemented with ++. Repeated uses of fromList are just as inefficient as repeated uses of ++.

So, are those 5 parallel fromLists there to do mconcat gain anything, or they are added complexity. & it is having the simple statement that DList.fromList is implemented in terms of ++. But what ++ traverses there & how many times chunks are traversed are still radically different from "just being ++" - in that source pattern conversion into DList I believe allows to save on retraverse, which ++ would do there.

As the most frequent way to construct datatypes is fromList.

And the OverloadedLists is here, together with the standardized IsList interface which it operates on.

And in the preparation for the https://github.com/fumieval/Haskell-breaking-changes#upcoming-monomorphise-datalist arrival.

It would be useful to get the tables of to/fromList conversion to see the weights of transforming the data types in the most default way.

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