packages feed

scan 0.1.0.8 → 0.1.0.9

raw patch · 2 files changed

+21/−6 lines, 2 filesdep +parsec1

Dependencies added: parsec1

Files

scan.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.4 build-type:         Simple name:               scan-version:            0.1.0.8+version:            0.1.0.9 license:            BSD3 license-file:       doc/LICENSE category:           Development@@ -16,8 +16,16 @@ homepage:           http://projects.haskell.org/style-scanner stability:          experimental +flag parsec1+    Description: Use parsec1+    Default: False+ executable scan-    build-depends:      base < 5, parsec+    if flag(parsec1)+        build-depends: parsec1+    else+        build-depends: parsec+    build-depends:      base < 5     hs-source-dirs:     src     main-is:            scan.hs     other-modules:      Language.Haskell.Scanner
src/scan.hs view
@@ -22,6 +22,7 @@ import System.Environment import System.Console.GetOpt import System.Exit+import System.IO  import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Pos@@ -35,7 +36,7 @@  -- | the hard-coded version string. version :: String-version = "scan-0.1.0.8 http://projects.haskell.org/style-scanner/"+version = "scan-0.1.0.9 http://projects.haskell.org/style-scanner/"  data Flag =     Help@@ -170,12 +171,18 @@         putStrLn "missing file argument"         exitFailure +readByteFile :: FilePath -> IO String+readByteFile f = openBinaryFile f ReadMode >>= hGetContents++writeByteFile :: FilePath -> String -> IO ()+writeByteFile f = withBinaryFile f WriteMode . flip hPutStr+ {- | process a file. A first true arguments only shows diagnostics. A first false argument writes back a modified file, but only if there are modifications. -} process :: Maybe (FilePath, Maybe FilePath) -> Opts -> FilePath -> IO () process out opts f = do-  str <- readFile f+  str <- readByteFile f   let ls = lines str       wcsr = map (checkLine (lineLength opts) f) (zip [1 ..] ls)       wcs = map fst wcsr@@ -211,9 +218,9 @@           case mbak of             Nothing -> return ()             Just bak -> do-              writeFile bak str+              writeByteFile bak str               putStrLn $ "created backup file: " ++ bak-          writeFile ofile rstr+          writeByteFile ofile rstr           putStrLn $ "wrote file: " ++ ofile     Left err -> do       prDiags cs