
What is a good technique for breaking up long lines of code (for easier readability)? I have been inserting {- -} comments but there must be a better way. Something like \ in Python? Lycos email has 300 Megabytes of free storage... Get it now at mail.lycos.co.uk

Hi,
What is a good technique for breaking up long lines of code (for easier readability)? Indentation, the {- -} comments are probably having little effect.
For example, the following is perfectly valid:
f x y = if x then
y
else
not y
The indentation rules are quite complex, but just type your code
"sensibly indented" and it will probably just work.
Thanks
Neil
On 4/2/06, miketerrance
I have been inserting {- -} comments but there must be a better way. Something like \ in Python?
Lycos email has 300 Megabytes of free storage... Get it now at mail.lycos.co.uk
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Neil Mitchell wrote:
The indentation rules are quite complex, but just type your code "sensibly indented" and it will probably just work.
My biggest problem in this area was following haskell-mode's defaults too strictly. I found that things ended up indented more than was necessary for clear layout, so wasting a lot of the space I had available. Pete

miketerrance:
What is a good technique for breaking up long lines of code (for easier readability)?
I have been inserting {- -} comments but there must be a better way. Something like \ in Python?
Can you give an example? Usually breaking long lines is just a matter of cutting on white space: lookupP (a,b) cmd = withModule ircCommands cmd (error $ "Parse error: " ++ show cmd) (\m -> do privs <- gets ircPrivCommands -- no priv commands can be composed when (cmd `elem` privs) $ error "Privledged commands cannot be composed" return $ \str -> catchError (process m a b cmd str) (\ex -> case (ex :: IRCError) of (IRCRaised (NoMethodError _)) -> process_ m cmd str _ -> throwError ex)) once things get too big, use 'where' clauses . Actually, use 'where' clauses when things aren't too big, anyway :) There's also a set of programming guidelines here: http://haskell.org/haskellwiki/Programming_guidelines -- Don
participants (4)
-
dons@cse.unsw.edu.au
-
miketerrance
-
Neil Mitchell
-
Pete Chown