What is the idiomatic way of using lenses to check if a stateful map has a key? Here is my current attempt:
module Foo where
import Control.Lens
import Data.Map
import Control.Monad.State
import Data.Maybe (isJust)
check :: Int -> StateT (Map Int Int) IO ()
check k = do
present <- use $ at k.to isJust
unless present $ lift $ putStrLn "Not present!"
This works, but the to isJust part feels a bit clunky...