akisaarinen/rillit

nodynamic blowing up at repl and even slaying compiler

aryairani opened this issue · 2 comments

I guess I'm not using it right, but:

$ sbt
> set scalaVersion := "2.10.2"
> set resolvers += "rillit-repository" at "http://akisaarinen.github.com/rillit/maven"
> set libraryDependencies += "fi.akisaarinen" %% "rillit-nodynamic" % "0.2.0"
> console-quick
[info] Starting scala interpreter...

scala> case class Email(user: String, domain: String)
defined class Email

scala> case class Contact(email: Email, web: String)
defined class Contact

scala> case class Person(name: String, contact: Contact)
defined class Person

scala> 

scala> val person = Person(
     |   name = "Aki Saarinen",
     |   contact = Contact(
     |     email = Email("aki", "akisaarinen.fi"),
     |     web   = "http://akisaarinen.fi"
     |   )
     | )
person: Person = Person(Aki Saarinen,Contact(Email(aki,akisaarinen.fi),http://akisaarinen.fi))

scala> import rillit._
import rillit._

scala> Lenser[Person].contact.email.user.set(person)("john")
res1: Person = Person(Aki Saarinen,Contact(Email(john,akisaarinen.fi),http://akisaarinen.fi))
// Great!

scala> Lenser[Person].contact.email.user
<console>:5: error: type mismatch;
 found   : $8$(in lazy value $result) where type $8$(in lazy value $result) <: rillit.Lenser.StackedLens[Person,Email,String]{val parent: $22$}
 required: (some other)$8$(in lazy value $result) forSome { type $22$ <: rillit.Lenser.StackedLens[Person,Contact,Email]{val parent: $36$; def user: (some other)$8$(in lazy value $result); def domain: $15$}; type $36$ <: rillit.Lenser.TopLens[Person,Contact]{def email: $22$; def web: $29$}; type (some other)$8$(in lazy value $result) <: rillit.Lenser.StackedLens[Person,Email,String]{val parent: $22$}; type $15$ <: rillit.Lenser.StackedLens[Person,Email,String]{val parent: $22$}; type $29$ <: rillit.Lenser.StackedLens[Person,Contact,String]{val parent: $36$} }
  lazy val $result = `res2`

scala> Lenser[Person].contact _
ReplGlobal.abort: no-symbol does not have an owner
error: no-symbol does not have an owner
ReplGlobal.abort: no-symbol does not have an owner
error: no-symbol does not have an owner
ReplGlobal.abort: no-symbol does not have an owner
error: no-symbol does not have an owner
ReplGlobal.abort: no-symbol does not have an owner
error: no-symbol does not have an owner
ReplGlobal.abort: no-symbol does not have an owner
error: no-symbol does not have an owner
ReplGlobal.abort: no-symbol does not have an owner
error: no-symbol does not have an owner
unhandled exception while transforming <console>
error: uncaught exception during compilation: scala.reflect.internal.FatalError

fwiw, it works if you ascribe an expected type:

scala> Lenser[Person].contact.email.user: shapeless.Lens[Person, String]
res1: shapeless.Lens[Person,String] = $8$$1@134a1cc6

Interesting, thanks for the tip!

On Oct 4, 2013, at 9:58 AM, Seth Tisue notifications@github.com wrote:

fwiw, it works if you ascribe an expected type:

scala> Lenser[Person].contact.email.user: shapeless.Lens[Person, String]
res1: shapeless.Lens[Person,String] = $8$$1@134a1cc6

Reply to this email directly or view it on GitHub.