AW: Haskell indentation
Tue, 26 Aug 2003 14:24:46 +0200
If your code goes out to far right, it's a good idea to
make a function out of it.
> main =3D do
> args <- getArgs
> case args of
> (fname:_) -> normalOp
> _ -> helpScreen
> normalOp =3D do
> helpScreen =3D putStrLn helpStr
Code should be formatted in a way easy to scan and overview.
You have to SEE the structure of the code.
That depends very much on what your program does.
No rules of thumb. Experience and experiments will do.
(That was taken *directly* out of my convoluted brain and
may be totally dumb.)
Infineon Technologies AG, CPR ET
Tel +49 (89) 234-20875
> -----Urspr=FCngliche Nachricht-----
> Von: Per Larsson [mailto:per@L4i.se]=20
> Gesendet: Dienstag, 26. August 2003 14:01
> An: email@example.com
> Betreff: Haskell indentation
> I have problems finding a pleasing indentation style for haskell =
> Especially nested do-blocks have a tendency to run away to=20
> the right margin.
> When looking on source code from experienced haskell=20
> programmers, there=20
> seems not to be any consensus at all, everyone uses their own=20
> and in many cases one changes style in the same module.
> Also, the automatic tools are problematic: the emacs mode I'm using
> bails out in certain contexts and there are few user=20
> customizations available.=20
> The haskell-src module in the GHC library offers a parser
> and pretty-printer for haskell code with nice options for customizing
> the indentation, but it can't handle comments which is a problem if
> you want to use it as a basis for implementing a indentation tool.
> Is there anyone who have given this some thought and have some
> suggestions for a consistent indentation style and/or desktop tools
> which I'm not aware of?
> Haskell-Cafe mailing list