Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -21,7 +22,6 @@ libraryDependencies ++= Seq(
"org.specs2" %% "specs2" % "1.13" % "test"
)



addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.5.2")


2 changes: 1 addition & 1 deletion src/main/scala/eg/FreeMonad.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/eg/ST.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/eg/StateT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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)
Expand Down