summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--graphql.cabal3
-rw-r--r--src/Language/GraphQL/TH.hs2
3 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b37a40b..e615468 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on
and this project adheres to
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
+## [Unreleased]
+### Fixed
+- `gql` removes not only leading `\n` but also `\r`.
+
## [1.2.0.1] - 2023-04-25
### Fixed
- Support hspec 2.11.
@@ -508,6 +512,7 @@ and this project adheres to
### Added
- Data types for the GraphQL language.
+[Unreleased]: https://git.caraus.tech/OSS/graphql/compare/v1.2.0.1...master
[1.2.0.1]: https://git.caraus.tech/OSS/graphql/compare/v1.2.0.0...v1.2.0.1
[1.2.0.0]: https://git.caraus.tech/OSS/graphql/compare/v1.1.0.0...v1.2.0.0
[1.1.0.0]: https://git.caraus.tech/OSS/graphql/compare/v1.0.3.0...v1.1.0.0
diff --git a/graphql.cabal b/graphql.cabal
index 72f81e4..bcf69af 100644
--- a/graphql.cabal
+++ b/graphql.cabal
@@ -21,7 +21,8 @@ extra-source-files:
CHANGELOG.md
README.md
tested-with:
- GHC == 9.2.5
+ GHC == 9.2.8,
+ GHC == 9.6.2
source-repository head
type: git
diff --git a/src/Language/GraphQL/TH.hs b/src/Language/GraphQL/TH.hs
index b6bc18c..8e1fcb3 100644
--- a/src/Language/GraphQL/TH.hs
+++ b/src/Language/GraphQL/TH.hs
@@ -21,7 +21,7 @@ stripIndentation code = reverse
indent count (' ' : xs) = indent (count - 1) xs
indent _ xs = xs
withoutLeadingNewlines = dropNewlines code
- dropNewlines = dropWhile (== '\n')
+ dropNewlines = dropWhile $ flip any ['\n', '\r'] . (==)
spaces = length $ takeWhile (== ' ') withoutLeadingNewlines
-- | Removes leading and trailing newlines. Indentation of the first line is