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

Simpler module structure #256

Closed
6 tasks
chshersh opened this issue May 6, 2020 · 1 comment · Fixed by #267
Closed
6 tasks

Simpler module structure #256

chshersh opened this issue May 6, 2020 · 1 comment · Fixed by #267
Assignees
Labels
question Further information is requested refactoring

Comments

@chshersh
Copy link
Contributor

chshersh commented May 6, 2020

After working with the tomland code for a while, it was discovered that its codebase is not optimal, and sometimes confusing to navigate. Its is a proposal to change the existing module structure. This is a breaking change, but since we recommend to import the top-level module qualified, almost all users of tomland shouldn't even notice the change.

My current proposal is the following:

  • Rename: Toml.Bi.Combinators to Toml.Codec
    • This module contains all codecs , so it name could help find them
  • Rename: Toml.Bi.Monad to Toml.Monad
  • Rename: Toml.Bi.Map to Toml.BiMap
  • Rename: Toml.Bi.Code to Toml.Decoding
    • It has both functions encode and decode, so Decoding is not precise enough... Maybe we should have two modules: Toml.Encode and Toml.Decode? Or maybe we can even combine Encode with Toml.Printer?
  • Delete: Toml.Bi
    • Module structure is becoming flatter
  • New: Toml.Key
    • This data is inside the Toml.PrefixTree module, and keep forgetting about that. Probably we can move it out to help navigation

Open questions:

  1. The core polymorphic monad is called Codec. Wouldn't it be confusing to have Toml.Monad have the Codec type and the Toml.Codec module to contain all combinators? Maybe names should be Toml.Codec and Toml.Combinators instead?
  2. Maybe we can even remove the Toml.Type prefix and remove the .Type part from all Toml.Type.* modules?
  3. What to do with Toml.Bi.Code? 🙂

Any ideas of other improvements are appreciated 🙂

@chshersh chshersh added question Further information is requested refactoring labels May 6, 2020
@chshersh chshersh self-assigned this May 6, 2020
@chshersh
Copy link
Contributor Author

chshersh commented May 6, 2020

New structure after discussion with @vrom911:

  • Have 3 top-level namespaces: Toml.Codec, Toml.Parser and Toml.Type
  • Everything else will go in those namespaces

@chshersh chshersh added this to the v1.3.0.0: Big update milestone May 6, 2020
@chshersh chshersh changed the title [RFC] Simpler module structure Simpler module structure May 7, 2020
chshersh added a commit that referenced this issue May 8, 2020
chshersh added a commit that referenced this issue May 8, 2020
vrom911 pushed a commit that referenced this issue May 8, 2020
* [#256] Simpler module structure

Resolves #256

* Improve docs after review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested refactoring
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant