Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a shortcut for this in Lens?

Is there a shortcut for this in the lens library?

\x -> liftM (^. x) get

Maybe it's a silly question, but it feels like a basic enough construction that there should be a shortcut for it.

like image 634
Emil Avatar asked Mar 23 '14 19:03

Emil


1 Answers

Try use

use :: MonadState s m => Getting a s a -> m a
use = gets . view
like image 153
J. Abrahamson Avatar answered Oct 04 '22 20:10

J. Abrahamson