mirror of
https://github.com/polysemy-research/polysemy.git
synced 2024-09-17 13:37:21 +03:00
Merge branch 'master' of github.com:isovector/polysemy
This commit is contained in:
commit
d759dd7be8
@ -9,11 +9,15 @@ module Polysemy
|
||||
, runM
|
||||
, runFinal
|
||||
|
||||
-- * Type synonyms for user convenience
|
||||
, InterpreterFor
|
||||
|
||||
-- * Interoperating With Other Monads
|
||||
-- ** Embed
|
||||
, Embed (..)
|
||||
, embed
|
||||
, embedToFinal
|
||||
|
||||
-- ** Final
|
||||
-- | For advanced uses of 'Final', including creating your own interpreters
|
||||
-- that make use of it, see "Polysemy.Final"
|
||||
@ -132,11 +136,11 @@ module Polysemy
|
||||
, Inspector (..)
|
||||
) where
|
||||
|
||||
import Polysemy.Final
|
||||
import Polysemy.Internal
|
||||
import Polysemy.Internal.Combinators
|
||||
import Polysemy.Internal.Forklift
|
||||
import Polysemy.Internal.Kind
|
||||
import Polysemy.Internal.TH.Effect
|
||||
import Polysemy.Internal.Tactics
|
||||
import Polysemy.Final
|
||||
import Polysemy.Internal.TH.Effect
|
||||
|
||||
|
@ -23,6 +23,7 @@ module Polysemy.Internal
|
||||
, usingSem
|
||||
, liftSem
|
||||
, hoistSem
|
||||
, InterpreterFor
|
||||
, (.@)
|
||||
, (.@@)
|
||||
) where
|
||||
@ -434,6 +435,17 @@ runM (Sem m) = m $ \z ->
|
||||
pure $ f $ a <$ s
|
||||
{-# INLINE runM #-}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- | Type synonym for interpreters that consume an effect without changing the
|
||||
-- return value. Offered for user convenience.
|
||||
--
|
||||
-- @r@ Is kept polymorphic so it's possible to place constraints upon it:
|
||||
--
|
||||
-- @
|
||||
-- teletypeToIO :: 'Member' (Embed IO) r
|
||||
-- => 'InterpreterFor' Teletype r
|
||||
-- @
|
||||
type InterpreterFor e r = forall a. Sem (e ': r) a -> Sem r a
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- | Some interpreters need to be able to lower down to the base monad (often
|
||||
|
Loading…
Reference in New Issue
Block a user