Skip to content

Instantly share code, notes, and snippets.

@aereal
Last active January 4, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aereal/22a19a080ea18ea4fb24 to your computer and use it in GitHub Desktop.
Save aereal/22a19a080ea18ea4fb24 to your computer and use it in GitHub Desktop.
✘╹◡╹✘ < sbt run
[info] Set current project to scala-playground (in build file:/Users/aereal/devel/src/github.com/aereal/scala-playground/)
[info] Compiling 1 Scala source to /Users/aereal/devel/src/github.com/aereal/scala-playground/target/scala-2.11/classes...
[error] /Users/aereal/devel/src/github.com/aereal/scala-playground/App.scala:7: not found: type ?
[error] val v = Applicative[ValidationNel[String, ?]]
[error] ^
[error] /Users/aereal/devel/src/github.com/aereal/scala-playground/App.scala:7: scalaz.ValidationNel[String,<error>] takes no type parameters, expected: one
[error] val v = Applicative[ValidationNel[String, ?]]
[error] ^
[error] /Users/aereal/devel/src/github.com/aereal/scala-playground/App.scala:7: ambiguous implicit values:
[error] both value vectorInstance in trait VectorInstances of type => scalaz.Traverse[Vector] with scalaz.MonadPlus[Vector] with scalaz.BindRec[Vector] with scalaz.Zip[Vector] with scalaz.Unzip[Vector] with scalaz.IsEmpty[Vector] with scalaz.Align[Vector]
[error] and method eitherMonad in trait EitherInstances of type [L]=> scalaz.Traverse[[β]scala.util.Either[L,β]] with scalaz.MonadError[[β]scala.util.Either[L,β],L] with scalaz.BindRec[[β]scala.util.Either[L,β]] with scalaz.Cozip[[β]scala.util.Either[L,β]]
[error] match expected type scalaz.Applicative[<error>]
[error] val v = Applicative[ValidationNel[String, ?]]
[error] ^
[error] three errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 5 s, completed Jan 5, 2016 1:41:00 AM
import scalaz._, std.AllInstances._
object App {
def parseInt(s: String): Validation[String, Int] = try { Success(s.toInt) } catch { case ex: NumberFormatException => Failure(ex.getMessage) }
def main(args: Array[String]) = {
val v = Applicative[ValidationNel[String, ?]]
val x: ValidationNel[String, Int] =
v.apply2(parseInt("1.0").toValidationNel, parseInt("2.0").toValidationNel)(_ * _)
}
}
name := "scala-playground"
version := "1.0"
scalaVersion := "2.11.6"
lazy val root = (project in file("."))
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.2.0"
)
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment