[Haskell-cafe] Coding conventions for Haskell?

Evan Laforge qdunkan at gmail.com
Mon Sep 27 12:09:08 EDT 2010


> data Foo a b
>    = Foo      a
>    | Bar        b
>    | Foobar  a b
>      deriving (Eq, Ord)
>
> There, that looks good.

There is a trap if you do a similar thing with records:

data Foo = Foo
  { a :: Int
  , b :: Int
  }

If you use '-- |' style haddock it can't go on 'a'.  Since I tend to
want to put '-- |' on every field, I have to put the '{' on the
previous line.

As for other stuff, I don't like the vertical lining up thing.  It's
too much work to type in, causes too much realigning when the top line
changes, sometimes causes things to get too far right, and breaks
entirely with proportional fonts.  A plain indent as advocated above
avoids all those problems.


More information about the Haskell-Cafe mailing list