record-dot-preprocessor 0.2.8 → 0.2.9
raw patch · 3 files changed
+10/−4 lines, 3 files
Files
- CHANGES.txt +3/−0
- preprocessor/Edit.hs +6/−3
- record-dot-preprocessor.cabal +1/−1
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for record-dot-preprocessor +0.2.9, released 2021-02-27+ #37, make the output HLint clean+ Don't add the OverloadedLabels extension 0.2.8, released 2021-02-21 Support GHC 9.0 #38, make the preprocessor avoid quasi quotes
preprocessor/Edit.hs view
@@ -83,11 +83,14 @@ where (blanks, rest) = span (isPL "") o - prefix = "{-# LANGUAGE DuplicateRecordFields, DataKinds, FlexibleInstances, TypeApplications, FlexibleContexts, MultiParamTypeClasses, OverloadedLabels, TypeFamilies, TypeOperators, GADTs, UndecidableInstances #-}"+ prefix = "{-# LANGUAGE DuplicateRecordFields, DataKinds, FlexibleInstances, TypeApplications, FlexibleContexts, MultiParamTypeClasses, TypeFamilies, TypeOperators, GADTs, UndecidableInstances #-}\n" +++ -- it's too hard to avoid generating excessive brackets, so just ignore the code+ -- only really applies to people using it through Haskell Language Server (see #37)+ "{- HLINT module ignore Redundant bracket -}" imports = "import qualified GHC.Records.Extra as Z" -- if you import two things that have preprocessor_unused, and export them as modules, you don't want them to clash- trailing modName = "_preprocessor_unused_" ++ uniq ++ " :: Z.HasField \"\" r a => r -> a;" ++- "_preprocessor_unused_" ++ uniq ++ " = Z.getField @\"\""+ trailing modName = "_recordDotPreprocessorUnused_" ++ uniq ++ " :: Z.HasField \"\" r a => r -> a;" +++ "_recordDotPreprocessorUnused_" ++ uniq ++ " = Z.getField @\"\"" where uniq = map (\x -> if isAlphaNum x then x else '_') $ concat $ take 19 $ takeWhile modPart $ map lexeme $ unparens modName modPart x = x == "." || all isUpper (take 1 x)
record-dot-preprocessor.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: record-dot-preprocessor-version: 0.2.8+version: 0.2.9 license: BSD3 x-license: BSD-3-Clause OR Apache-2.0 license-file: LICENSE