Remove leading carriage return in gql

This commit is contained in:
Eugen Wissner 2023-08-03 08:00:36 +02:00
parent 3ed7dcd401
commit 2fdf04f54a
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
3 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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