tibbe / haskell-style-guide

A style guide for Haskell code.
959 stars 75 forks source link

Add examples how to break long function headers #13

Open hvr opened 11 years ago

hvr commented 11 years ago

How shall a function with long list of arguments be broken?

What of the following is acceptable (n.b. the max line length was shortened artificially for illustration)? where shall the =-sign land?

longfunname arg1 arg2 arg3 arg4 arg5 arg5
    = long body ...

longfunname arg1 arg2 arg3 arg4 arg5 arg5 =
    long body ...

longfunname arg1 arg2 arg3 arg4 arg5 arg5
    (Cons1 arg6 arg7 arg8 arg9)  
    = long body ...

-- note the weird ()-brackets
longfunname arg1
    arg2 arg3 arg4
    arg5 arg5 (Cons1
    arg6 arg7arg8
    arg9)
    = long body ...

-- ... ?