<div dir="ltr">Hi,<div>I use the State monad in a lot of places, but when I use it with the lens library, I find myself writing code like:</div><div><br></div><div>myFunc :: StateT MyState ([ResultType])</div><div>myFunc = do</div><div>   st <- get</div><div>   case st ^. some_property of</div><div>      True -> do</div><div>            my_value .= "Hello"</div><div>      True -> do</div><div>            my_value .= "Goodbye"</div><div></div><div>         </div><div>I want to do something based on a 'state-variable', but I have to write 'get' -- is there a pattern that allows me to avoid the intermediate 'st' variable? </div><div>I want to write something like:</div><div><div><br></div><div>myFunc = do</div><div>   case (get ^. some_property) of</div><div>      True -> do</div><div>            my_value .= "Hello"</div><div>      True -> do</div><div>            my_value .= "Goodbye"</div><div></div><div></div></div><div><br></div><div>but that won't compile.</div><div><br></div><div>Best wishes,</div><div><br></div><div>Mike</div><div><br></div><div><br></div><div><br></div></div>