From 64d495b4cfbbeb3fcc72b5b8771874793d8fc6a3 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 7 Mar 2024 07:25:08 +0100 Subject: chore: drop unused type class magic --- src/Process/Shell.hs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Process/Shell.hs b/src/Process/Shell.hs index 4b26512..06c9dbe 100644 --- a/src/Process/Shell.hs +++ b/src/Process/Shell.hs @@ -32,26 +32,23 @@ import Text.Megaparsec import Text.Megaparsec.Char import Prelude hiding (exp) -class Processable a r where - sh_ :: a -> r +class Processable r where + sh_ :: String -> r -instance (Processable a r) => Processable (String -> a) (String -> r) where - sh_ f x = sh_ (f x) - -instance (MonadIO m) => Processable String (m ()) where +instance (MonadIO m) => Processable (m ()) where sh_ s = do liftIO (runProcess_ (fromString s)) -instance (MonadIO m, Outputable a) => Processable String (m a) where +instance (MonadIO m, Outputable a) => Processable (m a) where sh_ s = do fromLBS <$> liftIO (readProcessInterleaved_ (fromString s)) -instance (MonadIO m, Outputable stdout, Outputable stderr) => Processable String (m (stdout, stderr)) where +instance (MonadIO m, Outputable stdout, Outputable stderr) => Processable (m (stdout, stderr)) where sh_ s = do (\(out, err) -> (fromLBS out, fromLBS err)) <$> liftIO (readProcess_ (fromString s)) -instance (MonadIO m, Outputable stdout, Outputable stderr) => Processable String (m (ExitCode, stdout, stderr)) where +instance (MonadIO m, Outputable stdout, Outputable stderr) => Processable (m (ExitCode, stdout, stderr)) where sh_ s = do (\(exitCode, out, err) -> (exitCode, fromLBS out, fromLBS err)) <$> liftIO (readProcess (fromString s)) -- cgit v1.2.3