fourmolu / fourmolu

A fourk of ormolu that uses four space indentation and allows arbitrary configuration. Don't like it? PRs welcome!
https://fourmolu.github.io/
Other
356 stars 62 forks source link

The `single-constraint-parens` option doesn't seem to be respected #306

Closed tchoutri closed 1 year ago

tchoutri commented 1 year ago

I've disabled the single-constraint-parens option in my fourmolu.yaml file and yet it appears not to be taken into account:

git diff --staged
diff --git a/fourmolu.yaml b/fourmolu.yaml
index 59c6953..901d64b 100644
--- a/fourmolu.yaml
+++ b/fourmolu.yaml
@@ -8,3 +8,4 @@ haddock-style: multi-line-compact # '--' vs. '{-'
 newlines-between-decls: 1 # number of newlines between top-level declarations
 fixities: []
 function-arrows: leading
+single-constraint-parens: never
❯ fourmolu -q -i src/
❯ git diff
diff --git a/src/core/Flora/Environment/Config.hs b/src/core/Flora/Environment/Config.hs
index 6dffa1c..e181981 100644
--- a/src/core/Flora/Environment/Config.hs
+++ b/src/core/Flora/Environment/Config.hs
@@ -246,13 +246,13 @@ getAsset key = do
       pure $! AssetBundle{name, hash}

 -- Get the SHA256 hash of an asset bundle.
-getAssetHash :: IOE :> es => Text -> Eff es Text
+getAssetHash :: (IOE :> es) => Text -> Eff es Text
 getAssetHash hashedAssetPath = do
   let path = hashedAssetPath
   hashBundle path

 -- | Returns a base64-encoded sha256 hash of the file
-hashBundle :: IOE :> es => Text -> Eff es Text
+hashBundle :: (IOE :> es) => Text -> Eff es Text
 hashBundle path = do
   digest :: Digest SHA256 <- hashFile (Text.unpack path)
   pure . display . B64.encodeBase64 . BA.convert $! digest

Am I missing something obvious?

brandonchinn178 commented 1 year ago

That option hasn't been released yet. But the released version includes the Ormolu change that always enables it

tchoutri commented 1 year ago

@brandonchinn178 ah, hence my confusion! Because I was reading the README for main and I didn't realise the tuning option for Fourmolu had been released after the integration of the Ormolu option.

Not sure if I'm going to be the only one bitten by it, but the update by Dependabot of my CI checks was definitely surprising when I realised I couldn't turn it off. :)

brandonchinn178 commented 1 year ago

For sure. The Fourmolu Live PR moves the docs for the config options to a website that will say what version each config option was added in (including unreleased options), so this confusion will hopefully be prevented in the future.

jhrcek commented 1 year ago

Yesterday I was updating our codebase to 0.11 and this bit me as well. Would it make sense to have a CLI flag that would spit out "default config" (maybe with commented out variants for each flag) to stdout?

brandonchinn178 commented 1 year ago

@jhrcek Sure! Or maybe (following ghc's lead) fourmolu --info printing out the resolved config (defaults + config file)? Feel free to open a separate issue!