Skip to content

Commit

Permalink
make hlistAt public
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-truffaut committed May 25, 2015
1 parent 4ac891d commit b8567a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions generic/src/main/scala/monocle/generic/HList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ object hlist extends HListInstances

trait HListInstances {

def hListAt[S <: HList, A](n : Nat)(implicit evAt: At.Aux[S, n.N, A],
evReplace: ReplaceAt.Aux[S, n.N, A, (A, S)]): Lens[S, A] =
Lens[S, A](_.at(n))(a => hlist => hlist.updatedAt(n, a))

def toHList[S, A <: HList](implicit gen: Generic.Aux[S, A]): Iso[S, A] =
Iso[S, A]{ s => gen.to(s)}{l => gen.from(l)}

Expand Down Expand Up @@ -64,8 +68,4 @@ trait HListInstances {
def sixth = hListAt(shapeless.nat._5)
}

private def hListAt[S <: HList, A](n : Nat)(implicit evAt: At.Aux[S, n.N, A],
evReplace: ReplaceAt.Aux[S, n.N, A, (A, S)]): Lens[S, A] =
Lens[S, A](_.at(n))(a => hlist => hlist.updatedAt(n, a) )

}

0 comments on commit b8567a6

Please sign in to comment.