aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-04-02 14:48:53 +0100
committerYann Herklotz <git@ymhg.org>2019-04-02 14:48:53 +0100
commit1ef0455ddad821c2ddf64d451e99b8b5508c39c5 (patch)
tree38d16266885732d524781ebd31658a50f0bedf4e
parent372bcb00204d225f4b89cfed33f99a519740dc8e (diff)
downloadverismith-1ef0455ddad821c2ddf64d451e99b8b5508c39c5.tar.gz
verismith-1ef0455ddad821c2ddf64d451e99b8b5508c39c5.zip
Fix hlint hints
-rw-r--r--src/VeriFuzz/Config.hs2
-rw-r--r--src/VeriFuzz/Parser/Parser.hs13
-rw-r--r--test/Property.hs4
3 files changed, 10 insertions, 9 deletions
diff --git a/src/VeriFuzz/Config.hs b/src/VeriFuzz/Config.hs
index b135c55..eefebe2 100644
--- a/src/VeriFuzz/Config.hs
+++ b/src/VeriFuzz/Config.hs
@@ -130,7 +130,7 @@ parseConfig t = case Toml.decode configCodec t of
Left (Toml.ParseError _) -> error "Config file parse error"
configEncode :: Config -> Text
-configEncode c = Toml.encode configCodec c
+configEncode = Toml.encode configCodec
configToFile :: FilePath -> Config -> IO ()
configToFile f = T.writeFile f . configEncode
diff --git a/src/VeriFuzz/Parser/Parser.hs b/src/VeriFuzz/Parser/Parser.hs
index d7dc4ee..48e92ec 100644
--- a/src/VeriFuzz/Parser/Parser.hs
+++ b/src/VeriFuzz/Parser/Parser.hs
@@ -23,6 +23,7 @@ module VeriFuzz.Parser.Parser
where
import Control.Lens
+import Control.Monad (void)
import Data.Functor (($>))
import Data.Functor.Identity (Identity)
import qualified Data.Text as T
@@ -75,7 +76,7 @@ tok t = satisfy (\(Token t' _ _) -> t' == t) <?> show t
-- | Parse without returning the `TokenName`.
tok' :: TokenName -> Parser ()
-tok' p = tok p >> return ()
+tok' p = void $ tok p
parens :: Parser a -> Parser a
parens = between (tok SymParenL) (tok SymParenR)
@@ -217,17 +218,17 @@ number :: Parser Decimal
number = number' <$> numLit
where
number' :: String -> Decimal
- number' a | all (flip elem ['0' .. '9']) a = fromInteger $ read a
+ number' a | all (`elem` ['0' .. '9']) a = fromInteger $ read a
| head a == '\'' = fromInteger $ f a
- | isInfixOf "'" a = Decimal (read w) (f b)
+ | "'" `isInfixOf` a = Decimal (read w) (f b)
| otherwise = error $ "Invalid number format: " ++ a
where
w = takeWhile (/= '\'') a
b = dropWhile (/= '\'') a
f a'
- | isPrefixOf "'d" a' = read $ drop 2 a'
- | isPrefixOf "'h" a' = read $ "0x" ++ drop 2 a'
- | isPrefixOf "'b" a' = foldl
+ | "'d" `isPrefixOf` a' = read $ drop 2 a'
+ | "'h" `isPrefixOf` a' = read $ "0x" ++ drop 2 a'
+ | "'b" `isPrefixOf` a' = foldl
(\n b' -> shiftL n 1 .|. (if b' == '1' then 1 else 0))
0
(drop 2 a')
diff --git a/test/Property.hs b/test/Property.hs
index e948069..be8132b 100644
--- a/test/Property.hs
+++ b/test/Property.hs
@@ -48,10 +48,10 @@ parserIdempotent' = Hog.property $ do
. alexScanTokens
parserInput :: TestTree
-parserInput = testProperty "parser input" $ parserInput'
+parserInput = testProperty "parser input" parserInput'
parserIdempotent :: TestTree
-parserIdempotent = testProperty "parser idempotence" $ parserIdempotent'
+parserIdempotent = testProperty "parser idempotence" parserIdempotent'
propertyTests :: TestTree
propertyTests =