require 0.3.2 → 0.4.0
raw patch · 3 files changed
+16/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- library/Require.hs +13/−2
- package.yaml +1/−1
- require.cabal +2/−2
library/Require.hs view
@@ -77,9 +77,9 @@ transform' :: Bool -> FileName -> Text -> Text -> Text transform' shouldPrepend filename prepended input = Text.lines input+ & filter (\t -> not $ "autorequire" `Text.isPrefixOf` t) & zip [1..] >>= prependAfterModuleLine- & filter (\(_, t) -> not $ "autorequire" `Text.isPrefixOf` t) <&> (\(ln, text) -> maybe (lineTag filename (LineNumber ln) <> text <> "\n") (renderImport filename (LineNumber ln)) $ Megaparsec.parseMaybe requireParser text ) & Text.concat where@@ -87,7 +87,18 @@ | shouldPrepend = zip (repeat ln) (Text.lines prepended) | otherwise = [] prependAfterModuleLine (ln, text)- | "where" `Text.isInfixOf` text = (ln, text) : enumeratedPrepend (ln)+ | ("module" `Text.isPrefixOf` text)+ && ("where" `Text.isSuffixOf`) text = (ln, text) : enumeratedPrepend ln+ | ("instance" `Text.isPrefixOf` text)+ && ("where" `Text.isSuffixOf`) text = [(ln, text)]+ | ("data" `Text.isPrefixOf` text)+ && ("where" `Text.isSuffixOf`) text = [(ln, text)]+ | ("class" `Text.isPrefixOf` text)+ && ("where" `Text.isSuffixOf`) text = [(ln, text)]+ | (not $ "instance" `Text.isPrefixOf` text)+ && (not $ "class" `Text.isPrefixOf` text)+ && (not $ "data" `Text.isPrefixOf` text)+ && ("where" `Text.isPrefixOf`) text = (ln, text) : enumeratedPrepend (ln) | otherwise = [(ln, text)] lineTag :: FileName -> LineNumber -> Text
package.yaml view
@@ -1,5 +1,5 @@ name: require-version: '0.3.2'+version: '0.4.0' github: "theam/require" license: Apache-2.0 author: "The Agile Monkeys"
require.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 6b852da4ce674b61b22cb631128b49f5bf0b519a9469f54be7372deb92dbf099+-- hash: 8f222d0ce5d76ff45c88779da37cb9591e547d814faa2c17ac9f171f536c61d6 name: require-version: 0.3.2+version: 0.4.0 synopsis: Scrap your qualified import clutter description: See <https://theam.github.io/require> category: Other