-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Create lenses for HList and use Generic (shapeless) to define Iso between case classes and HList #15
Comments
Any one knows how can I get an implicit of Generic.Aux[S, L] when S is a case class and L and HList? @milessabin If you have a min, your help will be great :) |
@julien-truffaut I think it's something like this: def toHList[A <: Product](a: A)(implicit g: Generic[A]): g.Repr = g.to(a)
def fromHList[A <: Product, H <: HList](a: H)(implicit g: Generic.Aux[A, H]): A = g.from(a) |
@puffnfresh Thanks, I managed to create a method that generates a lens toward any element of a case class (mainly taken from shapeless lens) but I still need to use Generic.product on the case class to generate an implicit https://github.com/julien-truffaut/Monocle/blob/hlist-lens/examples/src/main/scala/monocle/HListExample.scala#L26 I also found another problem, overloading compose seems to cause an issue with complex lenses (see line 34). |
#15 Add HList and Generic lenses
Added lenses for HList and for any class that have an HList representation. |
No description provided.
The text was updated successfully, but these errors were encountered: