Just my 2 cents...

> The first is that I always put the where for local function 
> definitions
> on a new line, e.g.
> foo x = x + a + b
>     where a = 1 + x
>           b = 2 * x
> I find this a lot clearer and prettier than,
> foo x = x + a + b where
>     a = 1 + x
>     b = 2 * x

I used to do it your style, but have switched to:

> foo x = x + a + b
>   where 
>     a = 1 + x
>     b = 2 * x

because it makes cut&paste easier.  instance/class declarations for me
also don't obey this.

> data AST
>   = Const Int
>   | Var String
>   | Lam String AST
>   | App AST AST
>   | Let String AST AST
>   | Add AST AST

same here.  or for records, I like:

> data Rec =
>      Rec {
>        foo   :: Int,
>        bar,
>        bluff :: String
>      }

> Another difficult case that I haven't solidified a style for is large
> type signatures.

I tend to do something like:

> myfoo :: (Context1, Context2, Context3) =>
>          type1 ->              -- maybe a description of type1
>          type2 ->
>          type3 ->
>            result type

it takes a lot more vertical space, but you also have easy
haddockability and it makes it a lot easier to remember what all those
parameters are...

 - hal
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to