mirror of
https://github.com/sayo-hs/heftia.git
synced 2024-11-27 07:37:56 +03:00
[add] an elaborator for the Provider effect.
This commit is contained in:
parent
70d1a54830
commit
4abedf3e97
@ -39,6 +39,7 @@ library
|
||||
Control.Effect.Handler.Heftia.Writer
|
||||
Control.Effect.Handler.Heftia.State
|
||||
Control.Effect.Handler.Heftia.Except
|
||||
Control.Effect.Handler.Heftia.Provider
|
||||
|
||||
-- Modules included in this executable, other than Main.
|
||||
-- other-modules:
|
||||
|
18
heftia-effects/src/Control/Effect/Handler/Heftia/Provider.hs
Normal file
18
heftia-effects/src/Control/Effect/Handler/Heftia/Provider.hs
Normal file
@ -0,0 +1,18 @@
|
||||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
module Control.Effect.Handler.Heftia.Provider where
|
||||
|
||||
import Control.Effect.Class (type (~>))
|
||||
import Control.Effect.Class.Provider (ProviderS (Provide))
|
||||
import Control.Effect.Freer (Fre)
|
||||
import Control.Monad.Trans (MonadTrans, lift)
|
||||
|
||||
-- | Elaborate the 'Provider' effect using the given interpreter for some monad transformer.
|
||||
elaborateProviderT ::
|
||||
(Monad m, MonadTrans t, c (t (Fre es m))) =>
|
||||
(forall x. i -> t (Fre es m) x -> Fre es m (g x)) ->
|
||||
ProviderS c i g (Fre es m) ~> Fre es m
|
||||
elaborateProviderT run (Provide i m) = run i $ m lift
|
||||
{-# INLINE elaborateProviderT #-}
|
Loading…
Reference in New Issue
Block a user