Skip to content

Instantly share code, notes, and snippets.

@gseitz
Created July 15, 2011 21:49
Show Gist options
  • Save gseitz/1085610 to your computer and use it in GitHub Desktop.
Save gseitz/1085610 to your computer and use it in GitHub Desktop.
InYourCase: autogenerated scalaz.Lens'es for case classes
case class Foo(bar: Int)
scala> import test.Foo
import test.Foo
scala> val foo = Foo(17)
foo: test.Foo = Foo(17)
scala> :type Foo.bar
scalaz.Lens[test.Foo,Int]
scala> Foo.bar.get(foo)
res0: Int = 17
scala> Foo.bar.set(foo, 42)
res1: test.Foo = Foo(42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment