Skip to content

Instantly share code, notes, and snippets.

@mathhun
Last active July 28, 2016 02:17
Show Gist options
  • Save mathhun/78e465b674c87c63a7de511a8e934998 to your computer and use it in GitHub Desktop.
Save mathhun/78e465b674c87c63a7de511a8e934998 to your computer and use it in GitHub Desktop.
@ import scalaz.Reader, scalaz.syntax.applicative._
import scalaz.Reader, scalaz.syntax.applicative._
@ type ReaderInt[A] = Reader[Int, A]
defined type ReaderInt
@ desugar { "foo".point[ReaderInt] }
res31: Desugared = scalaz.syntax.`package`.applicative.ApplicativeIdV[String]("foo").point[$sess.cmd30.ReaderInt](scalaz.Kleisli.kleisliIdMonadReader[Int])
% ./amm
Loading...
Welcome to the Ammonite Repl COMMIT-3a5b96d
(Scala 2.11.8 Java 1.8.0_60)
@ load.ivy("org.scalaz" %% "scalaz-core" % "7.2.4")
@ import scalaz.Reader, scalaz.syntax.applicative._
import scalaz.Reader, scalaz.syntax.applicative._
@ import scala.reflect.runtime.universe.{showCode, reify}
import scala.reflect.runtime.universe.{showCode, reify}
@ type ReaderInt[A] = Reader[Int, A]
defined type ReaderInt
@ showCode(reify("hello".point[ReaderInt]))
cmd4.sc:1: type mismatch;
found : reflect.runtime.universe.Expr[$sess.cmd3.ReaderInt[String]]
(which expands to) reflect.runtime.universe.Expr[scalaz.Kleisli[scalaz.Id.Id,Int,String]]
required: reflect.runtime.universe.Tree
val res4 = showCode(reify("hello".point[ReaderInt]))
^
Compilation Failed
@ showCode(reify("hello".point[ReaderInt]).tree)
res4: String = """
`package`.applicative.ApplicativeIdV("hello").point[cmd3.ReaderInt](Kleisli.kleisliIdMonadReader)
"""
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment