Scalaz library import technique

Do any of you know why the examples from Scalaz always use this import technique:

import scalaz._ import Scalaz._ 

but not:

 import scalaz.Scalaz._ 

? I am trying to understand what arguments are for preference.

Thanks!

+7
source share
2 answers

I believe because import scalaz._; import Scalaz._ import scalaz._; import Scalaz._ imports all elements from the scalaz package and from the scalaz.Scalaz object.

If you just import import scalaz.Scalaz._ , you only import elements from the scalaz.Scalaz object.

+10
source

import scalaz._ imports all classes [type] from the main package.

import Scalaz._ imports implicits that make all of these classes useful. How to convert from standard collections to MA and get an optional shell, etc.

That way you can use one without the other.

I believe this is a conscious design decision that allows us to withstand any implicit problems such as this one .

+3
source

All Articles