Skip to content

Commit 167a275

Browse files
committed
Follow hlint suggestion: Use tuple-section
1 parent a97185c commit 167a275

File tree

22 files changed

+50
-30
lines changed

22 files changed

+50
-30
lines changed

.hlint.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@
5656
- ignore: {name: "Use record patterns"} # 16 hints
5757
- ignore: {name: "Use replicateM_"} # 2 hints
5858
- ignore: {name: "Use rights"} # 2 hints
59-
- ignore: {name: "Use tuple-section"} # 28 hints
6059
- ignore: {name: "Use typeRep"} # 2 hints
61-
- ignore: {name: "Use unless"} # 23 hints+++++++++
60+
- ignore: {name: "Use unless"} # 23 hints
6261
- ignore: {name: "Use unwords"} # 8 hints
6362
- ignore: {name: "Use void"} # 23 hints
6463

Cabal-syntax/src/Distribution/Compat/Lens.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE RankNTypes #-}
2+
{-# LANGUAGE TupleSections #-}
23

34
-- | This module provides very basic lens functionality, without extra dependencies.
45
--
@@ -154,7 +155,7 @@ lens sa sbt afb s = sbt s <$> afb (sa s)
154155
-------------------------------------------------------------------------------
155156

156157
_1 :: Lens (a, c) (b, c) a b
157-
_1 f (a, c) = flip (,) c <$> f a
158+
_1 f (a, c) = (,c) <$> f a
158159

159160
_2 :: Lens (c, a) (c, b) a b
160161
_2 f (c, a) = (,) c <$> f a

Cabal-syntax/src/Distribution/Types/Flag.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{-# LANGUAGE DeriveDataTypeable #-}
22
{-# LANGUAGE DeriveGeneric #-}
33
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4+
{-# LANGUAGE TupleSections #-}
45

56
module Distribution.Types.Flag
67
( -- * Package flag
@@ -170,7 +171,7 @@ mkFlagAssignment :: [(FlagName, Bool)] -> FlagAssignment
170171
mkFlagAssignment =
171172
FlagAssignment
172173
. Map.fromListWith (flip combineFlagValues)
173-
. fmap (fmap (\b -> (1, b)))
174+
. fmap (fmap (1,))
174175

175176
-- | Deconstruct a 'FlagAssignment' into a list of flag/value pairs.
176177
--

Cabal/src/Distribution/Backpack/ReadyComponent.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE PatternGuards #-}
2+
{-# LANGUAGE TupleSections #-}
23
{-# LANGUAGE TypeFamilies #-}
34

45
-- | See <https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst>
@@ -210,7 +211,7 @@ instance Functor InstM where
210211
in (f x, s')
211212

212213
instance Applicative InstM where
213-
pure a = InstM $ \s -> (a, s)
214+
pure a = InstM (a,)
214215
InstM f <*> InstM x = InstM $ \s ->
215216
let (f', s') = f s
216217
(x', s'') = x s'

Cabal/src/Distribution/PackageDescription/Check/Conditional.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE ScopedTypeVariables #-}
2+
{-# LANGUAGE TupleSections #-}
23

34
-- |
45
-- Module : Distribution.PackageDescription.Check.Conditional
@@ -245,7 +246,7 @@ checkDuplicateModules pkg =
245246
libMap =
246247
foldCondTree
247248
Map.empty
248-
(\(_, v) -> Map.fromListWith sumPair . map (\x -> (x, (1, 1))) $ getModules v)
249+
(\(_, v) -> Map.fromListWith sumPair . map (,(1, 1)) $ getModules v)
249250
(Map.unionWith mergePair) -- if a module may occur in nonexclusive branches count it twice strictly and once loosely.
250251
(Map.unionWith maxPair) -- a module occurs the max of times it might appear in exclusive branches
251252
t

Cabal/src/Distribution/Simple/Build.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ generateCode
616616
-> IO (SymbolicPath Pkg (Dir Source), [ModuleName.ModuleName])
617617
generateCode codeGens nm pdesc bi lbi clbi verbosity = do
618618
when (not . null $ codeGens) $ createDirectoryIfMissingVerbose verbosity True $ i tgtDir
619-
(\x -> (tgtDir, x)) . concat <$> mapM go codeGens
619+
(tgtDir,) . concat <$> mapM go codeGens
620620
where
621621
allLibs = (maybe id (:) $ library pdesc) (subLibraries pdesc)
622622
dependencyLibs = filter (const True) allLibs -- intersect with componentPackageDeps of clbi

Cabal/src/Distribution/Simple/BuildPaths.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{-# LANGUAGE DataKinds #-}
22
{-# LANGUAGE FlexibleContexts #-}
33
{-# LANGUAGE RankNTypes #-}
4+
{-# LANGUAGE TupleSections #-}
45

56
-----------------------------------------------------------------------------
67

@@ -321,7 +322,7 @@ getSourceFiles
321322
-> [ModuleName.ModuleName]
322323
-> IO [(ModuleName.ModuleName, SymbolicPathX allowAbsolute Pkg File)]
323324
getSourceFiles verbosity mbWorkDir dirs modules = for modules $ \m ->
324-
fmap ((,) m) $
325+
fmap (m,) $
325326
findFileCwdWithExtension
326327
mbWorkDir
327328
builtinHaskellSuffixes

Cabal/src/Distribution/Simple/BuildTarget.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{-# LANGUAGE DuplicateRecordFields #-}
44
{-# LANGUAGE FlexibleContexts #-}
55
{-# LANGUAGE RankNTypes #-}
6+
{-# LANGUAGE TupleSections #-}
67

78
-----------------------------------------------------------------------------
89

@@ -229,12 +230,12 @@ readUserBuildTarget targetstr =
229230

230231
tokens :: CabalParsing m => m (String, Maybe (String, Maybe String))
231232
tokens =
232-
(\s -> (s, Nothing)) <$> parsecHaskellString
233+
(,Nothing) <$> parsecHaskellString
233234
<|> (,) <$> token <*> P.optional (P.char ':' *> tokens2)
234235

235236
tokens2 :: CabalParsing m => m (String, Maybe String)
236237
tokens2 =
237-
(\s -> (s, Nothing)) <$> parsecHaskellString
238+
(,Nothing) <$> parsecHaskellString
238239
<|> (,) <$> token <*> P.optional (P.char ':' *> (parsecHaskellString <|> token))
239240

240241
token :: CabalParsing m => m String

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{-# LANGUAGE RankNTypes #-}
66
{-# LANGUAGE RecordWildCards #-}
77
{-# LANGUAGE ScopedTypeVariables #-}
8+
{-# LANGUAGE TupleSections #-}
89

910
-----------------------------------------------------------------------------
1011

@@ -1679,7 +1680,7 @@ configureDependencies
16791680
(failedDeps, allPkgDeps) =
16801681
partitionEithers $
16811682
concat
1682-
[ fmap (\s -> (dep, s)) <$> status
1683+
[ fmap (dep,) <$> status
16831684
| dep <- enabledBuildDepends pkg_descr enableSpec
16841685
, let status =
16851686
selectDependency

Cabal/src/Distribution/ZinzaPrelude.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE TupleSections #-}
2+
13
-- | A small prelude used in @zinza@ generated
24
-- template modules.
35
module Distribution.ZinzaPrelude
@@ -27,7 +29,7 @@ instance Functor Writer where
2729
fmap = liftM
2830

2931
instance Applicative Writer where
30-
pure x = W $ \ss -> (ss, x)
32+
pure x = W (,x)
3133
(<*>) = ap
3234

3335
instance Monad Writer where

0 commit comments

Comments
 (0)