diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc9ca4..1244ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,14 @@ `shellmet` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. -0.0.0 -===== +## 0.0.1 — Apr 9, 2019 + +* Generalise the type of the `$?` operator to allow returning values on + shell-command failuires. + +## 0.0.0 * Initially created. [1]: https://pvp.haskell.org -[2]: https://github.com/kowainik/shellmet/releases \ No newline at end of file +[2]: https://github.com/kowainik/shellmet/releases diff --git a/shellmet.cabal b/shellmet.cabal index 3f704b3..3c13d9d 100644 --- a/shellmet.cabal +++ b/shellmet.cabal @@ -1,6 +1,6 @@ cabal-version: 2.0 name: shellmet -version: 0.0.0 +version: 0.0.1 synopsis: Out of the shell solution for scripting in Haskell description: Shellmet provides easy and convenient way to call shell commands from Haskell programs homepage: https://github.com/kowainik/shellmet diff --git a/src/Shellmet.hs b/src/Shellmet.hs index 09896a8..cb39d6d 100644 --- a/src/Shellmet.hs +++ b/src/Shellmet.hs @@ -56,7 +56,7 @@ infix 5 $| ($|) :: FilePath -> [Text] -> IO Text cmd $| args = T.strip . T.pack <$> readProcess cmd (map T.unpack args) "" -{- | Do some IO actions when processed failed with error. +{- | Do some IO actions when process failed with 'IOError'. >>> "exit" ["0"] $? putStrLn "Command failed" ⚙ exit 0 @@ -66,5 +66,5 @@ cmd $| args = T.strip . T.pack <$> readProcess cmd (map T.unpack args) "" Command failed -} infixl 4 $? -($?) :: IO () -> IO () -> IO () +($?) :: IO a -> IO a -> IO a action $? handler = action `catch` \(_ :: IOError) -> handler