1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

🔥 TransC.

This commit is contained in:
Rob Rix 2019-07-15 16:20:27 -04:00
parent 6fe74f012a
commit 157d931ad8
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -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