Is 78 characters still a good option? Was: [Haskell-cafe]
breaking too long lines
ok at cs.otago.ac.nz
Mon Apr 27 00:16:57 EDT 2009
On 25 Apr 2009, at 8:59 pm, Miguel Mitrofanov wrote:
> Something like
> newtype MyCoolMonad = MyCoolMonad (FirstTransformer
> (SecondTransformer (ThirdTransformer Whatever))) deriving (Functor,
> Monad, FirstClass, SecondClass, ThirdClass, SomeOtherClass)
> Nobody would be really interested in "deriving" clause, because it
> basically says "derive everything possible". Therefore, it seems
> pointless to move it to another line.
For what it's worth, my personal Haskell style lines up
= C1 ...
| Cn ...
so I'd have this as
= MyCoolMonad (FirstTransformer (SecondTransformer
deriving (Functor, Monad, FirstClass, SecondClass, ThirdClass,
where the longest line is 86 columns.
I would regard putting the 'deriving' clause on the same line as
'newtype' as obfuscatory except perhaps in the most trivial case.
I wouldn't be at all happy with 86 columns, so I'd shrink it further.
But this is progress.
We've moved from "is a 200-column line reasonable"
to "is attaching an already long deriving clause to the end of the
previous line on the grounds that nobody will be interested in
good layout style or not, and why/why not?
I'll note there that the costs and benefits are, as usual,
asymmetric. Someone who already understands what this is
all about, in particular someone who knows what "everything
possible" is, will be helped by hiding irrelevant detail (if
this _is_ a way to hide it). Someone other than the author
may very well not know this, and this deriving clause may
even be the way that they learn it.
More information about the Haskell-Cafe