fthomas / refined

Refinement types for Scala
MIT License
1.7k stars 154 forks source link

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

Open benhutchison opened 8 years ago

benhutchison commented 8 years ago

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 commented 7 years ago

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 commented 7 years ago

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

fthomas commented 6 years ago

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.