packages feed

require 0.4.2 → 0.4.3

raw patch · 4 files changed

+59/−36 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

library/Require.hs view
@@ -80,7 +80,8 @@   &   filter (\t -> not $ "autorequire" `Text.isPrefixOf` t)   &   zip [1..]   >>= prependAfterModuleLine-  <&> (\(ln, text) -> maybe (lineTag filename (LineNumber ln) <> text <> "\n") (renderImport filename (LineNumber ln)) $ Megaparsec.parseMaybe requireParser text )+  <&> (\(ln, text) -> maybe (text <> "\n") (renderImport filename (LineNumber ln)) $ Megaparsec.parseMaybe requireParser text)+  &   (lineTag filename (LineNumber 1) :)   &   Text.concat  where   enumeratedPrepend ln@@ -114,7 +115,7 @@ renderImport filename linenumber RequireInfo {..} =   case (Text.isInfixOf riFullModuleName (unFileName filename)) of     True  -> ""-    False -> lineTag filename linenumber <> typesImport <> lineTag filename linenumber <> qualifiedImport+    False -> typesImport <> lineTag filename linenumber <> qualifiedImport  where   types = maybe (Text.takeWhileEnd (/= '.') riFullModuleName) (Text.intercalate ",") riImportedTypes   typesImport = "import " <> riFullModuleName <> " (" <> types <> ")\n"@@ -137,9 +138,15 @@    types'  <- Megaparsec.option Nothing $ do     void $ Megaparsec.char '('-    t' <- Megaparsec.some (Megaparsec.alphaNumChar <|> Megaparsec.char ',' <|> Megaparsec.char ' ')+    t' <- Megaparsec.many (Megaparsec.alphaNumChar <|> Megaparsec.char ',' <|> Megaparsec.char ' ')     void $ Megaparsec.char ')'     return $ Just t'++  void $ Megaparsec.option Nothing $ do+    void $ Megaparsec.space+    void $ Megaparsec.some (Megaparsec.char '-')+    void $ Megaparsec.many (Megaparsec.alphaNumChar <|> Megaparsec.char ' ')+    return Nothing    return RequireInfo     { riFullModuleName = toText $ module'
package.yaml view
@@ -1,5 +1,5 @@ name: require-version: '0.4.2'+version: "0.4.3" github: "theam/require" license: Apache-2.0 author: "The Agile Monkeys"@@ -11,12 +11,12 @@ license-file: LICENSE.md  extra-source-files:-- CHANGELOG.md-- LICENSE.md-- package.yaml-- README.md-- stack.yaml-- Requires+  - CHANGELOG.md+  - LICENSE.md+  - package.yaml+  - README.md+  - stack.yaml+  - Requires  ghc-options: -Wall @@ -45,42 +45,42 @@     source-dirs: executable/Require/     main: Main.hs     dependencies:-    - require+      - require     ghc-options:-    - -rtsopts-    - -threaded-    - -with-rtsopts=-N+      - -rtsopts+      - -threaded+      - -with-rtsopts=-N   autorequirepp:     source-dirs: executable/AutoRequire/     main: Main.hs     dependencies:       - require     ghc-options:-    - -rtsopts-    - -threaded-    - -with-rtsopts=-N+      - -rtsopts+      - -threaded+      - -with-rtsopts=-N  benchmarks:   require-benchmarks:     source-dirs: benchmark     main: Main.hs     dependencies:-    - require-    - criterion+      - require+      - criterion     ghc-options:-    - -rtsopts-    - -threaded-    - -with-rtsopts=-N+      - -rtsopts+      - -threaded+      - -with-rtsopts=-N  tests:   require-test-suite:     source-dirs: test-suite     main: Main.hs     dependencies:-    - require-    - tasty-    - tasty-hspec+      - require+      - tasty+      - tasty-hspec     ghc-options:-    - -rtsopts-    - -threaded-    - -with-rtsopts=-N+      - -rtsopts+      - -threaded+      - -with-rtsopts=-N
require.cabal view
@@ -1,10 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.28.2.+cabal-version: 1.12
++-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: d137a452230c193641b2f17f7eaca960c2f427449f4d9c1197cfb30248c4c870+-- hash: b6f56fcb124b24c06d107d84591eb1a3d5581c86e84fdff75f098b7af8f5cf51+ name:           require-version:        0.4.2+version:        0.4.3 synopsis:       Scrap your qualified import clutter description:    See <https://theam.github.io/require> category:       Other@@ -16,14 +19,13 @@ license:        Apache-2.0 license-file:   LICENSE.md build-type:     Simple-cabal-version:  >= 1.10 extra-source-files:     CHANGELOG.md     LICENSE.md     package.yaml     README.md-    Requires     stack.yaml+    Requires  source-repository head   type: git
test-suite/Main.hs view
@@ -1,8 +1,8 @@-import Universum+import           Universum +import qualified Data.Text        as Text import qualified Test.Tasty-import Test.Tasty.Hspec-import qualified Data.Text as Text+import           Test.Tasty.Hspec  import qualified Require @@ -64,4 +64,18 @@     let actual = toString $ Require.transform False (Require.FileName "Foo.hs") "" input     actual `shouldContain`   expectedTypeImport     actual `shouldContain`   expectedQualifiedImport++  it "skips comments" $ do+    let input    = "require Data.Text -- test of comments"+    let expected = "import Data.Text (Text)"+    let actual   = Require.transform False (Require.FileName "Foo.hs") "" input+    expected `Text.isInfixOf` actual++  it "allows empty parentheses" $ do+    let input       = "require Data.Text ()"+    let expected1   = "import Data.Text ()"+    let expected2   = "import qualified Data.Text as Text"+    let actual      = lines $ Require.transform False (Require.FileName "Foo.hs") "" input+    actual `shouldSatisfy` elem expected1+    actual `shouldSatisfy` elem expected2