on master help sign in
Cleaned up code
91010d0iko
app/Main.hs−2
@@ -8,8 +8,6 @@ import Relude
8import Control.Hext.Arguments
8import Control.Hext.Arguments
9import Control.Hext.Config
9import Control.Hext.Config
10import Control.Hext.Processor
10import Control.Hext.Processor
11−import Data.Haskell.Parser
12−import Text.Megaparsec
13
11
14main :: IO ()
12main :: IO ()
15main = do
13main = do
src/Control/Hext/Config.hs+1−1
@@ -31,7 +31,7 @@ data LineLimit
31
31
32instance FromJSON LineLimit where
32instance FromJSON LineLimit where
33 parseJSON (A.Number n)
33 parseJSON (A.Number n)
34− | Right n' <- floatingOrInteger n
34+ | Right n' <- floatingOrInteger @Double n
35 , n' > 0
35 , n' > 0
36 = return $ Limited n'
36 = return $ Limited n'
37 parseJSON (A.String "none") = return Unlimited
37 parseJSON (A.String "none") = return Unlimited
src/Control/Hext/Processor.hs+4−4
@@ -27,8 +27,8 @@ getFiles dir = do
27 getHs (Dir name paths) | not $ "." `isPrefixOf` name = paths >>= getHs
27 getHs (Dir name paths) | not $ "." `isPrefixOf` name = paths >>= getHs
28 getHs _ = []
28 getHs _ = []
29
29
30−processFile :: Maybe LineLimit -> Text -> Text -> Text
30+processFile :: Text -> Text -> Text
31−processFile limit extensions file =
31+processFile extensions file =
32 extensions
32 extensions
33 <> "\n"
33 <> "\n"
34 <> withoutExtensions file
34 <> withoutExtensions file
@@ -40,11 +40,11 @@ baseLength :: Int
40baseLength = T.length $ wrapExtension ""
40baseLength = T.length $ wrapExtension ""
41
41
42processFiles :: Maybe LineLimit -> [Text] -> FilePath -> IO ()
42processFiles :: Maybe LineLimit -> [Text] -> FilePath -> IO ()
43−processFiles limit extensions dir = do
43+processFiles limit allExtensions dir = do
44 files <- getFiles dir
44 files <- getFiles dir
45 forM_ files $ \file -> do
45 forM_ files $ \file -> do
46 contents <- readFileText file
46 contents <- readFileText file
47− writeFileText file . processFile limit (wrapExtensions extensions) $ contents
47+ writeFileText file . processFile (wrapExtensions allExtensions) $ contents
48 where
48 where
49 wrapExtensions :: [Text] -> Text
49 wrapExtensions :: [Text] -> Text
50 wrapExtensions [] = ""
50 wrapExtensions [] = ""
src/Data/Haskell/Parser.hs+1−1
@@ -6,7 +6,7 @@ module Data.Haskell.Parser
6 , withoutExtensionsParser
6 , withoutExtensionsParser
7 ) where
7 ) where
8
8
9−import Relude hiding (some, many)
9+import Relude hiding (many, some)
10
10
11import Text.Megaparsec
11import Text.Megaparsec
12import Text.Megaparsec.Char
12import Text.Megaparsec.Char
stack.yaml+12
@@ -64,3 +64,15 @@ packages:
64#
64#
65# Allow a newer minor version of GHC than the snapshot specifies
65# Allow a newer minor version of GHC than the snapshot specifies
66# compiler-check: newer-minor
66# compiler-check: newer-minor
67+
68+ghc-options:
69+ "$locals":
70+ -Wall
71+ -Wincomplete-uni-patterns
72+ -Wincomplete-record-updates
73+ -Wmissing-exported-signatures
74+ -Wmissing-home-modules
75+ -Widentities
76+ -Wmissed-specialisations
77+ -Wall-missed-specialisations
78+ -Wno-unused-do-bind