[Haskell-cafe] breaking too long lines
Tillmann Rendel
rendel at cs.au.dk
Mon Apr 20 10:44:58 EDT 2009
Christian Maeder wrote:
> I've nothing against long names, but one shouldn't try to put blocks
> to the right of them.
This is very important from my point of view. Indention should not
depend on identifier length. However, I make an exception to that rule
sometimes for definitions which look like tables (e.g. step functions
for abstract machines).
> do c <- letter
> do d <- digit
> return [c, d]
> <|> do
> u <- char '_'
> return [c, u]
I try to avoid these, e.g. I would use this instead:
do c <- letter
choice
[ do d <- digit
return [c, d]
, do u <- char '_'
return [c, u]
]
Actually, I try to avoid do-blocks, but that's a different story.
> data TName =
> LongConstructorName
> { selector1 :: C1
> , ... }
> | LongSecondConstructor
> ....
> deriving ...
I use
data Maybe a
= Just a
| Nothing
deriving Show
or
data Maybe a
= Just
{ fromJust :: a
}
| Nothing
deriving Show
However, I would prefer the following Coq-like syntax:
data Maybe a =
| Just a
| Nothing
Tillmann
More information about the Haskell-Cafe
mailing list