haskell-style-guide icon indicating copy to clipboard operation
haskell-style-guide copied to clipboard

Add examples how to break long function headers

Open hvr opened this issue 11 years ago • 0 comments

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 ...


-- ... ?

hvr avatar Aug 26 '13 08:08 hvr