layered-state 1.1.3 → 1.1.4
raw patch · 2 files changed
+11/−4 lines, 2 files
Files
layered-state.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: f475bf6f0f3aa7d1f1fc658299308f47b436a4a2c625395df55e3020b62749d4+-- hash: 6d9849488a3adcdb071ffdef552d45edb9a10bd43897343fc23fe94467160753 name: layered-state-version: 1.1.3+version: 1.1.4 synopsis: Control structure similar to Control.Monad.State, allowing multiple nested states, distinguishable by provided phantom types. category: Data stability: experimental
src/Control/Monad/State/Layered.hs view
@@ -114,10 +114,17 @@ -- === Accessing === -- -gets :: ∀ l m s a. (Getter l m, s ~ InferStateData l m)+use :: ∀ l m s a. (Getter l m, s ~ InferStateData l m) => Lens' s a -> m a-gets l = view l <$> get @l ; {-# INLINE gets #-}+use l = view l <$> get @l ; {-# INLINE use #-} +uses :: ∀ l m s r a. (Getter l m, s ~ InferStateData l m)+ => Lens' s a -> (a -> r) -> m r+uses l f = f . view l <$> get @l ; {-# INLINE uses #-}++gets :: ∀ l m s a. (Getter l m, s ~ InferStateData l m)+ => (s -> a) -> m a+gets f = f <$> get @l ; {-# INLINE gets #-} -- === Top state accessing === --