Overloaded labels (hash) syntax gets formatted with space after hash sign
Closed this issue · 2 comments
Describe the bug
Formatting a file that uses overloaded labels without declaring the OverloadedLabels
extension in the file, inserts a space after hash sign after formatting.
To Reproduce
Given this file:
{-# LANGUAGE DataKinds #-}
module Web.Controller.Posts where
import Data.Function ((&))
(|>) = (&)
validateField = undefined
nonEmpty = undefined
title = undefined
buildPost post =
post
|> validateField #title nonEmpty
Using ormolu sample.hs
to format it results in (note the extra space in # title
:
{-# LANGUAGE DataKinds #-}
module Web.Controller.Posts where
import Data.Function ((&))
(|>) = (&)
validateField = undefined
nonEmpty = undefined
title = undefined
buildPost post =
post
|> validateField
# title nonEmpty
Expected behavior
To behave as if the OverloadedLabels
was explicitly enabled in the file, thus producing this output:
{-# LANGUAGE DataKinds #-}
module Web.Controller.Posts where
import Data.Function ((&))
(|>) = (&)
validateField = undefined
nonEmpty = undefined
title = undefined
buildPost post =
post
|> validateField #title nonEmpty
Environment
- OS name + version:
Ubuntu 22.04.3 LTS
- Version of the code:
ormolu 0.7.2.0 using ghc-lib-parser 9.6.3.20231014
Additional context
This does not occur if the file has {-# LANGUAGE OverloadedLabels #-}
at the top, but it does when the extension is enabled via the *.cabal
file.
Can you post a concrete example of the folder structure (.cabal
file plus Haskell source file) which reproduces the problem?
Closing due to lack of activity. @zzantares, feel free to re-open. If you want us to look at this please provide a more complete example @amesgen asked for. For this kind of problem it is important how Cabal file is written and what package component your source file belongs to.