Code style guide?

Jason Dagit dagitj at gmail.com
Tue Mar 19 18:49:22 CET 2013


On Tue, Mar 19, 2013 at 7:29 AM, Johan Tibell <johan.tibell at gmail.com>wrote:

> On Tue, Mar 19, 2013 at 6:35 AM, Duncan Coutts <
> duncan.coutts at googlemail.com> wrote:
>
>> Go for it!
>>
>> You'll also notice that the code uses different styles in different
>> places (because of different authors). We've not gone through and tidied
>> stuff up because we're lazy and because there never seems to be a good
>> time to do it (it causes conflicts with patches people are working on).
>>
>
> If you need to write a style guide, why not use
>
> https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
>
> as a starting point. It's widely used in the Haskell community nowadays
> (e.g. it's a common recommendation on IRC) and it's based on the coding
> style of Duncan, Bryan, and Don for the most part.
>

There are a few recommendations in that guide that I'm not a fan of. Below
are the main ones.

This looks wrong to me:
https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md#export-lists

Partly because my default indent distance is 2 spaces, but also because I
prefer the export list to be left aligned:
module Data.Set
(
  -- * The @Set@ type
  Set
, empty
, singleton

  -- * Querying
, member
) where

I suspect that style is more common in the community overall.

I'm not convinced that data types should have strict constructors by
default. I agree it's the right thing in many cases, but I don't know how I
feel about "strict by default" as a recommendation for beginners. It sounds
like we're encouraging a cargo cult to me. I think it's better to educate
people.

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/cabal-devel/attachments/20130319/4d5796c5/attachment.htm>


More information about the cabal-devel mailing list