Skip to content

Instantly share code, notes, and snippets.

@julien-truffaut
Last active August 29, 2015 14:13
Show Gist options
  • Save julien-truffaut/af49791dc15ac3ec3e2e to your computer and use it in GitHub Desktop.
Save julien-truffaut/af49791dc15ac3ec3e2e to your computer and use it in GitHub Desktop.
GenPrism
sealed trait Foo
case class A(i: Int) extends Foo
case class B(x: Double, y: Double) extends Foo
case object C extends Foo
// 1st option:
GenPrism[Foo, A]: Prism[Foo, A]
GenPrism[Foo, B]: Prism[Foo, B]
GenPrism[Foo, C]: Prism[Foo, C]
// 2nd option:
GenPrism[Foo, A, Int]: Prism[Foo, Int]
GenPrism[Foo, B, (Double, Double)]: Prism[Foo, (Double, Double)]
GenPrism[Foo, C, Unit]: Prism[Foo, Unit]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment