@@ -114,15 +114,9 @@ instance {-# OVERLAPPABLE #-}
114114 , MonadState tag s m
115115 ) => MonadState tag s (t m)
116116 where
117−
118117 get = Lift.lift (get @tag)
119− {-# INLINE get #-}
120−
121118 put = Lift.lift . put @tag
122− {-# INLINE put #-}
123−
124119 state = Lift.lift . state @tag
125− {-# INLINE state #-}
126120
127121instance {-# OVERLAPPABLE #-}
128122 ( Monad (trans m)
@@ -135,31 +129,26 @@ instance {-# OVERLAPPABLE #-}
135129 TaggedTrans effs trans m s ->
136130 TaggedTrans (eff ': effs) trans m s)
137131 (get @tag)
138− {-# INLINE get #-}
139132
140133 put =
141134 (coerce ::
142135 (s -> TaggedTrans effs trans m ()) ->
143136 (s -> TaggedTrans (eff ': effs) trans m ()))
144137 (put @tag)
145− {-# INLINE put #-}
146138
147139 state =
148140 (coerce :: forall a .
149141 ((s -> (a, s)) -> TaggedTrans effs trans m a) ->
150142 ((s -> (a, s)) -> TaggedTrans (eff ': effs) trans m a))
151143 (state @tag)
152− {-# INLINE state #-}
153144
154145-- | Modifies the state inside a state monad.
155146modify :: forall tag s m . MonadState tag s m => (s -> s) -> m ()
156147modify f = state @tag (\s -> ((), f s))
157−{-# INLINABLE modify #-}
158148
159149-- | Gets specific component of the state, using a projection function supplied.
160150gets :: forall tag s m a . MonadState tag s m => (s -> a) -> m a
161151gets f = fmap f (get @tag)
162−{-# INLINABLE gets #-}
163152
164153-- | Encode type-level information for 'StateT'.
165154data STATE
@@ -170,11 +159,9 @@ type instance HandleConstraint STATE s trans m =
170159
171160instance Handle STATE s (T.Strict.StateT s) where
172161 handling r = r
173− {-# INLINE handling #-}
174162
175163instance Handle STATE s (T.Lazy.StateT s) where
176164 handling r = r
177− {-# INLINE handling #-}
178165
179166instance
180167 ( Handle STATE s trans
@@ -185,18 +172,15 @@ instance
185172 get =
186173 handling @STATE @s @trans @m $
187174 coerce (T.get @s @(trans m))
188− {-# INLINE get #-}
189175
190176 put =
191177 handling @STATE @s @trans @m $
192178 coerce (T.put @s @(trans m))
193− {-# INLINE put #-}
194179
195180 state =
196181 handling @STATE @s @trans @m $
197182 coerce (T.state @s @(trans m) @a) ::
198183 forall eff a . (s -> (a, s)) -> TaggedTrans eff trans m a
199− {-# INLINE state #-}
200184
201185instance
202186 ( HasLens tag payload s
@@ -211,7 +195,6 @@ instance
211195 trans m a ->
212196 TaggedTrans eff trans m a)
213197 (T.gets (view (lensOf @tag @payload @s)))
214− {-# INLINE get #-}
215198
216199 put s =
217200 handling @STATE @payload @trans @m $
@@ -219,7 +202,6 @@ instance
219202 trans m a ->
220203 TaggedTrans eff trans m a)
221204 (T.modify (over (lensOf @tag @payload @s) (const s)))
222− {-# INLINE put #-}
223205
224206 state f =
225207 handling @STATE @payload @trans @m $
@@ -227,7 +209,6 @@ instance
227209 trans m a ->
228210 TaggedTrans eff trans m a)
229211 (T.state (lensOf @tag @payload @s f))
230− {-# INLINE state #-}
231212
232213-- | The parametrizable state monad.
233214--
@@ -246,43 +227,36 @@ type StateT tag s = TaggedTrans (TAGGED STATE tag) (T.Strict.StateT s)
246227-- | Constructor for computations in the state monad transformer.
247228stateT :: forall tag s m a . (s -> m (a, s)) -> StateT tag s m a
248229stateT = coerce (T.Strict.StateT @s @m @a)
249−{-# INLINE stateT #-}
250230
251231-- | Runs a 'StateT' with the given initial state
252232-- and returns both the final value and the final state.
253233runStateT :: forall tag s m a . StateT tag s m a -> s -> m (a, s)
254234runStateT = coerce (T.Strict.runStateT @s @m @a)
255−{-# INLINE runStateT #-}
256235
257236-- | Runs a 'StateT' with the given initial state
258237-- and returns the final value, discarding the final state.
259238evalStateT :: forall tag s m a . Monad m => StateT tag s m a -> s -> m a
260239evalStateT = coerce (T.Strict.evalStateT @m @s @a)
261−{-# INLINE evalStateT #-}
262240
263241-- | Runs a 'StateT' with the given initial state
264242-- and returns the final state, discarding the final value.
265243execStateT :: forall tag s m a . Monad m => StateT tag s m a -> s -> m s
266244execStateT = coerce (T.Strict.execStateT @m @s @a)
267−{-# INLINE execStateT #-}
268245
269246-- | Runs a 'State' with the given initial state
270247-- and returns both the final value and the final state.
271248runState :: forall tag s a . State tag s a -> s -> (a, s)
272249runState = coerce (T.Strict.runState @s @a)
273−{-# INLINE runState #-}
274250
275251-- | Runs a 'State' with the given initial state
276252-- and returns the final value, discarding the final state.
277253evalState :: forall tag s a . State tag s a -> s -> a
278254evalState = coerce (T.Strict.evalState @s @a)
279−{-# INLINE evalState #-}
280255
281256-- | Runs a 'State' with the given initial state
282257-- and returns the final state, discarding the final value.
283258execState :: forall tag s a . State tag s a -> s -> s
284259execState = coerce (T.Strict.execState @s @a)
285−{-# INLINE execState #-}
286260
287261-- | The parametrizable state monad.
288262--
@@ -301,43 +275,36 @@ type LazyStateT tag s = TaggedTrans (TAGGED STATE tag) (T.Lazy.StateT s)
301275-- | Constructor for computations in the state monad transformer.
302276lazyStateT :: forall tag s m a . (s -> m (a, s)) -> LazyStateT tag s m a
303277lazyStateT = coerce (T.Lazy.StateT @s @m @a)
304−{-# INLINE lazyStateT #-}
305278
306279-- | Runs a 'StateT' with the given initial state
307280-- and returns both the final value and the final state.
308281runLazyStateT :: forall tag s m a . LazyStateT tag s m a -> s -> m (a, s)
309282runLazyStateT = coerce (T.Lazy.runStateT @s @m @a)
310−{-# INLINE runLazyStateT #-}
311283
312284-- | Runs a 'StateT' with the given initial state
313285-- and returns the final value, discarding the final state.
314286evalLazyStateT :: forall tag s m a . Monad m => LazyStateT tag s m a -> s -> m a
315287evalLazyStateT = coerce (T.Lazy.evalStateT @m @s @a)
316−{-# INLINE evalLazyStateT #-}
317288
318289-- | Runs a 'StateT' with the given initial state
319290-- and returns the final state, discarding the final value.
320291execLazyStateT :: forall tag s m a . Monad m => LazyStateT tag s m a -> s -> m s
321292execLazyStateT = coerce (T.Lazy.execStateT @m @s @a)
322−{-# INLINE execLazyStateT #-}
323293
324294-- | Runs a 'State' with the given initial state
325295-- and returns both the final value and the final state.
326296runLazyState :: forall tag s a . LazyState tag s a -> s -> (a, s)
327297runLazyState = coerce (T.Lazy.runState @s @a)
328−{-# INLINE runLazyState #-}
329298
330299-- | Runs a 'State' with the given initial state
331300-- and returns the final value, discarding the final state.
332301evalLazyState :: forall tag s a . LazyState tag s a -> s -> a
333302evalLazyState = coerce (T.Lazy.evalState @s @a)
334−{-# INLINE evalLazyState #-}
335303
336304-- | Runs a 'State' with the given initial state
337305-- and returns the final state, discarding the final value.
338306execLazyState :: forall tag s a . LazyState tag s a -> s -> s
339307execLazyState = coerce (T.Lazy.execState @s @a)
340−{-# INLINE execLazyState #-}
341308
342309type family STATES (ts :: HList xs) :: [Type] where
343310 STATES 'HNil = '[]
@@ -349,97 +316,76 @@ type States s = StatesT s Identity
349316
350317runStatesT :: forall p m a . StatesT p m a -> p -> m (a, p)
351318runStatesT = coerce (T.Strict.runStateT @p @m @a)
352−{-# INLINE runStatesT #-}
353319
354320runStates :: forall p a . States p a -> p -> (a, p)
355321runStates = coerce (T.Strict.runState @p @a)
356−{-# INLINE runStates #-}
357322
358323type StateT' s = StateT s s
359324
360325stateT' :: (s -> m (a, s)) -> StateT' s m a
361326stateT' = stateT
362−{-# INLINE stateT' #-}
363327
364328runStateT' :: StateT' s m a -> s -> m (a, s)
365329runStateT' = runStateT
366−{-# INLINE runStateT' #-}
367330
368331runState' :: State' s a -> s -> (a, s)
369332runState' = runState
370−{-# INLINE runState' #-}
371333
372334evalStateT' :: Monad m => StateT' s m a -> s -> m a
373335evalStateT' = evalStateT
374−{-# INLINE evalStateT' #-}
375336
376337type State' s = State s s
377338
378339evalState' :: State' s a -> s -> a
379340evalState' = evalState
380−{-# INLINE evalState' #-}
381341
382342execStateT' :: Monad m => StateT' s m a -> s -> m s
383343execStateT' = execStateT
384−{-# INLINE execStateT' #-}
385344
386345execState' :: State' s a -> s -> s
387346execState' = execState
388−{-# INLINE execState' #-}
389347
390348type LazyStateT' s = LazyStateT s s
391349
392350lazyStateT' :: (s -> m (a, s)) -> LazyStateT' s m a
393351lazyStateT' = lazyStateT
394−{-# INLINE lazyStateT' #-}
395352
396353runLazyStateT' :: LazyStateT' s m a -> s -> m (a, s)
397354runLazyStateT' = runLazyStateT
398−{-# INLINE runLazyStateT' #-}
399355
400356runLazyState' :: LazyState' s a -> s -> (a, s)
401357runLazyState' = runLazyState
402−{-# INLINE runLazyState' #-}
403358
404359evalLazyStateT' :: Monad m => LazyStateT' s m a -> s -> m a
405360evalLazyStateT' = evalLazyStateT
406−{-# INLINE evalLazyStateT' #-}
407361
408362type LazyState' s = LazyState s s
409363
410364evalLazyState' :: LazyState' s a -> s -> a
411365evalLazyState' = evalLazyState
412−{-# INLINE evalLazyState' #-}
413366
414367execLazyStateT' :: Monad m => LazyStateT' s m a -> s -> m s
415368execLazyStateT' = execLazyStateT
416−{-# INLINE execLazyStateT' #-}
417369
418370execLazyState' :: LazyState' s a -> s -> s
419371execLazyState' = execLazyState
420−{-# INLINE execLazyState' #-}
421372
422373type MonadState' s = MonadState s s
423374
424375get' :: forall s m . MonadState' s m => m s
425376get' = get @s
426−{-# INLINE get' #-}
427377
428378gets' :: forall s m a . MonadState' s m => (s -> a) -> m a
429379gets' = gets @s
430−{-# INLINE gets' #-}
431380
432381put' :: forall s m . MonadState' s m => s -> m ()
433382put' = put @s
434−{-# INLINE put' #-}
435383
436384state' :: forall s m a . MonadState' s m => (s -> (a, s)) -> m a
437385state' = state @s
438−{-# INLINE state' #-}
439386
440387modify' :: forall s m . MonadState' s m => (s -> s) -> m ()
441388modify' = modify @s
442−{-# INLINE modify' #-}
443389
444390-- | Encode type-level information for 'zoom'.
445391data ZOOM t z
@@ -453,7 +399,6 @@ zoom
453399 -> (forall z . Reifies z (ReifiedLens' sOuter sInner) => ZoomT tag z m a)
454400 -> m a
455401zoom l m = reify (Lens l) (\(_ :: Proxy z) -> coerce (m @z))
456−{-# INLINE zoom #-}
457402
458403instance
459404 ( MonadState tag sOuter m
@@ -468,4 +413,3 @@ instance
468413 (state @tag . l)
469414 where
470415 Lens l = reflect (Proxy :: Proxy z)
471− {-# INLINE state #-}