Scalaz library import technique reasoning
문제
Do any of you know why examples from Scalaz always use this import technique:
import scalaz._
import Scalaz._
rather than:
import scalaz.Scalaz._
? I'm trying to understand what the reasoning behind the preference is.
Thanks!
해결책
I believe it's because import scalaz._; import Scalaz._
imports all members from the scalaz
package and from the scalaz.Scalaz
object.
If you will just import import scalaz.Scalaz._
, then you only import members from the scalaz.Scalaz
object.
다른 팁
import scalaz._ imports all [type]classes from the core package.
import Scalaz._ imports implicits which make all these classes useful. Like conversions from standard collections to MA and getting Option wrapper and so on.
So you can use one without another.
I believe this is a conscious design decision to allow us survive any kind of implicit-related issues, like this one.