diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Process/Shell.hs | 15 |
1 files changed, 6 insertions, 9 deletions
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)) |