Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toOptional not working with a nested case class #50

Closed
pinguinson opened this issue Mar 19, 2019 · 3 comments
Closed

toOptional not working with a nested case class #50

pinguinson opened this issue Mar 19, 2019 · 3 comments
Assignees

Comments

@pinguinson
Copy link

pinguinson commented Mar 19, 2019

Seems to be related related to #43
Tested with version 0.6.2
This snippet:

import henkan.optional.all._

object HenkanTest extends App {

  case class Foo(value: String)
  case class Domain(foo: Foo)
  case class Message(foo: Option[Foo])

  val dom = Domain(Foo("123"))
  val msg = Message(Some(Foo("123")))
  validate(msg).to[Domain] // works
  from(dom).toOptional[Message] // fails to compile

}

Results in the following error messages:

Error:(14, 23) Cannot build toOptional conversion from HenkanTest.Domain to HenkanTest.Message, possibly due to missing cats instances (`Functor` instances are needed to convert fields in containers)
  from(dom).toOptional[Message] // fails to compile
Error:(14, 23) not enough arguments for method toOptional: (implicit t: henkan.optional.ToOptional[HenkanTest.Domain,HenkanTest.Message])HenkanTest.Message.
Unspecified value parameter t.
  from(dom).toOptional[Message] // fails to compile
@pinguinson
Copy link
Author

Would gladly look into the issue myself, but my understanding of shapeless leaves a lot to be desired.

P.S. We're using henkan in production, your library is an absolute lifesaver!

@kailuowang kailuowang self-assigned this Mar 21, 2019
kailuowang added a commit that referenced this issue Mar 22, 2019
kailuowang added a commit that referenced this issue Mar 22, 2019
kailuowang added a commit that referenced this issue Mar 22, 2019
@kailuowang
Copy link
Owner

fixed with release 0.6.3. please verify and feel free to close this one.

@pinguinson
Copy link
Author

Works like a charm, thanks! Closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants