Created
December 25, 2015 01:26
-
-
Save joshcough/6e737f44f38ab93255bd 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
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