LANGUAGE pragmas - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Asad Saeeduddin

I've noticed a lot of projects write their LANGUAGE pragmas:

{-# LANGUAGE Like #-}
{-# LANGUAGE This #-}

instead of

  , This

Is there a particular reason for doing it the former way, or am I reading too much into it?

Matt Peddie

I think it can make the diffs a bit tidier, as each line can be inserted or removed without modifying any others

Torsten Schmits

I can't speak to language pragmas since I just throw everything into default-extensions, but as a user of line-based editing paradigms I would say that uniformity is helpful :slight_smile: though I would be surprised that this was popular, since most haskell code I see looks like people go out of their ways to make it as inefficient to manipulate as possible :sweat_smile:

Alex Chapman

stylish-haskell defaults to the first style (vertical), and doesn't support the second at all. Its other two styles have multiple extensions per line. That's enough to stop me from switching right now, even though I like the suggested style.

Ben Kolera

Haha, stylish haskell is a huge offender for creating stupid merge conflicts and unnecessary changes. Unless you turn off all of the things that do any kind of vertical alignment. and just use it to order things. I used to love it, till I started getting PRs and merging lots of stylish haskell formatted code, lol.

Alex Chapman

Yeah, I think the worst is vertical alignment of imports, which I have turned off.

Ben Kolera

And alignment of records.

Sandy Maguire

multiple pragmas is better for stupid tooling as well

Sandy Maguire

i have a vim command that inserts a pragma as the top line of a file

Sandy Maguire

having to parse a pragma to find where is a good place to add one iff it already exists --- no bueno