mirror of
https://github.com/ilyakooo0/ormolu.git
synced 2024-10-27 03:28:33 +03:00
1b818c0064
Haskell strings can have "gaps", where any amount of whitespace between two backslashes are ignored. This allows writing multi-line strings. As an example, all strings below are the same: ``` "foobar" "foo\ \bar" "foo\ \bar" ``` When parsing a string literal, lexer usually produces two fields, one of them is the actual string user wrote as a 'SourceText', the other one is the sanitized version where gaps and other special characters removed. While printing the string, GHC's Outputable instance uses the 'SourceText' field, however since that text contains gaps as-is, we can not change the original indentation. In order to fix this, this commit splits the strings by the gaps and print each line separately applying the layout rules. Also, it applies the same logic to type-level strings. |
||
---|---|---|
.. | ||
declaration | ||
import | ||
module-header | ||
other |