On Tue, Mar 19, 2013 at 07:29:27AM -0700, Johan Tibell wrote:
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.

Okay, I've started actually applying this to a patch I'm working on, and I've come across the first situation it doesn't mandate a policy for: how to format import lists. There are at least two styles in Cabal code at the moment, e.g. the top of Distribution.Compate.TempFile looks like

    import System.FilePath        ((</>))
    import Foreign.C              (eEXIST)
import System.IO (Handle, openTempFile, openBinaryTempFile)
    import Data.Bits              ((.|.))
    import System.Posix.Internals (c_open, c_close, o_CREAT, o_EXCL, o_RDWR,
                                   o_BINARY, o_NONBLOCK, o_NOCTTY)
    [...]

whereas Distribution.Compat.CopyFile looks like

    import Control.Monad
             ( when )
    import Control.Exception
             ( bracket, bracketOnError )
    import Distribution.Compat.Exception
             ( catchIO )
    import Distribution.Compat.Exception
             ( throwIOIO )
    import System.IO.Error
             ( ioeSetLocation )
    [...]

I'm in favour of the first style, and if there's no objections, the patch I'm currently writing will be split into two commits, the first of which will beautify all the import lists I'm going to touch, and the second of which will apply my changes.

-- Ben

_______________________________________________
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel

Reply via email to