{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Control.Effect.State.Labelled
(
State
, get
, gets
, put
, modify
, modifyLazy
, state
, Algebra
, Has
, HasLabelled
, run
) where
import Control.Effect.Labelled
import qualified Control.Effect.State as S
import Control.Effect.State.Internal
get :: forall label s m sig . HasLabelled label (State s) sig m => m s
get = runUnderLabel @label S.get
{-# INLINEABLE get #-}
gets :: forall label s m a sig . HasLabelled label (State s) sig m => (s -> a) -> m a
gets f = runUnderLabel @label (S.gets f)
{-# INLINEABLE gets #-}
put :: forall label s m sig . HasLabelled label (State s) sig m => s -> m ()
put s = runUnderLabel @label (S.put s)
{-# INLINEABLE put #-}
modify :: forall label s m sig . HasLabelled label (State s) sig m => (s -> s) -> m ()
modify f = runUnderLabel @label (S.modify f)
{-# INLINEABLE modify #-}
modifyLazy :: forall label s m sig . HasLabelled label (State s) sig m => (s -> s) -> m ()
modifyLazy f = runUnderLabel @label (S.modifyLazy f)
{-# INLINEABLE modifyLazy #-}
state :: forall label s m a sig . HasLabelled label (State s) sig m => (s -> (s, a)) -> m a
state f = runUnderLabel @label (S.state f)
{-# INLINEABLE state #-}