3 ms·
Your syntax is incorrect, it should be data Profile = Profile { name :: T.Text , birthday :: Time.Day } deriving Show (You c
by nh2 3y ago
Your syntax is incorrect, it should be
data Profile =
Profile
{ name :: T.Text
, birthday :: Time.Day
} deriving Show
(You can't write `,` directly after `{`.)
This is also why the commas are _not_ like bullets, no matter how you format them. The first one is always special.
I agree that somebody should make a language extension that allows what the parent posts says.
Doing this does not need a language split / new frontend; this is what language extensions do very well. If they are popuplar, they become part of a new (de-facto) standard, such as GHC2021: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html#extension-GHC2021 https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/cont...
And there is precedent for this: There is one place where trailing commas for good diffability are already allowed: Module exports.
module MyModule (
fun1,
fun2,
main,
) where
Many language extensions exist to remove such "papercuts"; this looks like a good candidate.
- mjan22640 3y agoWhen breaking an expression into multiple lines, it is best to place an operator at the start of a line.
- poorlyknit 3y agoThe comment you're replying to refers to the fact that the usual proposal is a leading comma You're right that it's not valid Haskell but that wasn't the goal here.
- nh2 3y agoI understood "the usual proposal" as "how people usually propose to format current code when others complain about lack of trailing comma", not as a proposal for an actual change to the language.
- bradrn 3y agoGP is correct. I was mentioning this as a common proposal for syntax change (or, this being Haskell, a new extension). I did not mean to imply that this is current syntax, since of course it isn’t!