Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

Felipe Lessa felipe.lessa at gmail.com
Sat Apr 25 11:08:00 EDT 2009


On Sat, Apr 25, 2009 at 10:34:05AM -0400, Xiao-Yong Jin wrote:
> You don't write lisp, do you?  Or probably it is just me.
> But I would prefer to write the line as
>
> newtype MyCoolMonad = MyCoolMonad (FirstTransformer
>                                    (SecondTransformer
>                                     (ThirdTransformer Whatever)))
>     deriving (Functor, Monad,
>               FirstClass, SecondClass, ThirdClass, SomeOtherClass)

Doubtlessly, this is better than a one-liner, and I don't write
lisp :).  However I'd change the deriving clause and write it as

newtype MyCoolMonad = MyCoolMonad (FirstTransformer
                                   (SecondTransformer
                                    (ThirdTransformer Whatever)))
                      deriving (Functor, Monad, FirstClass, SecondClass,
                                ThirdClass, SomeOtherClass)

I don't think deriving clauses are unimportant and I like to see
them.  Also, I don't mistake the transformers as different
parameters because of the parenthesis and because they're
transformers, reading their names gives you a clue of how they
may be used.  Whoever knows transformers expect to see this kind
of nesting.

--
Felipe.


More information about the Haskell-Cafe mailing list