packages feed

hscrtmpl 1.0 → 1.1

raw patch · 3 files changed

+42/−4 lines, 3 filesdep +processsetup-changed

Dependencies added: process

Files

Setup.hs view
@@ -1,2 +1,10 @@+#! /usr/bin/env runhaskell++-- Copyright: 2013 Dino Morelli+-- License: BSD3 (see LICENSE)+-- Author: Dino Morelli <dino@ui3.info>+ import Distribution.Simple++ main = defaultMain
hscrtmpl.cabal view
@@ -1,5 +1,5 @@ name:                hscrtmpl-version:             1.0+version:             1.1 cabal-version:       >= 1.8 build-type:          Simple license:             BSD3@@ -22,4 +22,8 @@ -- you want to have a binary! executable           hscrtmpl    main-is:          hscrtmpl.hs-   build-depends:    base >= 3 && < 5, directory, old-locale, old-time+   build-depends:    base >= 3 && < 5,+                     directory,+                     old-locale,+                     old-time,+                     process
hscrtmpl.hs view
@@ -21,11 +21,11 @@     Dino Morelli <dino@ui3.info>    http://ui3.info/d/proj/hscrtmpl.html-   version: 1.0+   version: 1.1 -}  --import Control.Monad ( when, unless )---import System.Cmd+import System.Cmd import System.Directory --import System.Environment import System.Exit@@ -77,6 +77,32 @@ ok :: ExitCode -> Bool ok ExitSuccess = True ok _           = False+++{- Turn a Bool into an exit code+-}+toExitCode :: Bool -> ExitCode+toExitCode True  = ExitSuccess+toExitCode False = ExitFailure 1+++{- Exit with a success or failure code using a Bool+-}+exitBool :: Bool -> IO ()+exitBool = exitWith . toExitCode+++{- This is similar to the for/in/do/done construct in bash with an+   important difference. This action evaluates to ExitFailure 1 if+   *any* of the command executions fails. In bash you only get the+   exit code of the last one.+-}+forSystem :: [String] -> IO ExitCode+forSystem cs = do+   ecs <- mapM system cs+   return $ case all (== ExitSuccess) ecs of+      True  -> ExitSuccess+      False -> ExitFailure 1   {- Some common bash things and their Haskell counterparts: