Scalaz Lens Composition

Viewed 1124

Really simple question here. After watching an excellent introduction to lenses:

http://www.youtube.com/watch?v=efv0SQNde5Q

I thought I might attempt one of the simple examples covered in the talk:

import scalaz.Lens._
fst.andThen(snd).set(((1,2),3),9)

this was followed by this error

error: type mismatch;
 found   : scalaz.Lens[(Nothing, Nothing),Nothing]
 required: scalaz.Lens[(Nothing, Nothing),C]
Note: Nothing <: C, but class Lens is invariant in type B.
You may wish to define B as +B instead. (SLS 4.5)
              fst.andThen(snd).set(((1,2),3))
                      ^

Any ideas as to how to make this work?

2 Answers
Related