-
-
Save xuwei-k/b0542b48ef2823b5790a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✘╹◡╹✘ < 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)(_ * _) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "scala-playground" | |
version := "1.0" | |
scalaVersion := "2.11.6" | |
lazy val root = (project in file(".")) | |
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.7.1") | |
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