문제

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