packages feed

autoexporter 0.1.4 → 0.2.0

raw patch · 6 files changed

+18/−23 lines, 6 filesdep +Cabal

Dependencies added: Cabal

Files

README.md view
@@ -53,14 +53,6 @@  That will generate code like the first example. A couple caveats: --   Your source files must be rooted in a directory called `library`.--    -   I will happily accept patches that lift this restriction. This is good-        enough for my purposes now, but it's pretty bad in general. The hard-        part of this problem is knowing when to stop when converting a file-        path into a module name. For example, how can we reliably convert-        `/home/taylor/HSPackage/Data/Package.hs` into `Data.Package`?- -   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
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           autoexporter-version:        0.1.4+version:        0.2.0 synopsis:       Automatically re-export modules. description:    Autoexporter automatically re-exports modules. category:       Utility@@ -31,6 +31,7 @@   ghc-options: -Wall   build-depends:       base >=4.7 && <4.9+    , Cabal >=1.22 && <1.23     , directory >=1.2 && <1.3     , filepath >=1.3 && <1.5   exposed-modules:
executable/Main.hs view
@@ -1,4 +1,3 @@-import qualified Autoexporter+module Main (module Autoexporter) where -main :: IO ()-main = Autoexporter.main+import Autoexporter (main)
library/Autoexporter.hs view
@@ -1,6 +1,9 @@-module Autoexporter where+module Autoexporter (main) where  import qualified Data.List as List+import qualified Data.Maybe as Maybe+import qualified Distribution.ModuleName as ModuleName+import qualified Distribution.Text as Text import qualified System.Directory as Directory import qualified System.Environment as Environment import qualified System.FilePath as FilePath@@ -29,11 +32,10 @@                     ]             writeFile outputFile output         _ -> error ("unexpected arguments: " ++ show args)-  where-    makeModuleName :: FilePath -> String-    makeModuleName name =-        let path = FilePath.dropExtension name-            parts = FilePath.splitDirectories path-            -- TODO: Figure out a better way to get the actual module name.-            rest = tail (dropWhile (/= "library") parts)-        in  List.intercalate "." rest++makeModuleName :: FilePath -> String+makeModuleName name =+    let path = FilePath.dropExtension name+        parts = FilePath.splitDirectories path+        rest = reverse (takeWhile (\ x -> Maybe.isJust (Text.simpleParse x :: Maybe ModuleName.ModuleName)) (reverse parts))+    in  List.intercalate "." rest
package.yaml view
@@ -19,6 +19,7 @@ library:   dependencies:   - base >=4.7 && <4.9+  - Cabal >=1.22 && <1.23   - directory >=1.2 && <1.3   - filepath >=1.3 && <1.5   source-dirs: library@@ -26,4 +27,4 @@ maintainer: Taylor Fausak name: autoexporter synopsis: Automatically re-export modules.-version: '0.1.4'+version: '0.2.0'
stack.yaml view
@@ -1,3 +1,3 @@ install-ghc: true require-stack-version: ! '>=1.0.4'-resolver: lts-5.8+resolver: lts-5.12