yjtools 0.9.7 → 0.9.9
raw patch · 3 files changed
+20/−12 lines, 3 filesdep −regexprdep ~base
Dependencies removed: regexpr
Dependency ranges changed: base
Files
- Control/Monad/Tools.hs +17/−2
- YJTools/Tribial.hs +1/−8
- yjtools.cabal +2/−2
Control/Monad/Tools.hs view
@@ -4,9 +4,13 @@ , unlessM , doWhile_ , doWhile+, doUntil_+, doUntil , for_ , for , filterM+, repeatM+, repeatM_ , skipRet ) where @@ -20,14 +24,19 @@ whenM p t = p >>= flip when t unlessM p e = p >>= flip unless e -doWhile_ :: Monad m => m Bool -> m ()+doWhile_, doUntil_ :: Monad m => m Bool -> m () doWhile_ act = do p <- act when p $ doWhile_ act+doUntil_ act = do p <- act+ unless p $ doUntil_ act -doWhile :: Monad m => a -> (a -> m (a, Bool)) -> m a+doWhile, doUntil :: Monad m => a -> (a -> m (a, Bool)) -> m a doWhile i act = do (r, p) <- act i if p then doWhile r act else return r+doUntil i act = do (r, p) <- act i+ if p then return r+ else doUntil r act for_ :: Monad m => a -> (a -> Bool) -> (a -> a) -> (a -> m b) -> m () for_ i test next act@@ -46,6 +55,12 @@ rs <- filterM p xs if b then return $ x:rs else return rs++repeatM :: Monad m => m a -> m [ a ]+repeatM = sequence . repeat++repeatM_ :: Monad m => m a -> m ()+repeatM_ = sequence_ . repeat skipRet :: Monad m => m b -> a -> m a skipRet p x = p >> return x
YJTools/Tribial.hs view
@@ -1,6 +1,6 @@ module YJTools.Tribial ( ghcMake-, updateFile+, updateFile_ ) where import System.IO (openFile, hClose, IOMode(WriteMode), hGetLine,@@ -13,7 +13,6 @@ import Control.Exception (bracket) import Control.Monad.Tools (ifM) import Control.Applicative ((<$>))-import Text.RegexPR (matchRegexPR) ghcMake :: String -> FilePath -> IO ExitCode ghcMake exe dir = do@@ -25,12 +24,6 @@ ExitSuccess -> return () _ -> readFile errFile >>= putStr return ret--updateFile :: (String, String) -> FilePath -> FilePath -> IO Bool-updateFile (cmtB, cmtE) src dst = do- let cmtOut = (cmtB ++) . ( ++ cmtE ++ "\n")- cmtIn = (>>= lookup 1) . fmap snd . matchRegexPR (cmtB ++ "(\\S+)" ++ cmtE)- updateFile_ cmtIn cmtOut src dst updateFile_ :: (String -> Maybe String) -> (FilePath -> String) -> FilePath -> FilePath -> IO Bool updateFile_ gtSrc hdr src dst
yjtools.cabal view
@@ -1,5 +1,5 @@ Name: yjtools-Version: 0.9.7+Version: 0.9.9 Cabal-Version: >= 1.2 Build-Type: Simple License: LGPL@@ -18,5 +18,5 @@ Extra-Tmp-Files: Library- Build-Depends: base, process, directory, old-time, regexpr+ Build-Depends: base<=4.2.0.2, process, directory, old-time Exposed-Modules: Control.Monad.Tools, Control.Applicative.Tools, Data.List.Tools, Data.Function.Tools YJTools.Tribial System.Directory.Tools, Data.Bool.Tools