Skip to content

Instantly share code, notes, and snippets.

@joshcough
Created December 25, 2015 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcough/6e737f44f38ab93255bd to your computer and use it in GitHub Desktop.
Save joshcough/6e737f44f38ab93255bd to your computer and use it in GitHub Desktop.
type R[A] = Reader[Env, A]
type Z[F[_], A] = WriterT[F, Output, A]
type W[A] = Z[R, A]
def evalLocal(x: String, i: Int, exp: Exp): W[Int] = {
WriterT[R,Output,Int](
Reader[Env, (Output, Int)] { (env: Env) =>
eval(exp).run.run(env + (x -> i))
}
)
}
def mySet(i: Int): WriterT[R, Output, Int] = {
WriterT[R,Output,Int](
Reader[Env, (Output, Int)] { (env: Env) =>
(List(i.toString), i)
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment