Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

Thomas Davie tom.davie at gmail.com
Sat Apr 25 10:10:02 EDT 2009


On 25 Apr 2009, at 10:51, Daniel Fischer wrote:

> Am Samstag 25 April 2009 08:48:16 schrieb Thomas Davie:
>> On 24 Apr 2009, at 14:37, Loup Vaillant wrote:
>>> 2009/4/23 Miguel Mitrofanov <miguelimo38 at yandex.ru>:
>>>> On 23 Apr 2009, at 12:17, Thomas Davie wrote:
>>>>> Haskell is a very horizontal language, and to limit our horizontal
>>>>> space
>>>>> seems pretty weird.
>>>>
>>>> +1. I sometimes use lines up to 200 characters long, when I feel
>>>> they would
>>>> be more readable.
>>>
>>> 200 sounds awfully long. Do you have any example?
>>
>> Sure...
>>
>> arrow :: forall (~>) b c d e. ( Arrow (~>), Show (d ~> e), Show (c ~>
>> d), Show (b ~> c), Show b, Show c, Show d, Show e, Arbitrary (d ~>  
>> e),
>> Arbitrary (c ~> d), Arbitrary (b ~> c), Arbitrary b, Arbitrary c,
>> Arbitrary d, Arbitrary e, EqProp (b ~> e), EqProp (b ~> d), EqProp
>> ((b,d) ~> c), EqProp ((b,d) ~> (c,d)), EqProp ((b,e) ~> (d,e)),  
>> EqProp
>> ((b,d) ~> (c,e)), EqProp b, EqProp c, EqProp d, EqProp e) => b ~>
>> (c,d,e) -> TestBatch
>>
>>> .>
>>
>> In all seriousness though, that one got broken, but I do find that I
>> occasionally have lines around 100 characters that just look silly if
>> I break them, this is a good example:
>>
>>             filterNonRoots (GCase e bs    ) = filter ((/= e) <^(&&)^>
>> (not . (`elem` bs)))
>
> Not that I'd deny that it can sometimes be more readable to have  
> longer lines*, but in
> this example, would
>
>              filterNonRoots (GCase e bs    )
>                  = filter ((/= e) <^(&&)^> (not . (`elem` bs)))
>
> be any less readable in your opinion?

Yes – this particular line is mixed in with several other pattern  
matches, each of which has a similar form, laying it out on one line  
lets you see the similarities and differences, laying it out on two  
lines creates visual noise.

Bob


More information about the Haskell-Cafe mailing list