- Dependencies are more compartmentalized
"org.scalaz" %% "scalaz-core" % scalazVersion
"org.scalaz" %% "scalaz-concurrent" % scalazVersion
"org.scalaz" %% "scalaz-iteratee" % scalazVersion
"org.scalaz" %% "scalaz-effect" % scalazVersion
"org.scalaz" %% "scalaz-iterv" % scalazVersion
"org.scalaz" %% "scalaz-typelevel" % scalazVersion
"org.scalaz" %% "scalaz-xml" % scalazVersion
- Generic (note: valid but it's better to restrict imports to prevent conflicts with other libraries)
import scalaz._
import Scalaz._
-
Syntax imports provide implicits to work with type classes and functions
-
Syntax imports (note: there is also
scalaz.syntax.all._
)
import scalaz.syntax.xyz._ // e.g. import scalaz.syntax.applicative._
- Standard library syntax imports (note: there is also
scalaz.syntax.std.all._
)
import scalaz.syntax.std.xyz._ // e.g. import scalaz.syntax.std.list._
- Is not a monad (see the Scalaz thread here)
- Use
EitherT
rather thanValidationT
\/
is Scalaz eitherValidation.disjunction
converts a validation to a Scalaz eitherValidation.either
=>Validation.toEither
for Scala either.left
and.right
similar to.success
and.fail
\/.fromTryCatch
andValidation.fromTryCatch
- Validation
|||
=>valueOr
(|||
still exists but the meaning is different) ValidationNEL
=>ValidationNel
- No longer exists
- Use
Monoid
// Example from Newman
type RawBody = Array[Byte]
implicit val RawBodyMonoid: Monoid[RawBody] = Monoid.instance(_ ++ _, Array[Byte]())
- No "default"
Monoid[Boolean]
- There is
Monoid[Boolean @@ Disjunction]
andMonoid[Boolean @@ Conjunction]
- Easier to use
Option(xyz) | false
rather than~Option(xyz)
for simple cases
- No longer exists
<|*|>
=>tuple
in ApplySyntax
scalaz.effects
=>scalaz.effect
- Included in the effect dependency
"org.scalaz" %% "scalaz-effect" % scalazVersion
- unsafePerformIO =>
unsafePerformIO()
- Use lift-json-scalaz7
- Lift version 2.5-RC4+
"net.liftweb" %% "lift-json-scalaz7" % liftVersion