[Haskell-cafe] Formatting function types
Antoine Latter
aslatter at gmail.com
Thu Dec 30 15:44:05 CET 2010
On Thu, Dec 30, 2010 at 8:33 AM, Lauri Alanko <la at iki.fi> wrote:
> On Thu, Dec 30, 2010 at 07:04:11AM -0600, Larry Evans wrote:
>> On 12/29/10 22:40, Daryoush Mehrtash wrote:
>> > Why do people put ";" in do {}, or "," in data fields, at the
>> > beginning of the line?
>> > --
>> It reflects the parse tree better by putting the
>> combining operators (e.g. ';' and ',') at the left
>> and their operands (or combined subtrees) indented
>> to the right.
>
> I will take this opportunity to mention again a related pet peeve of
> mine that I originally griped about ages ago:
>
> http://www.mail-archive.com/haskell-cafe@haskell.org/msg02231.html
>
> Even nowadays, Haddock deliberately generates the following layout for
> long function types:
>
> openTempFile
> :: FilePath
> -> String
> -> IO (FilePath, Handle)
>
Aesthetics is a funny thing. I prefer writing my type signatures
arrow-first if they grow too long.
Antoine
> The layout draws special attention to the first argument type, whereas
> the other argument types are indistinguishable from the return
> type. The following is much clearer:
>
> openTempFile ::
> FilePath ->
> String ->
> IO (FilePath, Handle)
>
> (Possibly with the arrows aligned.)
>
> I can't understand how the "arrows first" convention still lingers so
> strongly when it is (to me) so obviously wrong and misleading. Please,
> folks, at least pay a thought to what different indentation and line
> continuation styles express before adopting one.
>
>
> Lauri
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list