Loading...

BASE Meetup 19 Nov 2012: "Lenses: Fields as Values" by Seth Tisue (Northwestern University)

937 views

Loading...

Loading...

Transcript

The interactive transcript could not be loaded.

Loading...

Loading...

Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Published on Nov 27, 2012

Lenses aren't in the Scala standard library, but two libraries provide them: Scalaz and Miles Sabin's Shapeless. Seth will show how you to use the Shapeless version, and we'll look at how it's implemented.

A lens represents a readable and "settable" location in a possibly nested immutable object. ("Settable" is in quotes because we make a new object rather than mutating the old one.)

This may interest you if:

...you use immutable objects

...you use nested immutable objects

...you want to abstract over different fields in your immutable objects

...you're interested in functional programming

This will overlap a lot with Ed Kmett's 2011 talk on the same subject. If you saw and completely grasped Ed's talk, you might not learn much from this one. Compared to Ed's, Seth's take will be more elementary and less formal. (And I'll be covering only lenses themselves, not bringing in the state monad too.)

Slides for the talk are available here:

https://docs.google.com/presentation/...

Sample code is here:

https://github.com/SethTisue/lens-exa...

The Meetup page for this talk is here:

http://www.meetup.com/boston-scala/ev...

Loading...

When autoplay is enabled, a suggested video will automatically play next.

Up next


to add this to Watch Later

Add to

Loading playlists...