packages feed

autoexporter 0.1.1 → 0.1.2

raw patch · 3 files changed

+17/−24 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -61,9 +61,6 @@         path into a module name. For example, how can we reliably convert         `/home/taylor/HSPackage/Data/Package.hs` into `Data.Package`? --   Absolutely nothing else can be in the source file. Autoexporter will blow-    up if it finds anything else.- -   Only immediate children will be re-exported. If you use this in some module     `M`, it won't pull in `M.A.B`. 
autoexporter.cabal view
@@ -1,5 +1,5 @@ name: autoexporter-version: 0.1.1+version: 0.1.2 cabal-version: >=1.10 build-type: Simple license: MIT
library/Autoexporter.hs view
@@ -10,28 +10,24 @@     args <- Environment.getArgs     case args of         [name, inputFile, outputFile] -> do-            input <- readFile inputFile-            case input of-                "{-# OPTIONS_GHC -F -pgmF autoexporter #-}\n" -> do-                    let moduleName = makeModuleName name+            let moduleName = makeModuleName name -                    let directory = FilePath.dropExtension inputFile-                    files <- Directory.getDirectoryContents directory-                    let haskellFiles = filter (\ f -> List.isSuffixOf ".hs" f || List.isSuffixOf ".lhs" f) files-                    let paths = map (directory FilePath.</>) haskellFiles-                    let modules = List.sort (map makeModuleName paths)-                    let exports = init (unlines (map (\ x -> "    module " ++ x ++ ",") modules))-                    let imports = init (unlines (map ("import " ++) modules))+            let directory = FilePath.dropExtension inputFile+            files <- Directory.getDirectoryContents directory+            let haskellFiles = filter (\ f -> List.isSuffixOf ".hs" f || List.isSuffixOf ".lhs" f) files+            let paths = map (directory FilePath.</>) haskellFiles+            let modules = List.sort (map makeModuleName paths)+            let exports = init (unlines (map (\ x -> "    module " ++ x ++ ",") modules))+            let imports = init (unlines (map ("import " ++) modules)) -                    let output = unlines-                            [ unwords ["module", moduleName, "("]-                            , exports-                            , ") where"-                            , ""-                            , imports-                            ]-                    writeFile outputFile output-                _ -> error ("unexpected input: " ++ show input)+            let output = unlines+                    [ unwords ["module", moduleName, "("]+                    , exports+                    , ") where"+                    , ""+                    , imports+                    ]+            writeFile outputFile output         _ -> error ("unexpected arguments: " ++ show args)   where     makeModuleName :: FilePath -> String