From b709219b778eef1ee7d27bcca8760aefe0e17a55 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 10 Oct 2019 16:53:03 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20allow=20messages=20to=20be=20se?= =?UTF-8?q?nt=20to=20the=20InputT.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- semantic-core/src/Control/Carrier/Readline/Haskeline.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/semantic-core/src/Control/Carrier/Readline/Haskeline.hs b/semantic-core/src/Control/Carrier/Readline/Haskeline.hs index f1e952e71..3fee163e5 100644 --- a/semantic-core/src/Control/Carrier/Readline/Haskeline.hs +++ b/semantic-core/src/Control/Carrier/Readline/Haskeline.hs @@ -47,18 +47,17 @@ runReadlineWithHistory block = do newtype ReadlineC m a = ReadlineC { runReadlineC :: ReaderC Line (LiftC (InputT (UnliftIOToMonadException m))) a } deriving (Applicative, Functor, Monad, MonadFix, MonadIO) -instance MonadUnliftIO m => Carrier (Readline :+: Lift (InputT (UnliftIOToMonadException m))) (ReadlineC m) where - eff (L (Prompt prompt k)) = ReadlineC $ do +instance MonadUnliftIO m => Carrier Readline (ReadlineC m) where + eff (Prompt prompt k) = ReadlineC $ do str <- sendM (getInputLine @(UnliftIOToMonadException m) (cyan <> prompt <> plain)) Line line <- ask local increment (runReadlineC (k line str)) where cyan = "\ESC[1;36m\STX" plain = "\ESC[0m\STX" - eff (L (Print doc k)) = do + eff (Print doc k) = do s <- maybe 80 Size.width <$> liftIO size liftIO (renderIO stdout (layoutSmart defaultLayoutOptions { layoutPageWidth = AvailablePerLine s 0.8 } (doc <> line))) k - eff (R other) = ReadlineC (eff (R (handleCoercible other))) -- | This exists to work around the 'MonadException' constraint that haskeline entails.