From e1a54a9a262c905fda319da743856f3b70d010c8 Mon Sep 17 00:00:00 2001 From: Stephen Judkins Date: Mon, 4 Aug 2014 10:33:04 -0700 Subject: [PATCH] Use kind-projector plugin --- build.sbt | 6 +++--- src/main/scala/eg/FreeMonad.scala | 2 +- src/main/scala/eg/ST.scala | 6 +++--- src/main/scala/eg/StateT.scala | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index e64030c..e235870 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,8 @@ scalaVersion := "2.10.4" resolvers ++= Seq( "snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", - "releases" at "http://oss.sonatype.org/content/repositories/releases" + "releases" at "http://oss.sonatype.org/content/repositories/releases", + "bintray/non" at "http://dl.bintray.com/non/maven" ) libraryDependencies ++= Seq( @@ -21,7 +22,6 @@ libraryDependencies ++= Seq( "org.specs2" %% "specs2" % "1.13" % "test" ) - - +addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.5.2") diff --git a/src/main/scala/eg/FreeMonad.scala b/src/main/scala/eg/FreeMonad.scala index d0307fc..d8d2cac 100644 --- a/src/main/scala/eg/FreeMonad.scala +++ b/src/main/scala/eg/FreeMonad.scala @@ -20,7 +20,7 @@ object FreeMonad extends App { // The instance is not inferrable implicit val monadTerminalIO: Monad[TerminalIO] = - Free.freeMonad[({type λ[α] = Coyoneda[TerminalOp, α]})#λ] + Free.freeMonad[Coyoneda[TerminalOp, ?]] // Smart constructors def readLine: TerminalIO[String] = Free.liftFC(ReadLine) diff --git a/src/main/scala/eg/ST.scala b/src/main/scala/eg/ST.scala index 772512b..a849a26 100644 --- a/src/main/scala/eg/ST.scala +++ b/src/main/scala/eg/ST.scala @@ -14,14 +14,14 @@ object ST extends App { // In order to run an action, you need to construct a Forall, which is awkward. // Note that it fixes the return type. - val forall = new Forall[({ type λ[σ] = ST[σ, Int] })#λ] { def apply[S] = a } + val forall = new Forall[ST[?, Int]] { def apply[S] = a } // We can abstract out the lambda type if we want to - type ForallST[A] = Forall[({ type λ[σ] = ST[σ, A] })#λ] + type ForallST[A] = Forall[ST[?, A]] val forall2 = new ForallST[Int] { def apply[S] = a } // They should be equivalent (N.B. might crash presentation compiler but does work) - implicitly[Forall[({ type λ[σ] = ST[σ, Int] })#λ] =:= ForallST[Int]] + implicitly[Forall[ST[?, Int]] =:= ForallST[Int]] // this is pure val x0 = runST(forall) diff --git a/src/main/scala/eg/StateT.scala b/src/main/scala/eg/StateT.scala index c5dd720..570d062 100644 --- a/src/main/scala/eg/StateT.scala +++ b/src/main/scala/eg/StateT.scala @@ -13,11 +13,11 @@ import scalaz.effect.MonadIO object StateTExample extends App { -// // To avoid the type lambda ({type λ[a] = StateT[IO,String,a]})#λ +// // To avoid the type lambda StateT[IO,String,?] // // in the call to liftIO below, we will just make an alias. // type StringIO[+A] = StateT[IO, String, A] // - // // The tricky part is the lifting. + // // The tricky part is the lifting. // val action: StringIO[Int] = // for { // s <- get[String].lift[IO] @@ -38,7 +38,7 @@ object StateTExample2 extends App { type M[A] = EitherT[IO, Error, A] - type Op[A] = StateT[({ type λ[+α] = EitherT[IO, Error, α] })#λ, Running, A] + type Op[A] = StateT[EitherT[IO, Error, +?], Running, A] implicit def liftio = new MonadIO[Op] { def point[A](a: => A): Op[A] = unit(a)