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

Organize for minimal imports. #5

Open
sellout opened this issue Feb 21, 2016 · 1 comment
Open

Organize for minimal imports. #5

sellout opened this issue Feb 21, 2016 · 1 comment

Comments

@sellout
Copy link
Contributor

sellout commented Feb 21, 2016

To make it simple for clients to use the library (and to try to encourage a particular usage pattern), we should organize it so a user almost always needs only a single import per file. Here are the three use cases I see for different parts of a program:

when defining algebras

  • algebra types
  • Recursive/Corecursive/FunctorT/TraverseT types
  • project/embed/map/traverse

when using algebras

  • AlgebraOps
  • folds/unfolds/refolds
  • Possibly rec/Corecursive/etc instances
  • Distributive laws

when creating recursive data

  • fixpoint types & their rec/Corecursive/... Instances

For each of these cases, there should be two imports – one that provides everything via “ops” and one that provides package methods.

@sellout
Copy link
Contributor Author

sellout commented Dec 9, 2016

There is a fourth category – when defining pattern functors. This sometimes overlaps with the first category (you define algebras in the same file you define your pattern functors), but often doesn’t. I don’t think there’s much in it, but at least Delay, so instances for Delay[Equal, F], etc. can be defined in the functor’s companion object.

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