Skip to content

Commit 87c27fa

Browse files
committed
#37, make the output HLint clean
1 parent 57d849b commit 87c27fa

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Changelog for record-dot-preprocessor
22

3+
#37, make the output HLint clean
34
Don't add the OverloadedLabels extension
45
0.2.8, released 2021-02-21
56
Support GHC 9.0

preprocessor/Edit.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,14 @@ editAddPreamble o@xs
8383
where
8484
(blanks, rest) = span (isPL "") o
8585

86-
prefix = "{-# LANGUAGE DuplicateRecordFields, DataKinds, FlexibleInstances, TypeApplications, FlexibleContexts, MultiParamTypeClasses, TypeFamilies, TypeOperators, GADTs, UndecidableInstances #-}"
86+
prefix = "{-# LANGUAGE DuplicateRecordFields, DataKinds, FlexibleInstances, TypeApplications, FlexibleContexts, MultiParamTypeClasses, TypeFamilies, TypeOperators, GADTs, UndecidableInstances #-}\n" ++
87+
-- it's too hard to avoid generating excessive brackets, so just ignore the code
88+
-- only really applies to people using it through Haskell Language Server (see #37)
89+
"{- HLINT module ignore Redundant bracket -}"
8790
imports = "import qualified GHC.Records.Extra as Z"
8891
-- if you import two things that have preprocessor_unused, and export them as modules, you don't want them to clash
89-
trailing modName = "_preprocessor_unused_" ++ uniq ++ " :: Z.HasField \"\" r a => r -> a;" ++
90-
"_preprocessor_unused_" ++ uniq ++ " = Z.getField @\"\""
92+
trailing modName = "_recordDotPreprocessorUnused_" ++ uniq ++ " :: Z.HasField \"\" r a => r -> a;" ++
93+
"_recordDotPreprocessorUnused_" ++ uniq ++ " = Z.getField @\"\""
9194
where uniq = map (\x -> if isAlphaNum x then x else '_') $ concat $ take 19 $ takeWhile modPart $ map lexeme $ unparens modName
9295
modPart x = x == "." || all isUpper (take 1 x)
9396

0 commit comments

Comments
 (0)