packages feed

chs-deps 0.1.0.0 → 0.1.0.1

raw patch · 6 files changed

+29/−35 lines, 6 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Language.Haskell.CHs.Deps: instance GHC.Classes.Ord Language.Haskell.CHs.Deps.AlexPosn

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # chs-deps +## 0.1.0.1++  * More efficient?+ ## 0.1.0.0  Initial release
README.md view
@@ -10,4 +10,4 @@  It can be used with [shake](http://hackage.haskell.org/package/shake) or as part of a custom [Cabal](http://hackage.haskell.org/package/Cabal)-`Setup.hs`.+`Setup.hs`, with [chs-cabal](http://hackage.haskell.org/package/chs-cabal).
chs-deps.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               chs-deps-version:            0.1.0.0+version:            0.1.0.1 license:            BSD3 license-file:       LICENSE copyright:          Copyright: (c) 2019 Vanessa McHale@@ -13,7 +13,6 @@ category:           CHs, Development, StaticAnalysis build-type:         Simple data-files:         bench/data/Sample.chs-extra-source-files: stack.yaml extra-doc-files:     README.md     CHANGELOG.md@@ -34,8 +33,8 @@     ghc-options:      -Wall     build-depends:         base >=4.3 && <5,-        array -any,-        bytestring -any+        array,+        bytestring      if !flag(cross)         build-tool-depends: alex:alex >=3.1.5@@ -54,13 +53,13 @@     hs-source-dirs:   test     default-language: Haskell2010     other-extensions: OverloadedStrings-    ghc-options:      -threaded -rtsopts -with-rtsopts=-N -Wall+    ghc-options:      -threaded -rtsopts "-with-rtsopts=-N -K1K" -Wall     build-depends:-        base -any,-        chs-deps -any,-        tasty -any,+        base,+        chs-deps,+        tasty,         bytestring >=0.10.0.0,-        tasty-hunit -any+        tasty-hunit      if impl(ghc >=8.0)         ghc-options:@@ -75,10 +74,10 @@     main-is:          Bench.hs     hs-source-dirs:   bench     default-language: Haskell2010-    ghc-options:      -Wall+    ghc-options:      -Wall -rtsopts -with-rtsopts=-A5M     build-depends:-        base -any,-        chs-deps -any,+        base,+        chs-deps,         criterion >=1.0.0.0,         bytestring >=0.10.0.0 
src/Language/Haskell/CHs/Deps.x view
@@ -64,9 +64,9 @@ alexEOF :: Alex Token alexEOF = pure End --- | Given a 'BSL.ByteString' containing C2Hs, return a list of modules it @{\#import\#}@s.+-- | Given a 'BSL.ByteString' containing C2Hs, return a list of modules (as 'String's) it @{\#import\#}@s. getImports :: BSL.ByteString -> Either String [String]-getImports = fmap extractDeps . lexC+getImports = fmap snd.flip runAlex (loop O)  getFileImports :: FilePath -> IO (Either String [String]) getFileImports = fmap getImports . BSL.readFile@@ -99,19 +99,18 @@             let (AlexPn _ line col) = pos in                 alexError ("Error in nested comment at line " ++ show line ++ ", column " ++ show col) -extractDeps :: [Token] -> [String]-extractDeps []                   = []-extractDeps (Import:Module s:xs) = s : extractDeps xs-extractDeps (_:xs)               = extractDeps xs--lexC :: BSL.ByteString -> Either String [Token]-lexC = flip runAlex loop+data S = PostImport | O -loop :: Alex [Token]-loop = do+loop :: S -> Alex (S, [String])+loop st = do     tok' <- alexMonadScan     case tok' of-        End -> pure []-        _ -> (tok' :) <$> loop+        End -> pure (O,[])+        Import -> loop PostImport+        Module s -> case st of+            PostImport -> second (s:) <$> loop O+            _ -> loop O+  where+    second f ~(x,y) = (x,f y)  }
− stack.yaml
@@ -1,9 +0,0 @@-----resolver: lts-14.7-ghc-options: {"$locals": -ddump-to-file -ddump-hi}-packages:-  - '.'-  - chs-cabal-extra-deps:-  - Cabal-3.0.0.0@sha256:1ba37b8d80e89213b17db7b8b9ea0108da55ca65f8c0cbb7433881a284c5cf67,26027-extra-package-dbs: []
test/Tasty.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+ module Main ( main ) where  import           Language.Haskell.CHs.Deps