diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+Darcs 2.16.2, 19 August 2020
+
+  * Fix build problem when using 'cabal install' from inside the sdist.
+
+    This fails because in this case cabal will try to 'cabal sdist' the
+    bundled shelly dependency, and we do not (nor want to) list all shelly
+    files in our own cabal file. To avoid problems like this, we no longer
+    use the bundled shelly as a dependency, but rather as part of our
+    sources for the test suite.
+
 Darcs 2.16.1, 14 August 2020
 
   * Building:
diff --git a/darcs.cabal b/darcs.cabal
--- a/darcs.cabal
+++ b/darcs.cabal
@@ -1,6 +1,6 @@
 Cabal-Version:  2.2
 Name:           darcs
-version:        2.16.1
+version:        2.16.2
 License:        GPL-2.0-or-later
 License-file:   COPYING
 Author:         David Roundy <droundy@darcs.net>, <darcs-devel@darcs.net>
@@ -64,9 +64,6 @@
 
   -- bundled shelly (the bare minimum required)
   shelly/LICENSE
-  shelly/shelly.cabal
-  shelly/src/Shelly/*.hs
-  shelly/src/Shelly.hs
 
   -- testsuite
   tests/data/*.tgz
@@ -561,7 +558,7 @@
   type:             exitcode-stdio-1.0
   default-language: Haskell2010
   main-is:          test.hs
-  hs-source-dirs:   harness
+  hs-source-dirs:   harness, shelly/src
 
   if os(windows)
     cpp-options:    -DWIN32
@@ -577,7 +574,6 @@
                     filepath,
                     mtl,
                     transformers,
-                    shelly       >= 1.6.8 && < 1.10,
                     split        >= 0.2.2 && < 0.3,
                     text,
                     directory,
@@ -590,7 +586,18 @@
                     test-framework-quickcheck2 >= 0.3.0.3 && < 0.4,
                     test-framework-leancheck   >= 0.0.1 && < 0.1,
                     vector,
-                    zip-archive
+                    zip-archive,
+                    -- additional dependencies needed by the shelly modules
+                    async,
+                    directory,
+                    exceptions                 >= 0.6,
+                    monad-control              >= 0.3.2 && < 1.1,
+                    process,
+                    system-filepath            >= 0.4.7 && < 0.5,
+                    system-fileio              < 0.4,
+                    time,
+                    transformers-base,
+                    unix-compat,
 
   -- the tests shell out to a built darcs binary, so we depend on it to make
   -- sure that it's built. It's not actually required for build, just at runtime,
@@ -647,6 +654,9 @@
                     Darcs.Test.TestOnly.Instance
                     Darcs.Test.Util.TestResult
                     Darcs.Test.Util.QuickCheck
+                    Shelly
+                    Shelly.Base
+                    Shelly.Find
 
   if flag(warn-as-error)
     ghc-options:    -Werror
diff --git a/release/distributed-context b/release/distributed-context
--- a/release/distributed-context
+++ b/release/distributed-context
@@ -1,1 +1,1 @@
-Just "\nContext:\n\n\n[TAG 2.16.1\nBen Franksen <ben.franksen@online.de>**20200814093257\n Ignore-this: b5957de98ad629b97483fd6bee8941e2871a58aac4c559d37921feda3e88f06c5a939f40820abf9f\n] \n"
+Just "\nContext:\n\n\n[TAG 2.16.2\nBen Franksen <ben.franksen@online.de>**20200819210622\n Ignore-this: 8aeca92b4f3d72a38b97ea681f4f87ea9f13e1a0abb37954596cbc64754cdaf4202fe95d848e9764\n] \n"
diff --git a/shelly/shelly.cabal b/shelly/shelly.cabal
deleted file mode 100644
--- a/shelly/shelly.cabal
+++ /dev/null
@@ -1,198 +0,0 @@
-Name:       shelly
-
-Version:     1.7.1.1
-Synopsis:    shell-like (systems) programming in Haskell
-
-Description: Shelly provides convenient systems programming in Haskell,
-             similar in spirit to POSIX shells. Shelly:
-             .
-               * is aimed at convenience and getting things done rather than
-                 being a demonstration of elegance.
-             .
-               * has detailed and useful error messages
-             .
-               * maintains its own environment, making it thread-safe.
-             .
-               * is modern, using Text and system-filepath/system-fileio
-             .
-             Shelly is originally forked from the Shellish package.
-             .
-             See the shelly-extra package for additional functionality.
-             .
-             An overview is available in the README: <https://github.com/yesodweb/Shelly.hs/blob/master/README.md>
-
-
-Homepage:            https://github.com/yesodweb/Shelly.hs
-License:             BSD3
-License-file:        LICENSE
-Author:              Greg Weber, Petr Rockai
-Maintainer:          Greg Weber <greg@gregweber.info>
-Category:            Development
-Build-type:          Simple
-Cabal-version:       >=1.8
-
--- for the sdist of the test suite
-extra-source-files: test/src/*.hs
-                    test/examples/*.sh
-                    test/examples/*.hs
-                    test/data/zshrc
-                    test/data/nonascii.txt
-                    test/data/symlinked_dir/hoge_file
-                    test/testall
-                    README.md
-                    ChangeLog.md
-
-Library
-  Exposed-modules: Shelly, Shelly.Lifted, Shelly.Pipe, Shelly.Unix
-  other-modules:   Shelly.Base, Shelly.Find
-  hs-source-dirs: src
-  other-extensions: InstanceSigs
-
-  Build-depends:
-    containers                >= 0.4.2.0,
-    time                      >= 1.3 && < 2,
-    directory                 >= 1.1.0.0 && < 1.4.0.0,
-    mtl                       >= 2,
-    process                   >= 1.0,
-    unix-compat               < 0.6,
-    system-filepath           >= 0.4.7 && < 0.5,
-    system-fileio             < 0.4,
-    monad-control             >= 0.3.2 && < 1.1,
-    lifted-base,
-    lifted-async,
-    exceptions                >= 0.6,
-    enclosed-exceptions,
-    text, bytestring, async, transformers, transformers-base
-
-  if impl(ghc >= 7.6.1)
-    build-depends:
-        base >= 4.6 && < 5
-  else
-    build-depends:
-      base >= 4 && < 5
-
-  ghc-options: -Wall
-
-  if impl(ghc >= 7.6.1)
-      CPP-Options: -DNO_PRELUDE_CATCH
-
-  extensions:
-    CPP
-
-source-repository head
-  type:     git
-  location: https://github.com/yesodweb/Shelly.hs
-
-Flag lifted
-   Description: run the tests against Shelly.Lifted
-   Default: False
-
-Test-Suite shelly-testsuite
-  type: exitcode-stdio-1.0
-  hs-source-dirs: src test/src
-  main-is: TestMain.hs
-  other-modules:
-    CopySpec
-    EnvSpec
-    FailureSpec
-    FindSpec
-    Help
-    LiftedSpec
-    MoveSpec
-    ReadFileSpec
-    RmSpec
-    RunSpec
-    SshSpec
-    Shelly
-    Shelly.Base
-    Shelly.Find
-    Shelly.Lifted
-    TestInit
-    WhichSpec
-    WriteSpec
-
-  ghc-options: -O2 -Wall -fwarn-tabs -funbox-strict-fields -threaded
-               -fno-warn-unused-do-bind -fno-warn-type-defaults
-
-
-  extensions: OverloadedStrings, ExtendedDefaultRules
-
-  if flag(lifted)
-     cpp-options: -DLIFTED
-
-  build-depends:
-    base                      >= 4.6,
-    text                      >= 0.11,
-    async,
-    bytestring                >= 0.10,
-    containers                >= 0.5.0.0,
-    directory                 >= 1.1.0.0 && < 1.4.0.0,
-    process                   >= 1.1.0,
-    unix-compat               < 0.6,
-    system-filepath           >= 0.4.7 && < 0.5,
-    system-fileio             < 0.4,
-    time                      >= 1.3 && < 2,
-    mtl                       >= 2,
-    HUnit                     >= 1.2,
-    hspec                     >= 1.5,
-    transformers,
-    transformers-base,
-    filepath,
-    monad-control,
-    lifted-base,
-    lifted-async,
-    enclosed-exceptions,
-    exceptions
-
-  extensions:
-    CPP
-
-Flag build-examples
-   Description: build some example programs
-   Default: False
-   Manual: True
-
--- demonstarated that command output in Shellish was not shown until after the command finished
--- not necessary anymore
-Executable drain
-  hs-source-dirs: test/examples
-  main-is: drain.hs
-  if flag(build-examples)
-    buildable: True
-
-    build-depends: base                      >= 4.6
-                 , shelly
-                 , text
-
-    extensions:
-      CPP
-  else
-    buildable: False
-
-Executable run-handles
-  hs-source-dirs: test/examples
-  main-is: run-handles.hs
-  if flag(build-examples)
-    buildable: True
-
-    build-depends: base                      >= 4.6
-                 , shelly
-                 , text
-
-    extensions:
-      CPP
-  else
-    buildable: False
-
-Executable Color
-  hs-source-dirs: test/examples
-  main-is: color.hs
-  if flag(build-examples)
-    buildable: True
-
-    build-depends: base                      >= 4.6
-                 , process
-                 , shelly
-                 , text
-  else
-    buildable: False
diff --git a/shelly/src/Shelly.hs b/shelly/src/Shelly.hs
--- a/shelly/src/Shelly.hs
+++ b/shelly/src/Shelly.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, OverloadedStrings,
-             FlexibleInstances, IncoherentInstances,
+             FlexibleInstances, IncoherentInstances, CPP,
              TypeFamilies, ExistentialQuantification #-}
 
 -- | A module for shell-like programming in Haskell.
diff --git a/shelly/src/Shelly/Find.hs b/shelly/src/Shelly/Find.hs
--- a/shelly/src/Shelly/Find.hs
+++ b/shelly/src/Shelly/Find.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 -- | File finding utiliites for Shelly
 -- The basic 'find' takes a dir and gives back a list of files.
diff --git a/shelly/src/Shelly/Lifted.hs b/shelly/src/Shelly/Lifted.hs
deleted file mode 100644
--- a/shelly/src/Shelly/Lifted.hs
+++ /dev/null
@@ -1,584 +0,0 @@
-{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, OverloadedStrings,
-             FlexibleInstances, FlexibleContexts, IncoherentInstances,
-             TypeFamilies, ExistentialQuantification, RankNTypes,
-             ImpredicativeTypes #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-
--- | A module for shell-like programming in Haskell.
--- Shelly's focus is entirely on ease of use for those coming from shell scripting.
--- However, it also tries to use modern libraries and techniques to keep things efficient.
---
--- The functionality provided by
--- this module is (unlike standard Haskell filesystem functionality)
--- thread-safe: each Sh maintains its own environment and its own working
--- directory.
---
--- Recommended usage includes putting the following at the top of your program,
--- otherwise you will likely need either type annotations or type conversions
---
--- > {-# LANGUAGE OverloadedStrings #-}
--- > {-# LANGUAGE ExtendedDefaultRules #-}
--- > {-# OPTIONS_GHC -fno-warn-type-defaults #-}
--- > import Shelly
--- > import qualified Data.Text as T
--- > default (T.Text)
-module Shelly.Lifted
-       (
-         MonadSh(..),
-         MonadShControl(..),
-
-         -- This is copied from Shelly.hs, so that we are sure to export the
-         -- exact same set of symbols.  Whenever that export list is updated,
-         -- please make the same updates here and implements the corresponding
-         -- lifted functions.
-
-         -- * Entering Sh.
-         Sh, ShIO, S.shelly, S.shellyNoDir, S.shellyFailDir, sub
-         , silently, verbosely, escaping, print_stdout, print_stderr, print_commands
-         , tracing, errExit
-         , log_stdout_with, log_stderr_with
-
-         -- * Running external commands.
-         , run, run_, runFoldLines, S.cmd, S.FoldCallback
-         , (-|-), lastStderr, setStdin, lastExitCode
-         , command, command_, command1, command1_
-         , sshPairs, sshPairs_
-         , S.ShellCmd(..), S.CmdArg (..)
-
-         -- * Running commands Using handles
-         , runHandle, runHandles, transferLinesAndCombine, S.transferFoldHandleLines
-         , S.StdHandle(..), S.StdStream(..)
-
-
-         -- * Modifying and querying environment.
-         , setenv, get_env, get_env_text, get_env_all, appendToPath, prependToPath
-
-         -- * Environment directory
-         , cd, chdir, chdir_p, pwd
-
-         -- * Printing
-         , echo, echo_n, echo_err, echo_n_err, inspect, inspect_err
-         , tag, trace, S.show_command
-
-         -- * Querying filesystem.
-         , ls, lsT, test_e, test_f, test_d, test_s, test_px, which
-
-         -- * Filename helpers
-         , absPath, (S.</>), (S.<.>), canonic, canonicalize, relPath, relativeTo
-         , S.hasExt
-
-         -- * Manipulating filesystem.
-         , mv, rm, rm_f, rm_rf, cp, cp_r, mkdir, mkdir_p, mkdirTree
-
-         -- * reading/writing Files
-         , readfile, readBinary, writefile, appendfile, touchfile, withTmpDir
-
-         -- * exiting the program
-         , exit, errorExit, quietExit, terror
-
-         -- * Exceptions
-         , bracket_sh, catchany, catch_sh, handle_sh, handleany_sh, finally_sh, catches_sh, catchany_sh
-
-         -- * convert between Text and FilePath
-         , S.toTextIgnore, toTextWarn, FP.fromText
-
-         -- * Utility Functions
-         , S.whenM, S.unlessM, time, sleep
-
-         -- * Re-exported for your convenience
-         , liftIO, S.when, S.unless, FilePath, (S.<$>)
-
-         -- * internal functions for writing extensions
-         , Shelly.Lifted.get, Shelly.Lifted.put
-
-         -- * find functions
-         , S.find, S.findWhen, S.findFold, S.findDirFilter, S.findDirFilterWhen, S.findFoldDirFilter
-         , followSymlink
-         ) where
-
-import qualified Shelly as S
-import Shelly.Base (Sh(..), ShIO, Text, (>=>), FilePath)
-import qualified Shelly.Base as S
-import Control.Monad ( liftM )
-import Prelude hiding ( FilePath )
-import Data.ByteString ( ByteString )
-import System.IO ( Handle )
-import Data.Tree ( Tree )
-import qualified Filesystem.Path.CurrentOS as FP
-
-import Control.Exception.Lifted
-import Control.Exception.Enclosed
-import Control.Monad.IO.Class
-import Control.Monad.Trans.Control
-import Control.Monad.Trans.Identity
-import Control.Monad.Trans.Maybe
-import Control.Monad.Trans.Cont
-import Control.Monad.Trans.Except
-import Control.Monad.Trans.Reader
-import Control.Monad.Trans.State
-import qualified Control.Monad.Trans.State.Strict as Strict
-import Control.Monad.Trans.Writer
-import qualified Control.Monad.Trans.Writer.Strict as Strict
-import qualified Control.Monad.Trans.RWS as RWS
-import qualified Control.Monad.Trans.RWS.Strict as Strict
-
-class Monad m => MonadSh m where
-    liftSh :: Sh a -> m a
-
-instance MonadSh Sh where
-    liftSh = id
-
-instance MonadSh m => MonadSh (IdentityT m) where
-    liftSh = IdentityT . liftSh
-instance MonadSh m => MonadSh (MaybeT m) where
-    liftSh = MaybeT . liftM Just . liftSh
-instance MonadSh m => MonadSh (ContT r m) where
-    liftSh m = ContT (liftSh m >>=)
-instance MonadSh m => MonadSh (ExceptT e m) where
-    liftSh m = ExceptT $ do
-        a <- liftSh m
-        return (Right a)
-instance MonadSh m => MonadSh (ReaderT r m) where
-    liftSh = ReaderT . const . liftSh
-instance MonadSh m => MonadSh (StateT s m) where
-    liftSh m = StateT $ \s -> do
-        a <- liftSh m
-        return (a, s)
-instance MonadSh m => MonadSh (Strict.StateT s m) where
-    liftSh m = Strict.StateT $ \s -> do
-        a <- liftSh m
-        return (a, s)
-instance (Monoid w, MonadSh m) => MonadSh (WriterT w m) where
-    liftSh m = WriterT $ do
-        a <- liftSh m
-        return (a, mempty :: w)
-instance (Monoid w, MonadSh m) => MonadSh (Strict.WriterT w m) where
-    liftSh m = Strict.WriterT $ do
-        a <- liftSh m
-        return (a, mempty :: w)
-instance (Monoid w, MonadSh m) => MonadSh (RWS.RWST r w s m) where
-    liftSh m = RWS.RWST $ \_ s -> do
-        a <- liftSh m
-        return (a, s, mempty :: w)
-instance (Monoid w, MonadSh m) => MonadSh (Strict.RWST r w s m) where
-    liftSh m = Strict.RWST $ \_ s -> do
-        a <- liftSh m
-        return (a, s, mempty :: w)
-
-instance MonadSh m => S.ShellCmd (m Text) where
-    cmdAll = (liftSh .) . S.run
-
-instance (MonadSh m, s ~ Text, Show s) => S.ShellCmd (m s) where
-    cmdAll = (liftSh .) . S.run
-
-instance MonadSh m => S.ShellCmd (m ()) where
-    cmdAll = (liftSh .) . S.run_
-
-class Monad m => MonadShControl m where
-    data ShM m a :: *
-    liftShWith :: ((forall x. m x -> Sh (ShM m x)) -> Sh a) -> m a
-    restoreSh :: ShM m a -> m a
-
-instance MonadShControl Sh where
-     newtype ShM Sh a = ShSh a
-     liftShWith f = f $ liftM ShSh
-     restoreSh (ShSh x) = return x
-     {-# INLINE liftShWith #-}
-     {-# INLINE restoreSh #-}
-
-instance MonadShControl m => MonadShControl (MaybeT m) where
-    newtype ShM (MaybeT m) a = MaybeTShM (ShM m (Maybe a))
-    liftShWith f =
-        MaybeT $ liftM return $ liftShWith $ \runInSh -> f $ \k ->
-            liftM MaybeTShM $ runInSh $ runMaybeT k
-    restoreSh (MaybeTShM m) = MaybeT . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance MonadShControl m
-         => MonadShControl (IdentityT m) where
-    newtype ShM (IdentityT m) a = IdentityTShM (ShM m a)
-    liftShWith f =
-        IdentityT $ liftM id $ liftShWith $ \runInSh -> f $ \k ->
-            liftM IdentityTShM $ runInSh $ runIdentityT k
-    restoreSh (IdentityTShM m) = IdentityT . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance (MonadShControl m, Monoid w)
-         => MonadShControl (WriterT w m) where
-    newtype ShM (WriterT w m) a = WriterTShM (ShM m (a, w))
-    liftShWith f =
-        WriterT $ liftM  (\x -> (x, mempty :: w)) $ liftShWith $ \runInSh -> f $ \k ->
-            liftM WriterTShM $ runInSh $ runWriterT k
-    restoreSh (WriterTShM m) = WriterT . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance (MonadShControl m, Monoid w)
-         => MonadShControl (Strict.WriterT w m) where
-    newtype ShM (Strict.WriterT w m) a = StWriterTShM (ShM m (a, w))
-    liftShWith f =
-        Strict.WriterT $ liftM (\x -> (x, mempty :: w)) $ liftShWith $ \runInSh -> f $ \k ->
-            liftM StWriterTShM $ runInSh $ Strict.runWriterT k
-    restoreSh (StWriterTShM m) = Strict.WriterT . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance MonadShControl m
-         => MonadShControl (ExceptT e m) where
-    newtype ShM (ExceptT e m) a = ErrorTShM (ShM m (Either e a))
-    liftShWith f =
-        ExceptT $ liftM return $ liftShWith $ \runInSh -> f $ \k ->
-            liftM ErrorTShM $ runInSh $ runExceptT k
-    restoreSh (ErrorTShM m) = ExceptT . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance MonadShControl m => MonadShControl (StateT s m) where
-    newtype ShM (StateT s m) a = StateTShM (ShM m (a, s))
-    liftShWith f = StateT $ \s ->
-        liftM (\x -> (x,s)) $ liftShWith $ \runInSh -> f $ \k ->
-            liftM StateTShM $ runInSh $ runStateT k s
-    restoreSh (StateTShM m) = StateT . const . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance MonadShControl m => MonadShControl (Strict.StateT s m) where
-    newtype ShM (Strict.StateT s m) a = StStateTShM (ShM m (a, s))
-    liftShWith f = Strict.StateT $ \s ->
-        liftM (\x -> (x,s)) $ liftShWith $ \runInSh -> f $ \k ->
-            liftM StStateTShM $ runInSh $ Strict.runStateT k s
-    restoreSh (StStateTShM m) = Strict.StateT . const . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance MonadShControl m => MonadShControl (ReaderT r m) where
-    newtype ShM (ReaderT r m) a = ReaderTShM (ShM m a)
-    liftShWith f = ReaderT $ \r ->
-        liftM id $ liftShWith $ \runInSh -> f $ \k ->
-            liftM ReaderTShM $ runInSh $ runReaderT k r
-    restoreSh (ReaderTShM m) = ReaderT . const . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance (MonadShControl m, Monoid w)
-         => MonadShControl (RWS.RWST r w s m) where
-    newtype ShM (RWS.RWST r w s m) a = RWSTShM (ShM m (a, s ,w))
-    liftShWith f = RWS.RWST $ \r s ->
-        liftM (\x -> (x,s,mempty :: w)) $ liftShWith $ \runInSh -> f $ \k ->
-            liftM RWSTShM $ runInSh $ RWS.runRWST k r s
-    restoreSh (RWSTShM m) = RWS.RWST . const . const . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-instance (MonadShControl m, Monoid w)
-         => MonadShControl (Strict.RWST r w s m) where
-    newtype ShM (Strict.RWST r w s m) a = StRWSTShM (ShM m (a, s, w))
-    liftShWith f = Strict.RWST $ \r s ->
-        liftM (\x -> (x,s,mempty :: w)) $ liftShWith $ \runInSh -> f $ \k ->
-            liftM StRWSTShM $ runInSh $ Strict.runRWST k r s
-    restoreSh (StRWSTShM m) = Strict.RWST . const . const . restoreSh $ m
-    {-# INLINE liftShWith #-}
-    {-# INLINE restoreSh #-}
-
-controlSh :: MonadShControl m => ((forall x. m x -> Sh (ShM m x)) -> Sh (ShM m a)) -> m a
-controlSh = liftShWith >=> restoreSh
-{-# INLINE controlSh #-}
-
-tag :: (MonadShControl m, MonadSh m) => m a -> Text -> m a
-tag action msg = controlSh $ \runInSh -> S.tag (runInSh action) msg
-
-chdir :: MonadShControl m => FilePath -> m a -> m a
-chdir dir action = controlSh $ \runInSh -> S.chdir dir (runInSh action)
-
-chdir_p :: MonadShControl m => FilePath -> m a -> m a
-chdir_p dir action = controlSh $ \runInSh -> S.chdir_p dir (runInSh action)
-
-silently :: MonadShControl m => m a -> m a
-silently a = controlSh $ \runInSh -> S.silently (runInSh a)
-
-verbosely :: MonadShControl m => m a -> m a
-verbosely a = controlSh $ \runInSh -> S.verbosely (runInSh a)
-
-log_stdout_with :: MonadShControl m => (Text -> IO ()) -> m a -> m a
-log_stdout_with logger a = controlSh $ \runInSh -> S.log_stdout_with logger (runInSh a)
-
-log_stderr_with :: MonadShControl m => (Text -> IO ()) -> m a -> m a
-log_stderr_with logger a = controlSh $ \runInSh -> S.log_stderr_with logger (runInSh a)
-
-print_stdout :: MonadShControl m => Bool -> m a -> m a
-print_stdout shouldPrint a = controlSh $ \runInSh -> S.print_stdout shouldPrint (runInSh a)
-
-print_stderr :: MonadShControl m => Bool -> m a -> m a
-print_stderr shouldPrint a = controlSh $ \runInSh -> S.print_stderr shouldPrint (runInSh a)
-
-print_commands :: MonadShControl m => Bool -> m a -> m a
-print_commands shouldPrint a = controlSh $ \runInSh -> S.print_commands shouldPrint (runInSh a)
-
-sub :: MonadShControl m => m a -> m a
-sub a = controlSh $ \runInSh -> S.sub (runInSh a)
-
-trace :: MonadSh m => Text -> m ()
-trace = liftSh . S.trace
-
-tracing :: MonadShControl m => Bool -> m a -> m a
-tracing shouldTrace action = controlSh $ \runInSh -> S.tracing shouldTrace (runInSh action)
-
-escaping :: MonadShControl m => Bool -> m a -> m a
-escaping shouldEscape action = controlSh $ \runInSh -> S.escaping shouldEscape (runInSh action)
-
-errExit :: MonadShControl m => Bool -> m a -> m a
-errExit shouldExit action = controlSh $ \runInSh -> S.errExit shouldExit (runInSh action)
-
-followSymlink :: MonadShControl m => Bool -> m a -> m a
-followSymlink enableFollowSymlink action = controlSh $ \runInSh -> S.followSymlink enableFollowSymlink (runInSh action)
-
-(-|-) :: (MonadShControl m, MonadSh m) => m Text -> m b -> m b
-one -|- two = controlSh $ \runInSh -> do
-    x <- runInSh one
-    runInSh $ restoreSh x >>= \x' ->
-        controlSh $ \runInSh' -> return x' S.-|- runInSh' two
-
-withTmpDir :: MonadShControl m => (FilePath -> m a) -> m a
-withTmpDir action = controlSh $ \runInSh -> S.withTmpDir (fmap runInSh action)
-
-time :: MonadShControl m => m a -> m (Double, a)
-time what = controlSh $ \runInSh -> do
-    (d, a) <- S.time (runInSh what)
-    runInSh $ restoreSh a >>= \x -> return (d, x)
-
-toTextWarn :: MonadSh m => FilePath -> m Text
-toTextWarn = liftSh . toTextWarn
-
-transferLinesAndCombine :: MonadIO m => Handle -> (Text -> IO ()) -> m Text
-transferLinesAndCombine = (liftIO .) . S.transferLinesAndCombine
-
-get :: MonadSh m => m S.State
-get = liftSh S.get
-
-put :: MonadSh m => S.State -> m ()
-put = liftSh . S.put
-
-catch_sh :: (Exception e) => Sh a -> (e -> Sh a) -> Sh a
-catch_sh = Control.Exception.Lifted.catch
-{-# DEPRECATED catch_sh "use Control.Exception.Lifted.catch instead" #-}
-
-handle_sh :: (Exception e) => (e -> Sh a) -> Sh a -> Sh a
-handle_sh = handle
-{-# DEPRECATED handle_sh "use Control.Exception.Lifted.handle instead" #-}
-
-finally_sh :: Sh a -> Sh b -> Sh a
-finally_sh = finally
-{-# DEPRECATED finally_sh "use Control.Exception.Lifted.finally instead" #-}
-
-bracket_sh :: Sh a -> (a -> Sh b) -> (a -> Sh c) -> Sh c
-bracket_sh = bracket
-{-# DEPRECATED bracket_sh "use Control.Exception.Lifted.bracket instead" #-}
-
-catches_sh :: Sh a -> [Handler Sh a] -> Sh a
-catches_sh = catches
-{-# DEPRECATED catches_sh "use Control.Exception.Lifted.catches instead" #-}
-
-catchany_sh :: Sh a -> (SomeException -> Sh a) -> Sh a
-catchany_sh = catchAny
-{-# DEPRECATED catchany_sh "use Control.Exception.Enclosed.catchAny instead" #-}
-
-handleany_sh :: (SomeException -> Sh a) -> Sh a -> Sh a
-handleany_sh = handleAny
-{-# DEPRECATED handleany_sh "use Control.Exception.Enclosed.handleAny instead" #-}
-
-cd :: MonadSh m => FilePath -> m ()
-cd = liftSh . S.cd
-
-mv :: MonadSh m => FilePath -> FilePath -> m ()
-mv = (liftSh .) . S.mv
-
-lsT :: MonadSh m => FilePath -> m [Text]
-lsT = liftSh . S.lsT
-
-pwd :: MonadSh m => m FilePath
-pwd = liftSh S.pwd
-
-exit :: MonadSh m => Int -> m a
-exit = liftSh . S.exit
-
-errorExit :: MonadSh m => Text -> m a
-errorExit = liftSh . S.errorExit
-
-quietExit :: MonadSh m => Int -> m a
-quietExit = liftSh . S.quietExit
-
-terror :: MonadSh m => Text -> m a
-terror = liftSh . S.terror
-
-mkdir :: MonadSh m => FilePath -> m ()
-mkdir = liftSh . S.mkdir
-
-mkdir_p :: MonadSh m => FilePath -> m ()
-mkdir_p = liftSh . S.mkdir_p
-
-mkdirTree :: MonadSh m => Tree FilePath -> m ()
-mkdirTree = liftSh . S.mkdirTree
-
-which :: MonadSh m => FilePath -> m (Maybe FilePath)
-which = liftSh . S.which
-
-test_e :: MonadSh m => FilePath -> m Bool
-test_e = liftSh . S.test_e
-
-test_f :: MonadSh m => FilePath -> m Bool
-test_f = liftSh . S.test_f
-
-test_px :: MonadSh m => FilePath -> m Bool
-test_px = liftSh . S.test_px
-
-rm_rf :: MonadSh m => FilePath -> m ()
-rm_rf = liftSh . S.rm_rf
-
-rm_f :: MonadSh m => FilePath -> m ()
-rm_f = liftSh . S.rm_f
-
-rm :: MonadSh m => FilePath -> m ()
-rm = liftSh . S.rm
-
-setenv :: MonadSh m => Text -> Text -> m ()
-setenv = (liftSh .) . S.setenv
-
-appendToPath :: MonadSh m => FilePath -> m ()
-appendToPath = liftSh . S.appendToPath
-
-prependToPath :: MonadSh m => FilePath -> m ()
-prependToPath = liftSh . S.prependToPath
-
-get_env_all :: MonadSh m => m [(String, String)]
-get_env_all = liftSh S.get_env_all
-
-get_env :: MonadSh m => Text -> m (Maybe Text)
-get_env = liftSh . S.get_env
-
-get_env_text :: MonadSh m => Text -> m Text
-get_env_text = liftSh . S.get_env_text
-
-sshPairs_ :: MonadSh m => Text -> [(FilePath, [Text])] -> m ()
-sshPairs_ = (liftSh .) . S.sshPairs_
-
-sshPairs :: MonadSh m => Text -> [(FilePath, [Text])] -> m Text
-sshPairs = (liftSh .) . S.sshPairs
-
-run :: MonadSh m => FilePath -> [Text] -> m Text
-run = (liftSh .) . S.run
-
-command :: MonadSh m => FilePath -> [Text] -> [Text] -> m Text
-command com args more_args =
-    liftSh $ S.command com args more_args
-
-command_ :: MonadSh m => FilePath -> [Text] -> [Text] -> m ()
-command_ com args more_args =
-    liftSh $ S.command_ com args more_args
-
-command1 :: MonadSh m => FilePath -> [Text] -> Text -> [Text] -> m Text
-command1 com args one_arg more_args =
-    liftSh $ S.command1 com args one_arg more_args
-
-command1_ :: MonadSh m => FilePath -> [Text] -> Text -> [Text] -> m ()
-command1_ com args one_arg more_args =
-    liftSh $ S.command1_ com args one_arg more_args
-
-run_ :: MonadSh m => FilePath -> [Text] -> m ()
-run_ = (liftSh .) . S.run_
-
-runHandle :: MonadShControl m => FilePath -- ^ command
-          -> [Text] -- ^ arguments
-          -> (Handle -> m a) -- ^ stdout handle
-          -> m a
-runHandle exe args withHandle =
-    controlSh $ \runInSh -> S.runHandle exe args (fmap runInSh withHandle)
-
-runHandles :: MonadShControl m => FilePath -- ^ command
-           -> [Text] -- ^ arguments
-           -> [S.StdHandle] -- ^ optionally connect process i/o handles to existing handles
-           -> (Handle -> Handle -> Handle -> m a) -- ^ stdin, stdout and stderr
-           -> m a
-runHandles exe args reusedHandles withHandles =
-    controlSh $ \runInSh ->
-        S.runHandles exe args reusedHandles (fmap (fmap (fmap runInSh)) withHandles)
-
-runFoldLines :: MonadSh m => a -> S.FoldCallback a -> FilePath -> [Text] -> m a
-runFoldLines start cb exe args = liftSh $ S.runFoldLines start cb exe args
-
-lastStderr :: MonadSh m => m Text
-lastStderr = liftSh S.lastStderr
-
-lastExitCode :: MonadSh m => m Int
-lastExitCode = liftSh S.lastExitCode
-
-setStdin :: MonadSh m => Text -> m ()
-setStdin = liftSh . S.setStdin
-
-cp_r :: MonadSh m => FilePath -> FilePath -> m ()
-cp_r = (liftSh .) . S.cp_r
-
-cp :: MonadSh m => FilePath -> FilePath -> m ()
-cp = (liftSh .) . S.cp
-
-writefile :: MonadSh m => FilePath -> Text -> m ()
-writefile = (liftSh .) . S.writefile
-
-touchfile :: MonadSh m => FilePath -> m ()
-touchfile = liftSh . S.touchfile
-
-appendfile :: MonadSh m => FilePath -> Text -> m ()
-appendfile = (liftSh .) . S.appendfile
-
-readfile :: MonadSh m => FilePath -> m Text
-readfile = liftSh . S.readfile
-
-readBinary :: MonadSh m => FilePath -> m ByteString
-readBinary = liftSh . S.readBinary
-
-sleep :: MonadSh m => Int -> m ()
-sleep = liftSh . S.sleep
-
-echo, echo_n, echo_err, echo_n_err :: MonadSh m => Text -> m ()
-echo       = liftSh . S.echo
-echo_n     = liftSh . S.echo_n
-echo_err   = liftSh . S.echo_err
-echo_n_err = liftSh . S.echo_n_err
-
-relPath :: MonadSh m => FilePath -> m FilePath
-relPath = liftSh . S.relPath
-
-relativeTo :: MonadSh m => FilePath -- ^ anchor path, the prefix
-           -> FilePath -- ^ make this relative to anchor path
-           -> m FilePath
-relativeTo = (liftSh .) . S.relativeTo
-
-canonic :: MonadSh m => FilePath -> m FilePath
-canonic = liftSh . canonic
-
--- | Obtain a (reasonably) canonic file path to a filesystem object. Based on
--- "canonicalizePath" in system-fileio.
-canonicalize :: MonadSh m => FilePath -> m FilePath
-canonicalize = liftSh . S.canonicalize
-
-absPath :: MonadSh m => FilePath -> m FilePath
-absPath = liftSh . S.absPath
-
-test_d :: MonadSh m => FilePath -> m Bool
-test_d = liftSh . S.test_d
-
-test_s :: MonadSh m => FilePath -> m Bool
-test_s = liftSh . S.test_s
-
-ls :: MonadSh m => FilePath -> m [FilePath]
-ls = liftSh . S.ls
-
-inspect :: (Show s, MonadSh m) => s -> m ()
-inspect = liftSh . S.inspect
-
-inspect_err :: (Show s, MonadSh m) => s -> m ()
-inspect_err = liftSh . S.inspect_err
-
-catchany :: MonadBaseControl IO m => m a -> (SomeException -> m a) -> m a
-catchany = Control.Exception.Lifted.catch
diff --git a/shelly/src/Shelly/Pipe.hs b/shelly/src/Shelly/Pipe.hs
deleted file mode 100644
--- a/shelly/src/Shelly/Pipe.hs
+++ /dev/null
@@ -1,643 +0,0 @@
-{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, 
-             TypeFamilies, ExistentialQuantification #-}
--- | This module is a wrapper for the module "Shelly". 
--- The only difference is a main type 'Sh'. In this module 
--- 'Sh' contains a list of results. Actual definition of the type 'Sh' is:
---
--- > import qualified Shelly as S
--- >
--- > newtype Sh a = Sh { unSh :: S.Sh [a] }
---
--- This definition can simplify some filesystem commands. 
--- A monad bind operator becomes a pipe operator and we can write
---
--- > findExt ext = findWhen (pure . hasExt ext)
--- >
--- > main :: IO ()
--- > main = shs $ do
--- >     mkdir "new"
--- >     findExt "hs"  "." >>= flip cp "new"
--- >     findExt "cpp" "." >>= rm_f 
--- >     liftIO $ putStrLn "done"
---
--- Monad methods "return" and ">>=" behave like methods for
--- @ListT Shelly.Sh@, but ">>" forgets the number of 
--- the empty effects. So the last line prints @\"done\"@ only once. 
---
--- Documentation in this module mostly just reference documentation from
--- the main "Shelly" module.
---
--- > {-# LANGUAGE OverloadedStrings #-}
--- > {-# LANGUAGE ExtendedDefaultRules #-}
--- > {-# OPTIONS_GHC -fno-warn-type-defaults #-}
--- > import Shelly
--- > import Data.Text as T
--- > default (T.Text)
-module Shelly.Pipe
-       (
-         -- * Entering Sh.
-         Sh, shs, shelly, shellyFailDir, shsFailDir, sub, silently, verbosely, escaping, print_stdout, print_commands, tracing, errExit, log_stdout_with, log_stderr_with
-         -- * List functions
-         , roll, unroll, liftSh
-         -- * Running external commands.
-         , FoldCallback
-         , run, run_, runFoldLines, cmd
-         , (-|-), lastStderr, setStdin, lastExitCode
-         , command, command_, command1, command1_
-         , sshPairs, sshPairs_
-
-         -- * Modifying and querying environment.
-         , setenv, get_env, get_env_text, get_env_def, appendToPath, prependToPath
-
-         -- * Environment directory
-         , cd, chdir, pwd
-
-         -- * Printing
-         , echo, echo_n, echo_err, echo_n_err, inspect, inspect_err
-         , tag, trace, show_command
-
-         -- * Querying filesystem.
-         , ls, lsT, test_e, test_f, test_d, test_s, which
-
-         -- * Filename helpers
-         , absPath, (</>), (<.>), canonic, canonicalize, relPath, relativeTo
-         , hasExt
-
-         -- * Manipulating filesystem.
-         , mv, rm, rm_f, rm_rf, cp, cp_r, mkdir, mkdir_p, mkdirTree
-
-         -- * reading/writing Files
-         , readfile, readBinary, writefile, appendfile, touchfile, withTmpDir
-
-         -- * exiting the program
-         , exit, errorExit, quietExit, terror
-
-         -- * Exceptions
-         , catchany, catch_sh, finally_sh 
-         , ShellyHandler(..), catches_sh
-         , catchany_sh
-
-         -- * convert between Text and FilePath
-         , toTextIgnore, toTextWarn, fromText
-
-         -- * Utilities.
-         , (<$>), whenM, unlessM, time
-
-         -- * Re-exported for your convenience
-         , liftIO, when, unless, FilePath
-
-         -- * internal functions for writing extensions
-         , get, put
-
-         -- * find functions 
-         , find, findWhen, findFold
-         , findDirFilter, findDirFilterWhen, findFoldDirFilter
-         , followSymlink
-         ) where
-
-import Prelude hiding (FilePath)
-
-import Control.Applicative
-import Control.Monad
-import Control.Monad.Trans
-import Control.Exception hiding (handle)
-
-import Filesystem.Path(FilePath)
-
-import qualified Shelly as S
-
-import Shelly(
-      (</>), (<.>), hasExt
-    , whenM, unlessM, toTextIgnore
-    , fromText, catchany
-    , FoldCallback)
-
-import Data.Maybe(fromMaybe)
-import Shelly.Base(State)
-import Data.ByteString (ByteString)
-
-import Data.Tree(Tree)
-
-import Data.Text as T hiding (concat, all, find, cons)
-
-
--- | This type is a simple wrapper for a type @Shelly.Sh@.
--- 'Sh' contains a list of results. 
-newtype Sh a = Sh { unSh :: S.Sh [a] }
-
-instance Functor Sh where
-    fmap f = Sh . fmap (fmap f) . unSh    
-
-instance Monad Sh where
-    return  = Sh . return . return 
-    a >>= f = Sh $ fmap concat $ mapM (unSh . f) =<< unSh a
-    a >> b  = Sh $ unSh a >> unSh b
-
-instance Applicative Sh where
-    pure = return
-    (<*>) = ap
-
-instance Alternative Sh where
-    empty = mzero
-    (<|>) = mplus
-
-instance MonadPlus Sh where
-    mzero = Sh $ return []
-    mplus a b = Sh $ liftA2 (++) (unSh a) (unSh b)
-
-instance MonadIO Sh where
-    liftIO = sh1 liftIO
-
--------------------------------------------------------
--- converters
-
-sh0 :: S.Sh a -> Sh a
-sh0 = Sh . fmap return
-
-sh1 :: (a -> S.Sh b) -> (a -> Sh b) 
-sh1 f = \a -> sh0 (f a)
-
-sh2 :: (a1 -> a2 -> S.Sh b) -> (a1 -> a2 -> Sh b) 
-sh2 f = \a b -> sh0 (f a b)
-
-sh3 :: (a1 -> a2 -> a3 -> S.Sh b) -> (a1 -> a2 -> a3 -> Sh b) 
-sh3 f = \a b c -> sh0 (f a b c)
-
-sh4 :: (a1 -> a2 -> a3 -> a4 -> S.Sh b) -> (a1 -> a2 -> a3 -> a4 -> Sh b) 
-sh4 f = \a b c d -> sh0 (f a b c d)
-
-sh0s :: S.Sh [a] -> Sh a
-sh0s = Sh
-
-sh1s :: (a -> S.Sh [b]) -> (a -> Sh b) 
-sh1s f = \a -> sh0s (f a)
-
-{-  Just in case ...
-sh2s :: (a1 -> a2 -> S.Sh [b]) -> (a1 -> a2 -> Sh b) 
-sh2s f = \a b -> sh0s (f a b)
-
-sh3s :: (a1 -> a2 -> a3 -> S.Sh [b]) -> (a1 -> a2 -> a3 -> Sh b) 
-sh3s f = \a b c -> sh0s (f a b c)
--}
-
-lift1 :: (S.Sh a -> S.Sh b) -> (Sh a -> Sh b)
-lift1 f = Sh . (mapM (f . return) =<< ) . unSh
-
-lift2 :: (S.Sh a -> S.Sh b -> S.Sh c) -> (Sh a -> Sh b -> Sh c)
-lift2 f a b = Sh $ join $ liftA2 (mapM2 f') (unSh a) (unSh b)
-    where f' = \x y -> f (return x) (return y)
-
-mapM2 :: Monad m => (a -> b -> m c)-> [a] -> [b] -> m [c]
-mapM2 f as bs = sequence $ liftA2 f as bs 
-
------------------------------------------------------------
-
--- | Unpack list of results.
-unroll :: Sh a -> Sh [a]
-unroll = Sh . fmap return . unSh 
-
--- | Pack list of results. It performs @concat@ inside 'Sh'.
-roll :: Sh [a] -> Sh a
-roll = Sh . fmap concat . unSh
-
--- | Transform result as list. It can be useful for filtering. 
-liftSh :: ([a] -> [b]) -> Sh a -> Sh b
-liftSh f = Sh . fmap f . unSh
-
-------------------------------------------------------------------
--- Entering Sh
-
--- | see 'S.shelly'
-shelly :: MonadIO m => Sh a -> m [a]
-shelly = S.shelly . unSh
-
--- | Performs 'shelly' and then an empty action @return ()@. 
-shs :: MonadIO m => Sh () -> m ()
-shs x = shelly x >> return ()
-
--- | see 'S.shellyFailDir'
-shellyFailDir :: MonadIO m => Sh a -> m [a]
-shellyFailDir = S.shellyFailDir . unSh
-
--- | Performs 'shellyFailDir' and then an empty action @return ()@.
-shsFailDir :: MonadIO m => Sh () -> m ()
-shsFailDir x = shellyFailDir x >> return ()
-
--- | see 'S.sub'
-sub :: Sh a -> Sh a
-sub = lift1 S.sub
-
--- See 'S.siliently'
-silently :: Sh a -> Sh a
-silently = lift1 S.silently
-
--- See 'S.verbosely
-verbosely :: Sh a -> Sh a
-verbosely = lift1 S.verbosely
-
--- | see 'S.escaping'
-escaping :: Bool -> Sh a -> Sh a
-escaping b = lift1 (S.escaping b)
-
--- | see 'S.log_stdout_with'
-log_stdout_with :: (Text -> IO ()) -> Sh a -> Sh a
-log_stdout_with logger = lift1 (S.log_stdout_with logger)
-
--- | see 'S.log_stderr_with'
-log_stderr_with :: (Text -> IO ()) -> Sh a -> Sh a
-log_stderr_with logger = lift1 (S.log_stdout_with logger)
-
--- | see 'S.print_stdout'
-print_stdout :: Bool -> Sh a -> Sh a
-print_stdout b = lift1 (S.print_stdout b)
-
--- | see 'S.print_commands
-print_commands :: Bool -> Sh a -> Sh a
-print_commands b = lift1 (S.print_commands b)
-
--- | see 'S.tracing'
-tracing :: Bool -> Sh a -> Sh a
-tracing b = lift1 (S.tracing b)
-
--- | see 'S.errExit'
-errExit :: Bool -> Sh a -> Sh a
-errExit b = lift1 (S.errExit b)
-
--- | see 'S.followSymlink'
-followSymlink :: Bool -> Sh a -> Sh a
-followSymlink b = lift1 (S.followSymlink b)
-
--- | see 'S.run'
-run :: FilePath -> [Text] -> Sh Text
-run a b = sh0 $ S.run a b
-
--- | see 'S.run_'
-run_ :: FilePath -> [Text] -> Sh ()
-run_ a b = sh0 $ S.run_ a b
-
--- | see 'S.runFoldLines'
-runFoldLines :: a -> FoldCallback a -> FilePath -> [Text] -> Sh a
-runFoldLines a cb fp ts = sh0 $ S.runFoldLines a cb fp ts
-
--- | see 'S.-|-'
-(-|-) :: Sh Text -> Sh b -> Sh b
-(-|-) = lift2 (S.-|-)
-
--- | see 'S.lastStderr'
-lastStderr :: Sh Text
-lastStderr = sh0 S.lastStderr
-
--- | see 'S.setStdin'
-setStdin :: Text -> Sh ()
-setStdin = sh1 S.setStdin 
-
--- | see 'S.lastExitCode'
-lastExitCode :: Sh Int
-lastExitCode = sh0 S.lastExitCode
-
--- | see 'S.command'
-command :: FilePath -> [Text] -> [Text] -> Sh Text
-command = sh3 S.command
-
--- | see 'S.command_'
-command_ :: FilePath -> [Text] -> [Text] -> Sh ()
-command_ = sh3 S.command_
-
-
--- | see 'S.command1'
-command1 :: FilePath -> [Text] -> Text -> [Text] -> Sh Text
-command1 = sh4 S.command1
-
--- | see 'S.command1_'
-command1_ :: FilePath -> [Text] -> Text -> [Text] -> Sh ()
-command1_ = sh4 S.command1_
-
--- | see 'S.sshPairs'
-sshPairs :: Text -> [(FilePath, [Text])] -> Sh Text
-sshPairs = sh2 S.sshPairs
-
--- | see 'S.sshPairs_'
-sshPairs_ :: Text -> [(FilePath, [Text])] -> Sh ()
-sshPairs_ = sh2 S.sshPairs_
-
--- | see 'S.setenv'
-setenv :: Text -> Text -> Sh ()
-setenv = sh2 S.setenv
-
--- | see 'S.get_env'
-get_env :: Text -> Sh (Maybe Text)
-get_env = sh1 S.get_env
-
--- | see 'S.get_env_text'
-get_env_text :: Text -> Sh Text
-get_env_text = sh1 S.get_env_text
-
--- | see 'S.get_env_def'
-get_env_def :: Text -> Text -> Sh Text
-get_env_def a d = sh0 $ fmap (fromMaybe d) $ S.get_env a
-{-# DEPRECATED get_env_def "use fromMaybe DEFAULT get_env" #-}
-
--- | see 'S.appendToPath'
-appendToPath :: FilePath -> Sh ()
-appendToPath = sh1 S.appendToPath
-
--- | see 'S.prependToPath'
-prependToPath :: FilePath -> Sh ()
-prependToPath = sh1 S.prependToPath
-
--- | see 'S.cd'
-cd :: FilePath -> Sh ()
-cd = sh1 S.cd
-
--- | see 'S.chdir'
-chdir :: FilePath -> Sh a -> Sh a
-chdir p = lift1 (S.chdir p)
-
--- | see 'S.pwd'
-pwd :: Sh FilePath
-pwd = sh0 S.pwd
-
------------------------------------------------------------------
--- Printing 
-
--- | Echo text to standard (error, when using _err variants) output. The _n
--- variants do not print a final newline.
-echo, echo_n_err, echo_err, echo_n :: Text -> Sh ()
-
-echo        = sh1 S.echo
-echo_n_err  = sh1 S.echo_n_err
-echo_err    = sh1 S.echo_err
-echo_n      = sh1 S.echo_n
-
--- | see 'S.inspect'
-inspect :: Show s => s -> Sh ()
-inspect = sh1 S.inspect
-
--- | see 'S.inspect_err'
-inspect_err :: Show s => s -> Sh ()
-inspect_err = sh1 S.inspect_err
-
--- | see 'S.tag'
-tag :: Sh a -> Text -> Sh a
-tag a t = lift1 (flip S.tag t) a
-
--- | see 'S.trace'
-trace :: Text -> Sh ()
-trace = sh1 S.trace
-
--- | see 'S.show_command'
-show_command :: FilePath -> [Text] -> Text
-show_command = S.show_command
-
-------------------------------------------------------------------
--- Querying filesystem
-
--- | see 'S.ls'
-ls :: FilePath -> Sh FilePath
-ls = sh1s S.ls
-
--- | see 'S.lsT'
-lsT :: FilePath -> Sh Text
-lsT = sh1s S.lsT
-
--- | see 'S.test_e'
-test_e :: FilePath -> Sh Bool
-test_e = sh1 S.test_e
-
--- | see 'S.test_f'
-test_f :: FilePath -> Sh Bool
-test_f = sh1 S.test_f
-
--- | see 'S.test_d'
-test_d :: FilePath -> Sh Bool
-test_d = sh1 S.test_d
-
--- | see 'S.test_s'
-test_s :: FilePath -> Sh Bool
-test_s = sh1 S.test_s
-
--- | see 'S.which
-which :: FilePath -> Sh (Maybe FilePath)
-which = sh1 S.which
-
----------------------------------------------------------------------
--- Filename helpers
-
--- | see 'S.absPath'
-absPath :: FilePath -> Sh FilePath
-absPath = sh1 S.absPath
-
--- | see 'S.canonic'
-canonic :: FilePath -> Sh FilePath
-canonic = sh1 S.canonic
-
--- | see 'S.canonicalize'
-canonicalize :: FilePath -> Sh FilePath
-canonicalize = sh1 S.canonicalize
-
--- | see 'S.relPath'
-relPath :: FilePath -> Sh FilePath
-relPath = sh1 S.relPath
-
--- | see 'S.relativeTo'
-relativeTo :: FilePath -- ^ anchor path, the prefix
-           -> FilePath -- ^ make this relative to anchor path
-           -> Sh FilePath
-relativeTo = sh2 S.relativeTo
-
--------------------------------------------------------------
--- Manipulating filesystem
-
--- | see 'S.mv'
-mv :: FilePath -> FilePath -> Sh ()
-mv = sh2 S.mv
-
--- | see 'S.rm'
-rm :: FilePath -> Sh ()
-rm = sh1 S.rm
-
--- | see 'S.rm_f'
-rm_f :: FilePath -> Sh ()
-rm_f = sh1 S.rm_f
-
--- | see 'S.rm_rf'
-rm_rf :: FilePath -> Sh ()
-rm_rf = sh1 S.rm_rf
-
--- | see 'S.cp'
-cp :: FilePath -> FilePath -> Sh ()
-cp = sh2 S.cp
-
--- | see 'S.cp_r'
-cp_r :: FilePath -> FilePath -> Sh ()
-cp_r = sh2 S.cp_r
-
--- | see 'S.mkdir'
-mkdir :: FilePath -> Sh ()
-mkdir = sh1 S.mkdir
-
--- | see 'S.mkdir_p'
-mkdir_p :: FilePath -> Sh ()
-mkdir_p = sh1 S.mkdir_p
-
--- | see 'S.mkdirTree'
-mkdirTree :: Tree FilePath -> Sh ()
-mkdirTree = sh1 S.mkdirTree
-
--- | see 'S.readFile'
-readfile :: FilePath -> Sh Text
-readfile = sh1 S.readfile
-
--- | see 'S.readBinary'
-readBinary :: FilePath -> Sh ByteString
-readBinary = sh1 S.readBinary
-
--- | see 'S.writeFile'
-writefile :: FilePath -> Text -> Sh ()
-writefile = sh2 S.writefile
-
--- | see 'S.touchFile'
-touchfile :: FilePath -> Sh ()
-touchfile = sh1 S.touchfile
-
--- | see 'S.appendFile'
-appendfile :: FilePath -> Text -> Sh ()
-appendfile = sh2 S.appendfile
-
--- | see 'S.withTmpDir'
-withTmpDir :: (FilePath -> Sh a) -> Sh a
-withTmpDir f = Sh $ S.withTmpDir (unSh . f)
-
------------------------------------------------------------------
--- find
-
--- | see 'S.find'
-find :: FilePath -> Sh FilePath
-find = sh1s S.find
-
--- | see 'S.findWhen'
-findWhen :: (FilePath -> Sh Bool) -> FilePath -> Sh FilePath
-findWhen p a = Sh $ S.findWhen (fmap and . unSh . p) a
-
--- | see 'S.findFold'
-findFold :: (a -> FilePath -> Sh a) -> a -> FilePath -> Sh a
-findFold cons nil a = Sh $ S.findFold cons' nil' a
-    where nil'  = return nil
-          cons' as dir = unSh $ roll $ mapM (flip cons dir) as
-
--- | see 'S.findDirFilter'
-findDirFilter :: (FilePath -> Sh Bool) -> FilePath -> Sh FilePath
-findDirFilter p a = Sh $ S.findDirFilter (fmap and . unSh . p) a
-    
--- | see 'S.findDirFilterWhen'
-findDirFilterWhen :: (FilePath -> Sh Bool) -- ^ directory filter
-                  -> (FilePath -> Sh Bool) -- ^ file filter
-                  -> FilePath -- ^ directory
-                  -> Sh FilePath
-findDirFilterWhen dirPred filePred a = 
-    Sh $ S.findDirFilterWhen  
-            (fmap and . unSh . dirPred) 
-            (fmap and . unSh . filePred)
-            a
-
-
--- | see 'S.findFoldDirFilterWhen'
-findFoldDirFilter :: (a -> FilePath -> Sh a) -> a -> (FilePath -> Sh Bool) -> FilePath -> Sh a
-findFoldDirFilter cons nil p a = Sh $ S.findFoldDirFilter cons' nil' p' a
-    where p'    = fmap and . unSh . p
-          nil'  = return nil
-          cons' as dir = unSh $ roll $ mapM (flip cons dir) as
-           
------------------------------------------------------------
--- exiting the program 
-
--- | see 'S.exit'
-exit :: Int -> Sh ()
-exit = sh1 S.exit
-
--- | see 'S.errorExit'
-errorExit :: Text -> Sh ()
-errorExit = sh1 S.errorExit
-
--- | see 'S.quietExit'
-quietExit :: Int -> Sh ()
-quietExit = sh1 S.quietExit
-
--- | see 'S.terror'
-terror :: Text -> Sh a
-terror = sh1 S.terror
-
-------------------------------------------------------------
--- Utilities
-
--- | see 'S.catch_sh'
-catch_sh :: (Exception e) => Sh a -> (e -> Sh a) -> Sh a
-catch_sh a f = Sh $ S.catch_sh (unSh a) (unSh . f)
-
--- | see 'S.catchany_sh'
-catchany_sh :: Sh a -> (SomeException -> Sh a) -> Sh a
-catchany_sh = catch_sh
-
-
--- | see 'S.finally_sh'
-finally_sh :: Sh a -> Sh b -> Sh a
-finally_sh = lift2 S.finally_sh
-
--- | see 'S.time'
-time :: Sh a -> Sh (Double, a)
-time = lift1 S.time
-
--- | see 'S.ShellyHandler'
-data ShellyHandler a = forall e . Exception e => ShellyHandler (e -> Sh a)
-
--- | see 'S.catches_sh'
-catches_sh :: Sh a -> [ShellyHandler a] -> Sh a
-catches_sh a hs = Sh $ S.catches_sh (unSh a) (fmap convert hs)
-    where convert :: ShellyHandler a -> S.ShellyHandler [a]
-          convert (ShellyHandler f) = S.ShellyHandler (unSh . f)
-
-------------------------------------------------------------
--- convert between Text and FilePath 
-
--- | see 'S.toTextWarn'
-toTextWarn :: FilePath -> Sh Text
-toTextWarn = sh1 S.toTextWarn
-
--------------------------------------------------------------
--- internal functions for writing extension 
-
-get :: Sh State
-get = sh0 S.get
-
-put :: State -> Sh ()
-put = sh1 S.put
-
---------------------------------------------------------
--- polyvariadic vodoo
-
--- | Converter for the variadic argument version of 'run' called 'cmd'.
-class ShellArg a where toTextArg :: a -> Text
-instance ShellArg Text     where toTextArg = id
-instance ShellArg FilePath where toTextArg = toTextIgnore
-
-
--- Voodoo to create the variadic function 'cmd'
-class ShellCommand t where
-    cmdAll :: FilePath -> [Text] -> t
-
-instance ShellCommand (Sh Text) where
-    cmdAll fp args = run fp args
-
-instance (s ~ Text, Show s) => ShellCommand (Sh s) where
-    cmdAll fp args = run fp args
-
--- note that Sh () actually doesn't work for its case (_<- cmd) when there is no type signature
-instance ShellCommand (Sh ()) where
-    cmdAll fp args = run_ fp args
-
-instance (ShellArg arg, ShellCommand result) => ShellCommand (arg -> result) where
-    cmdAll fp acc = \x -> cmdAll fp (acc ++ [toTextArg x])
-
--- | see 'S.cmd'
-cmd :: (ShellCommand result) => FilePath -> result
-cmd fp = cmdAll fp []
diff --git a/shelly/src/Shelly/Unix.hs b/shelly/src/Shelly/Unix.hs
deleted file mode 100644
--- a/shelly/src/Shelly/Unix.hs
+++ /dev/null
@@ -1,12 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-
--- | commands that only work on Unix
-module Shelly.Unix
-  ( kill
-  ) where
-
-import Shelly
-import qualified Data.Text as T
-
-kill :: Int -> Sh ()
-kill pid = run_ "kill" ["-15", T.pack $ show pid]
