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

split the streamly package into multiple packages #533

Closed
harendra-kumar opened this issue May 15, 2020 · 15 comments
Closed

split the streamly package into multiple packages #533

harendra-kumar opened this issue May 15, 2020 · 15 comments
Assignees
Labels
type:maintenance Has impact on maintainability

Comments

@harendra-kumar
Copy link
Member

The streamly package is approaching 200 files and takes significant time to compile with more than 70 source modules, we may want to look at the possibility of splitting the package into smaller packages to make the ecosystem modular. Here is one approach:

  1. streamly: remains as it is, a batteries included master package, including everything
  2. streamly-core: Unfold/Stream/Pipe/Fold/Parser/Array/Time modules
  3. streamly-network: the networking stuff
  4. streamly-filesystem: the filesystem stuff
  5. streamly-unicode: the unicode text processing stuff
  6. streamly-json: the json parsing, serialization stuff
  7. ... many other streamly packages like streamly-zlib, streamly-statistics

Programmers can mix and match the packages they want to include. This can possibly reduce the amount of time take to build, though streamly-core would still remain quite heavy.

We can continue to have all the packages in the same mega repository.

@harendra-kumar harendra-kumar added the disposition:discussion Discuss, investigate or request feedback label May 15, 2020
@harendra-kumar harendra-kumar added this to the 0.8.0 milestone Jun 2, 2020
@harendra-kumar harendra-kumar modified the milestones: 0.8.0, 0.9.0 Aug 4, 2020
@Bodigrim
Copy link
Contributor

Bodigrim commented Apr 7, 2021

Would it be theoretically possible to have a hypothetical streamly-core depending on GHC boot libraries only? Or does it fundamentally entail something else?

@harendra-kumar
Copy link
Member Author

harendra-kumar commented Apr 7, 2021

If you look at the dependencies of streamly, other than boot libs this is what we have:

  • atomic-primops (for concurrent streams)
  • monad-control (for concurrent streams)
  • heaps (for concurrent streams)
  • lockfree-queue (for concurrent streams)
  • network

So if we just take out the concurrent streams and network stuff in separate packages, which is very much possible, then we will depend only on boot libraries.

@harendra-kumar
Copy link
Member Author

We can try a feasibility prototype after the 0.8.0 release in next few weeks.

@harendra-kumar harendra-kumar added type:maintenance Has impact on maintainability and removed disposition:discussion Discuss, investigate or request feedback labels Apr 27, 2021
@harendra-kumar harendra-kumar modified the milestones: 0.9.0, 0.8.1 Jul 22, 2021
@harendra-kumar harendra-kumar self-assigned this Jul 22, 2021
@harendra-kumar
Copy link
Member Author

I am working on separating a streamly-core package. There is a decision to be made about the safe resource management combinators bracket and finally. Those are important operations that would be useful in a core package. On the other hand they require a dependency on monad-control. Another class of operations that require a dependency on monad-control is time related combinators like takeInterval or intervalsOf. If we move these operations in another package then we could depend only on boot packages.

@Bodigrim do you have any suggestions or opinions on this?

@Bodigrim
Copy link
Contributor

Take my words with a grain of salt, because I am only a potential user and not well acquainted with the library, but I'd slightly prefer only boot libraries in dependencies of streamly-core. The reason is that monad-control entails several more transitive dependencies, which are all well-maintained, but nevertheless elongate the critical path.

@hasufell what do you think?

@harendra-kumar
Copy link
Member Author

Though I would like to avoid any additional deps, but we may have to do some balancing here.

monad-control only brings transformers-base and base-orphans additional. These are fairly small packages, the former is a single type class, and the latter is some instances.

@harendra-kumar
Copy link
Member Author

Since this might possibly break things we will do this in the upcoming major 0.9.0 release.

@adithyaov adithyaov modified the milestones: 0.9.0, 0.10.0 Oct 18, 2022
@adithyaov
Copy link
Member

streamly is currently split to streamly and streamly-core in 0.9.0.
We can target the rest to 0.10.0.

@georgefst
Copy link
Contributor

Is there any reason the decision wasn't taken to have streamly re-export everything in streamly-core, as e.g. optics does with optics-core? This would have made migration simpler. And more importantly, it would make it much easier to search for definitions on Hackage.

@harendra-kumar
Copy link
Member Author

We did re-export everything from streamly initially. I think the problem was that if we were to re-export than we had to re-export everything including all the internal modules, otherwise there was some issue. I do not remember the exact issue, need to find out what it was. Maybe because we have to depend on both streamly and streamly-core to use internal modules from streamly-core and that caused some ambiguity in importing modules.

@harendra-kumar
Copy link
Member Author

If it works we can think of doing it in 0.9.1 or would that cause more breakage?

@harendra-kumar
Copy link
Member Author

I think if we re-export then we cannot depend on both streamly, and streamly-core becuase GHC cannot distinguish if a module is re-exported, and would consider it as another module with the same name.

@harendra-kumar
Copy link
Member Author

harendra-kumar commented Mar 24, 2023

For the documentation issue we can present a unified documentation/search on the streamly website https://streamly.composewell.com/ and a hoogle search as well. But searching on hackage will still remain problematic.

@georgefst
Copy link
Contributor

georgefst commented Mar 27, 2023

I think if we re-export then we cannot depend on both streamly, and streamly-core becuase GHC cannot distinguish if a module is re-exported, and would consider it as another module with the same name.

Ah, it's annoying that that would be another breaking change for anyone who has already adapted their codebase to 0.9. I'd personally consider it worth it in 0.10, but others may disagree.

@harendra-kumar
Copy link
Member Author

Current division in streamly and streamly-core is good enough for now. Raised #2690 for the re-export issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:maintenance Has impact on maintainability
Projects
None yet
Development

No branches or pull requests

4 participants