Skip to content

A peer-to-peer stack for code collaboration

hlint

Julian K. Arni57f59ffc3681
diff --git a/.circleci/config.yml b/.circleci/config.yml
index f4ac73e..ccec849 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -11,13 +11,19 @@ jobs:
# If an exact match is unavailable, use the most recent one
- stack-work-v1-
paths:
- - ~/.stack
+ - ~/.stack
- run:
name: Build
command: stack build --pedantic --no-terminal --fast
- run:
name: Test
command: stack test --pedantic --no-terminal --fast
+ - run:
+ name: Install hlint
+ command: stack install hlint
+ - run:
+ name: Run hlint
+ command: hlint .
- save_cache:
key: stack-work-v1-{{ checksum "stack.yaml" }}-{{ checksum "package.yaml" }}
paths:
diff --git a/.hlint.yaml b/.hlint.yaml
index 920a1a0..f518ff6 100644
--- a/.hlint.yaml
+++ b/.hlint.yaml
@@ -22,12 +22,11 @@
- warn: {lhs: return, rhs: pure}
- warn: {lhs: ap, rhs: (<*>)}
-- ignore: {name: Use map, within: [Crypto.Data.Auth.Tree.Proof]}
+- ignore: {name: Use String, within: [Radicle.Internal.Parse]}
- ignore: {name: Use ++}
- ignore: {name: Use &&}
- ignore: {name: Eta reduce}
- ignore: {name: Use lambda-case}
-- ignore: {name: Use let}
-- ignore: {name: Use newtype instead of data}
- ignore: {name: Redundant $}
+- ignore: {name: Redundant do}
diff --git a/src/Radicle/Internal/Core.hs b/src/Radicle/Internal/Core.hs
index a7d978c..07c539a 100644
--- a/src/Radicle/Internal/Core.hs
+++ b/src/Radicle/Internal/Core.hs
@@ -8,6 +8,7 @@ import Control.Monad.State
import Data.Bifunctor (first)
import Data.Data ((:~:)(Refl), Data, cast, eqT)
import Data.Generics (everywhereM)
+import Data.List (foldl')
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Scientific (Scientific)
@@ -199,7 +200,7 @@ purePrimops = Map.fromList $ first Ident <$>
[_, _] -> throwError $ TypeError ">: expecting number"
xs -> throwError $ WrongNumberOfArgs ">" 2 (length xs))
, ("foldl", evalArgs $ \args -> case args of
- [fn, init', List ls] -> eval $ foldl (\b a -> (fn $$) [b,a]) init' ls
+ [fn, init', List ls] -> eval $ foldl' (\b a -> (fn $$) [b,a]) init' ls
[_, _, _] -> throwError $ TypeError "foldl: third argument should be a list"
xs -> throwError $ WrongNumberOfArgs "foldl" 3 (length xs))
, ("foldr", evalArgs $ \args -> case args of
@@ -250,7 +251,7 @@ purePrimops = Map.fromList $ first Ident <$>
numBinop :: (Scientific -> Scientific -> Scientific)
-> Text
- -> (Text, ([Value] -> Lang m Value))
+ -> (Text, [Value] -> Lang m Value)
numBinop fn name = (name, evalArgs $ \args -> case args of
Number x:x':xs -> foldM go (Number x) (x':xs)
where