Hello Cafe,

I'm trying to wrap my head around 'lens' library. My current exercise is to modify something using Lens in monad. Say,

("Hello", "World") & _1 `myOp` (\a -> putStrLn a >> return a)

in IO, where myOp would be of type:

myOp :: Monad m => Lens s t a b -> (a -> m b) -> s -> m t

Of course I can write it myself, using combination of "view" and "set":

myOp lens f v = f (view lens v) >>= flip (set lens) v

(have not checked this, but something like that should do), but is there a more elegant way?

Nikolay.