Skip to content

Commit

Permalink
Merge pull request #191 from haskell-works/hlint-update
Browse files Browse the repository at this point in the history
HLint update
  • Loading branch information
newhoggy authored Oct 17, 2020
2 parents d87c6dc + 9932de8 commit 8fb85c6
Show file tree
Hide file tree
Showing 21 changed files with 108 additions and 82 deletions.
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,12 @@ workflows:
cabal-build-extra: --write-ghc-environment-files=ghc8.4.4+
cabal-test-extra: --test-show-details=direct --test-options='+RTS -g1'

- haskell/build-with-binary-cache:
name: GHC 8.10.2
executor: haskell/ghc-8_10_2
context: haskell-ci
binary-cache-uri: ${BINARY_CACHE_URI-"http://hw-binary-cache-us-west-2-a.s3-website-us-west-2.amazonaws.com/archive"}
cabal-build-extra: --write-ghc-environment-files=ghc8.4.4+
cabal-test-extra: --test-show-details=direct --test-options='+RTS -g1'

- merge-point/merge-point:
name: Build Ok
requires:
- GHC 8.4.4
- GHC 8.6.5
- GHC 8.8.3
- GHC 8.10.2

- github/release-cabal:
name: GitHub Release
Expand Down
98 changes: 75 additions & 23 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,85 @@
# This is a basic workflow to help you get started with Actions
name: Haskell

name: CI
defaults:
run:
shell: bash

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
ghc: ["8.8.4", "8.6.5", "8.8.3", "8.10.2"]
os: [ubuntu-latest]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}

- name: Configure
run: cabal configure --write-ghc-environment-files=ghc8.4.4+

- name: Restore cabal cache
uses: haskell-works/cabal-cache-action@v1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
with:
args: |
sync-from-archive \
--threads "$BINARY_CACHE_THREADS" \
--archive-uri "$BINARY_CACHE_URI" \
--region "$BINARY_CACHE_REGION" \
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
- name: Build
run: cabal build all

- name: Save cabal cache
uses: haskell-works/cabal-cache-action@v1
if: ${{ always() }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
with:
args: |
sync-to-archive \
--threads "$BINARY_CACHE_THREADS" \
--archive-uri "$BINARY_CACHE_URI" \
--region "$BINARY_CACHE_REGION" \
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
- name: Build
run: cabal test all --test-show-details=direct

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
- name: Save cabal cache
uses: haskell-works/cabal-cache-action@v1
if: ${{ always() }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
with:
args: |
sync-to-archive \
--threads "$BINARY_CACHE_THREADS" \
--archive-uri "$BINARY_CACHE_URI" \
--region "$BINARY_CACHE_REGION" \
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
2 changes: 2 additions & 0 deletions app/App/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import App.Commands.CreateIndex
import App.Commands.Demo
import Options.Applicative

{- HLINT ignore "Monoid law, left identity" -}

commands :: Parser (IO ())
commands = commandsGeneral

Expand Down
5 changes: 1 addition & 4 deletions app/App/Commands/Count.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as JCF
import qualified System.IO.MMap as IO

siblings :: GenericCursor BSI.ByteString CsPoppy1 (RM.RangeMin CsPoppy1) -> [GenericCursor BSI.ByteString CsPoppy1 (RM.RangeMin CsPoppy1)]
siblings c = c:cs
where cs = case nextSibling c of
Just d -> siblings d
Nothing -> []
siblings c = c:maybe [] siblings (nextSibling c)

runCount :: Z.CountOptions -> IO ()
runCount opts = do
Expand Down
4 changes: 2 additions & 2 deletions app/App/Commands/CreateIndex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import qualified System.Exit
import qualified System.IO as IO
import qualified System.IO.MMap as IO

{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant do" -}

runCreateIndexStandard :: Z.CreateIndexOptions -> IO ()
runCreateIndexStandard opts = do
Expand Down
2 changes: 2 additions & 0 deletions app/App/Commands/Demo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import qualified Options.Applicative as OA
import qualified System.IO as IO
import qualified System.IO.MMap as IO

{- HLINT ignore "Reduce duplication" -}

runDemo :: Z.DemoOptions -> IO ()
runDemo opts = do
let filePath = opts ^. the @"filePath"
Expand Down
2 changes: 1 addition & 1 deletion bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import Criterion.Main

main :: IO ()
main = do
benchmarks <- fmap mconcat $ sequence $ mempty
benchmarks <- mconcat <$> sequence mempty
defaultMain benchmarks
2 changes: 2 additions & 0 deletions examples/Example4.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import HaskellWorks.Data.MQuery.Micro

import qualified Data.DList as DL

{- HLINT ignore "Reduce duplication" -}

example :: IO ()
example = do
!cursor <- loadPartial "corpus/bench/78mb.json"
Expand Down
3 changes: 1 addition & 2 deletions src/HaskellWorks/Data/Json/FromValue.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}

module HaskellWorks.Data.Json.FromValue where

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeSynonymInstances #-}

module HaskellWorks.Data.Json.Internal.Standard.Token.Tokenize
( IsChar(..)
Expand All @@ -25,6 +24,8 @@ import qualified Data.Attoparsec.Types as T
import qualified Data.ByteString as BS
import qualified HaskellWorks.Data.Parser as P

{- HLINT ignore "Reduce duplication" -}

hexDigitNumeric :: P.Parser t u => T.Parser t Int
hexDigitNumeric = do
c <- P.satisfyChar (\c -> '0' <= c && c <= '9')
Expand Down
1 change: 0 additions & 1 deletion src/HaskellWorks/Data/Json/Internal/Value.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
1 change: 0 additions & 1 deletion src/HaskellWorks/Data/Json/PartialValue.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
1 change: 0 additions & 1 deletion src/HaskellWorks/Data/Json/Query.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
1 change: 0 additions & 1 deletion src/HaskellWorks/Data/Json/Value.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
8 changes: 3 additions & 5 deletions test/HaskellWorks/Data/Json/LightJsonSpec.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -36,9 +34,9 @@ import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as FAST
import qualified HaskellWorks.Data.Json.Standard.Cursor.Slow as SLOW
import qualified HaskellWorks.Data.TreeCursor as TC

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant bracket" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant do" -}

fc = TC.firstChild
ns = TC.nextSibling
Expand Down
8 changes: 3 additions & 5 deletions test/HaskellWorks/Data/Json/Simple/CursorSpec.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -24,9 +22,9 @@ import qualified HaskellWorks.Data.Json.Simple.Cursor.Fast as FAST
import qualified HaskellWorks.Data.Json.Simple.Value as V
import qualified HaskellWorks.Data.TreeCursor as TC

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant bracket" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant do" -}

fc = TC.firstChild
ns = TC.nextSibling
Expand Down
8 changes: 3 additions & 5 deletions test/HaskellWorks/Data/Json/Standard/CursorSpec.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -17,9 +15,9 @@ import Test.Hspec
import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as FAST
import qualified HaskellWorks.Data.Json.Standard.Cursor.Slow as SLOW

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant bracket" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant do" -}

spec :: Spec
spec = describe "HaskellWorks.Data.Json.Succinct.CursorSpec" $ do
Expand Down
8 changes: 3 additions & 5 deletions test/HaskellWorks/Data/Json/Standard/GenCursorTest.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -28,9 +26,9 @@ import Test.Hspec
import qualified Data.ByteString as BS
import qualified HaskellWorks.Data.TreeCursor as TC

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant bracket" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant do" -}

fc = TC.firstChild
ns = TC.nextSibling
Expand Down
2 changes: 1 addition & 1 deletion test/HaskellWorks/Data/Json/Token/TokenizeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Test.Hspec

import qualified Data.Attoparsec.ByteString.Char8 as BC

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{- HLINT ignore "Redundant do" -}

parseJsonToken' :: ByteString -> Either String (JsonToken String Double)
parseJsonToken' = BC.parseOnly parseJsonToken
Expand Down
14 changes: 4 additions & 10 deletions test/HaskellWorks/Data/Json/TypeSpec.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -28,9 +26,9 @@ import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as FAST
import qualified HaskellWorks.Data.Json.Standard.Cursor.Slow as SLOW
import qualified HaskellWorks.Data.TreeCursor as TC

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant bracket" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant do" -}

fc = TC.firstChild
ns = TC.nextSibling
Expand All @@ -41,11 +39,7 @@ spec = describe "HaskellWorks.Data.Json.Succinct.CursorSpec" $ do
genSpec "CsPoppy" FAST.fromString

genSpec :: forall t u.
( Eq t
, Show t
, Select1 t
, Eq u
, Show u
( Select1 t
, Rank0 u
, Rank1 u
, BalancedParens u
Expand Down
8 changes: 3 additions & 5 deletions test/HaskellWorks/Data/Json/ValueSpec.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -30,9 +28,9 @@ import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as FAST
import qualified HaskellWorks.Data.Json.Standard.Cursor.Slow as SLOW
import qualified HaskellWorks.Data.TreeCursor as TC

{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
{-# ANN module ("HLint: ignore Redundant bracket" :: String) #-}
{- HLINT ignore "Reduce duplication" -}
{- HLINT ignore "Redundant bracket" -}
{- HLINT ignore "Redundant do" -}

fc = TC.firstChild
ns = TC.nextSibling
Expand Down

0 comments on commit 8fb85c6

Please sign in to comment.