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

Some form of über-import to access standard functions in single line #184

Open
benhutchison opened this issue Jul 6, 2016 · 3 comments

Comments

@benhutchison
Copy link

Some people (myself among them) prefer the simplicity of a blanket import to enable standard functionality, along the lines of import scalaz._; import Scalaz._.

As well as convenience and accessibility for newcomers ("just make it work"!), the other reason Ive come to appreciate them is I like to detect name clashes between libs I use early.

@fthomas
Copy link
Owner

fthomas commented Dec 28, 2016

I think it would make sense if the über-import would include everything in the refined package object, all predicates (that is boolean._ , char._, collection._, generic._, numeric._, and string._), auto._, types.all._, and api.Refined. This should include everything that is needed for "normal" usage of the library. Everything else is only needed if one wants to extend the library or define their own predicates.

@soronpo
Copy link

soronpo commented Dec 28, 2016

Maybe it can be divided into several über-imports, classified according to use.

  • Normal usage (import refined.normal) - What is stated above.
  • Advanced usage (import refined.advanced) - Normal + predicate extenders
  • Others... I don't know all the use cases, but I believe you can narrow them down.

@fthomas
Copy link
Owner

fthomas commented May 15, 2018

One step in this direction has been made in #433 which is now available in 0.9.0. So to import all predicates we can now import eu.timepit.refined.predicates.all._.

To import all of the standard functionality of the library we are now down to five imports:

import eu.timepit.refined._
import eu.timepit.refined.api.Refined
import eu.timepit.refined.auto._
import eu.timepit.refined.predicates.all._
import eu.timepit.refined.types.all._

My long-term goal is to shrink that further to maybe two or three imports.

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

3 participants