質問

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.

役に立ちましたか?

解決

Try use

use :: MonadState s m => Getting a s a -> m a
use = gets . view
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top