[Xmonad] darcs patch: XSelection.hs: simplify creation of window (and 10 more)

Spencer Janssen sjanssen at cse.unl.edu
Wed Oct 24 07:29:06 EDT 2007


On Tuesday 23 October 2007 18:03:21 Don Stewart wrote:
> gwern0:
> > On 2007.10.23 15:19:32 -0700, Don Stewart <dons at galois.com> scribbled 0 
lines:
> > > mailing_list:
> > > > Regarding the style: I hope that Don will come up with some coding
> > > > convention I remember he was talking about.
> > >
> > > I've added a document called STYLE to the xmonad core, with initial
> > > advice on required style for new code.
> > >
> > > Feel free to send suggestions in.
> > >
> > > -- Don
> >
> > Done.
> >
> > But I notice there's nothing about how imports should be done. We've
> > heard from myself, Roundy, and Andrea. How is XMonad going to do them?
> > Implicit vs. explicit, alphabetical vs. by first use vs. by commonness
> > by... there are a lot of options, and I think this is one of the things
> > it'd be better to just have you and sjanssen declare by fiat.
>
> I favour no import lists these days.
>
> -- Don


In general, I don't feel strongly either way.  Explicit imports can clarify,
but only to a point.  Consider this code that was recently contributed:

import System.Environment (getEnv)
import Control.Monad (Monad((>>=), return), Functor(..), filterM, forM)
import Data.List ((++), concat, filter, map, lines, elem, span, tail, last, 
                 isPrefixOf)
import Data.Set (toList, fromList)
import System.Directory (Permissions(executable), getPermissions,
                        getDirectoryContents, doesDirectoryExist,
                        doesFileExist)
import System.IO (IO, FilePath)
import XMonadContrib.Run (runProcessWithInput, safeSpawn, unsafeSpawn)
import XMonad (X, io, spawn)
import XMonadContrib.XPrompt (XPrompt(..), XPConfig, mkXPrompt)


In my opinion, this solid wall of imports only serves to obfuscate.


Cheers,
Spencer Janssen




More information about the Xmonad mailing list