packages feed

implicit-hie 0.1.2.4 → 0.1.2.5

raw patch · 3 files changed

+36/−27 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Hie.Cabal.Parser: optSkipToNextLine :: Indent -> Parser ()

Files

implicit-hie.cabal view
@@ -7,7 +7,7 @@ -- hash: b2b829a658e33ea328c725dea732391089d03ffd2a216d413a75d88aefa7c181  name:               implicit-hie-version:            0.1.2.4+version:            0.1.2.5 description:   Auto generate a stack or cabal multi component hie.yaml file 
src/Hie/Cabal/Parser.hs view
@@ -94,24 +94,29 @@ unqualName :: Parser Text unqualName = takeWhile1 (not . (\c -> isSpace c || c == ',')) --- | Skip spaces and if end of line is reached, skip it as well and require that--- next one starts with indent.------ Used for parsing fields.-optSkipToNextLine :: Indent -> Parser ()-optSkipToNextLine i = do-  skipMany $ satisfy (\c -> isSpace c && not (isEndOfLine c))-  skipMany $ skipSpace >> "--" >> takeTill isEndOfLine-  peekChar >>= \case-    Just c-      | isEndOfLine c ->-        endOfLine >> indent i $> ()-    _ -> pure ()- -- | Comma or space separated list, with optional new lines. parseList :: Indent -> Parser [Text]-parseList i = sepBy parseString (optSkipToNextLine i >> skipMany (char ',') >> optSkipToNextLine i) <|> pure []+parseList i = many (nl <|> sl)+  where+    sep = skipMany (char ',' <|> tabOrSpace)+    com = skipMany tabOrSpace >> "--" >> skipWhile (not . isEndOfLine)+    sl = do+      sep+      x <- parseString+      sep+      skipMany com+      pure x +    nl = do+      skipMany emptyOrComLine <|> endOfLine+      _ <- indent i+      sep+      skipMany com+      x <- parseString+      sep+      skipMany com+      pure x+ pathMain :: Indent -> [Text] -> Text -> [Text] -> [Text] -> Parser [Text] pathMain i p m o a =   (hsSourceDir i >>= (\p' -> pathMain i p' m o a))@@ -153,7 +158,7 @@ skipBlockLine i = (indent i >> skipToNextLine) <|> emptyOrComLine  emptyOrComLine :: Parser ()-emptyOrComLine = skipMany tabOrSpace >> endOfLine <|> comment+emptyOrComLine = (skipMany tabOrSpace >> endOfLine) <|> comment  tabOrSpace :: Parser Char tabOrSpace = char ' ' <|> char '\t'@@ -171,9 +176,9 @@   do     i' <- indent i     _ <- asciiCI f-    skipSpace+    skipMany tabOrSpace     _ <- char ':'-    skipSpace+    skipMany tabOrSpace     p' <- p $ i' + 1     skipToNextLine     pure p'
test/Spec.hs view
@@ -94,19 +94,19 @@       ("foo\n  -- need to include this too\n  bar\n" :: Text) ~> parseList 1         `shouldParse` ["foo", "bar"]   describe "Should Succeed" $-    it "list with a comment" $+    it "list2 with a comment" $       ("foo  -- need to include this too\n  bar\n" :: Text) ~> parseList 1         `shouldParse` ["foo", "bar"]   describe "Should Succeed" $-    it "list with a comment" $+    it "list3 with a comment" $       ("foo  -- need to include this too\n  bar" :: Text) ~> parseList 1         `shouldParse` ["foo", "bar"]   describe "Should Succeed" $-    it "list with a comment" $+    it "list4 with a comment" $       ("foo\n bar\n  -- need to include this too" :: Text) ~> parseList 1         `shouldParse` ["foo", "bar"]   describe "Should Succeed" $-    it "list with a comment" $+    it "list5 with a comment" $       ("foo\n bar -- need to include this too" :: Text) ~> parseList 1         `shouldParse` ["foo", "bar"]   describe "Should Succeed" $@@ -121,9 +121,13 @@       ("other-modules: test\ndefault-language:   Haskell2011" :: Text) ~?> field 0 "other-modules" parseList         `leavesUnconsumed` "default-language:   Haskell2011"   describe "Should Succeed" $-    it "succesfully parses empty other-modules" $+    it "succesfully parses empty other-modules1" $       ("other-modules: test\ndefault-language:   Haskell2011" :: Text) ~?> field 0 "other-modules" parseList         `leavesUnconsumed` "default-language:   Haskell2011"+  describe "Should Succeed" $+    it "succesfully parses empty other-modules2" $+      ("    other-modules: \n    build-depends:\n        base >=4.9 && <5" :: Text) ~> field 0 "other-modules" parseList+        `shouldParse` []  exeSection :: Text exeSection =@@ -162,12 +166,12 @@   \  exposed-modules:\n\   \  Lib\n\   \  other-modules:\n\-  \  Paths_implicit_hie\n\+  \    Paths_implicit_hie\n\   \  hs-source-dirs:\n\-  \  src\n\+  \    src\n\   \  ghc-options: -fspecialize-aggressively -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns -fno-warn-unused-imports -fno-warn-unused-binds -fno-warn-name-shadowing -fwarn-redundant-constraints\n\   \  build-depends:\n\-  \  attoparsec\n\+  \    attoparsec\n\   \  , base >=4.7 && <5\n\   \  , text\n\   \  default-language: Haskell2010\n\