mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
🔥 TransC.
This commit is contained in:
parent
6fe74f012a
commit
157d931ad8
@ -11,7 +11,6 @@ module Control.Effect.Readline
|
||||
, ReadlineC (..)
|
||||
, runReadline
|
||||
, runReadlineWithHistory
|
||||
, TransC (..)
|
||||
, ControlIOC (..)
|
||||
, runControlIO
|
||||
) where
|
||||
@ -21,7 +20,6 @@ import Prelude hiding (print)
|
||||
import Control.Effect.Carrier
|
||||
import Control.Effect.Lift
|
||||
import Control.Effect.Reader
|
||||
import Control.Monad
|
||||
import Control.Monad.IO.Class
|
||||
import Control.Monad.Trans.Class
|
||||
import Data.Int
|
||||
@ -89,13 +87,6 @@ runReadlineWithHistory block = do
|
||||
|
||||
runReadline prefs settings block
|
||||
|
||||
-- | Promote a monad transformer into an effect.
|
||||
newtype TransC t (m :: * -> *) a = TransC { runTransC :: t m a }
|
||||
deriving newtype (Applicative, Functor, Monad, MonadIO, MonadTrans)
|
||||
|
||||
instance (Carrier sig m, Effect sig, Monad (t m), MonadTrans t) => Carrier sig (TransC t m) where
|
||||
eff = TransC . join . lift . eff . handle (pure ()) (pure . (runTransC =<<))
|
||||
|
||||
runControlIO :: (forall x . m x -> IO x) -> ControlIOC m a -> m a
|
||||
runControlIO handler = runReader (Handler handler) . runControlIOC
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user