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

♻️ Consider re-organising things. #3

Closed
hayleigh-dot-dev opened this issue Jul 16, 2023 · 0 comments
Closed

♻️ Consider re-organising things. #3

hayleigh-dot-dev opened this issue Jul 16, 2023 · 0 comments

Comments

@hayleigh-dot-dev
Copy link
Member

The way the code is organised at the moment, it becomes impossible to use some modules alongside the same-named ones in the stdlib without some aliasing. It seems quite reasonable to want to import both gleam/int and gleam_community/maths/int and having to alias one is quite clunky.

I'd much prefer to see things organised by domain/use than type, for example a gleam_community/maths/trigonometry module: trigonometry.asin feels a lot more appropriate to me than float.asin.

For functions that are defined both ints and floats, like sign I'd rather see those functions live in the same place with some established naming convention like int_sign and float_sign, or sign and signf, or whatever...

For the list_ modules consider whether the API can be simplified by simply asking consumers to provide implementations of some behaviour, instead of int_list.maximum([...]) and float_list.maximum([...]) this could be unified maths.maximum and the user can provide int.compare, float.compare, or float.loosely_compare as they see fit.


I'd consider the requirement to alias imports to use the package a significant blocker for an otherwise very useful package, but I'm not familiar enough with the domain to provide specific suggestions for re-organising things. Hopefully this is enough to point you in the right direction ❤️

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

2 participants