{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Control.Effect.Reader.Labelled
(
Reader
, ask
, asks
, local
, Algebra
, Has
, HasLabelled
, run
) where
import Control.Effect.Labelled
import qualified Control.Effect.Reader as R
import Control.Effect.Reader.Internal
ask :: forall label r m sig . HasLabelled label (Reader r) sig m => m r
ask = runUnderLabel @label R.ask
{-# INLINE ask #-}
asks :: forall label r m a sig . HasLabelled label (Reader r) sig m => (r -> a) -> m a
asks f = runUnderLabel @label (R.asks f)
{-# INLINE asks #-}
local :: forall label r m a sig . HasLabelled label (Reader r) sig m => (r -> r) -> m a -> m a
local f m = runUnderLabel @label (R.local f (UnderLabel m))
{-# INLINE local #-}