Skip to content

Commit a123c69

Browse files
committed
#37, do a better job at HLint clean
1 parent 361a5df commit a123c69

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
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, do a better job at HLint clean
34
0.2.9, released 2021-02-27
45
#37, make the output HLint clean
56
Don't add the OverloadedLabels extension

preprocessor/Edit.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ editAddPreamble o@xs
8686
prefix = "{-# LANGUAGE DuplicateRecordFields, DataKinds, FlexibleInstances, TypeApplications, FlexibleContexts, MultiParamTypeClasses, TypeFamilies, TypeOperators, GADTs, UndecidableInstances #-}\n" ++
8787
-- it's too hard to avoid generating excessive brackets, so just ignore the code
8888
-- only really applies to people using it through Haskell Language Server (see #37)
89-
"{- HLINT module ignore Redundant bracket -}"
89+
"{- HLINT ignore \"Redundant bracket\" -}"
9090
imports = "import qualified GHC.Records.Extra as Z"
9191
-- if you import two things that have preprocessor_unused, and export them as modules, you don't want them to clash
92-
trailing modName = "_recordDotPreprocessorUnused_" ++ uniq ++ " :: Z.HasField \"\" r a => r -> a;" ++
93-
"_recordDotPreprocessorUnused_" ++ uniq ++ " = Z.getField @\"\""
94-
where uniq = map (\x -> if isAlphaNum x then x else '_') $ concat $ take 19 $ takeWhile modPart $ map lexeme $ unparens modName
92+
trailing modName = "_recordDotPreprocessorUnused" ++ uniq ++ " :: Z.HasField \"\" r a => r -> a;" ++
93+
"_recordDotPreprocessorUnused" ++ uniq ++ " = Z.getField @\"\""
94+
where uniq = filter isAlphaNum $ concat $ take 19 $ takeWhile modPart $ map lexeme $ unparens modName
9595
modPart x = x == "." || all isUpper (take 1 x)
9696

9797

0 commit comments

Comments
 (0)