brittany
brittany copied to clipboard
Undesired(?) extra spacing around a '.' in a type signature
Should this space be added? It's not a style I think I've seen before.
runTest
:: Predicate a
-- ^ The predicate to check
- -> (forall t. ConcST t a)
+ -> (forall t . ConcST t a)
-- ^ The computation to test
-> Result a
runTest test conc = runST (runTestM test conc)
Ah, this seems like a nice purely stylistic question :) and I have no strong opinion on this really. My preference leans towards the current behaviour, but the reasoning is weak. I think the strongest argument is the consistency with "=>" and "->" which might be considered higher-precedence operators inside the type signature, but forall is syntax already, so: I am not opposed to changing the default here, generally.
A quick grep analysis in the ghc-7.10.3 bootlibs looks like this:
> grep "forall[^.]*[^ ]\." -r bootlibs | wc -l
328
> grep "forall[^.]* \." -r bootlibs | wc -l
266
(so 328 without, 266 with space). For some somewhat older stackage snapshot, it looks more in favour of omitting the space:
> grep "forall[^.]*[^ ]\." stackage-snapshot | wc -l
5175
> grep "forall[^.]* \." -r stackage-snapshot | wc -l
1447
Two question:
-
How about the "forall" in existentials? would you prefer
data Foo = forall x. X x => Foo xas well? -
The multi-line version is fine? E.g.
restartingModuleNetwork
:: forall t m
. (RH.MonadAppHost t m, R.Reflex t, MonadIO (R.PushM t))
=> [ModuleStatic]
-> Trigger ModuleEvent
-> R.Event t ModuleEvent
-> m
( R.Dynamic t (Map ModuleId ModuleState)
, R.Event t (ProcessScript ())
)
And of course it is trivial to make this configurable (although i doubt that many would bother to change the default).
I prefer keeping the dot with the type variables, because unlike => and -> it's not conceptually a type-level operator. This would make the multi-line version :: forall t m. as well.
Please keep the space. With DependentHaskell we will have both forall t m . and forall t m ->. If we want the space for the arrow, we should keep it for the dot.
I'm in favor of keeping the space. It's not clear to me if we can reach a consensus or if this should be configurable.