[Haskell-cafe] about Haskell code written to be "too smart"

Loup Vaillant loup.vaillant at gmail.com
Tue Mar 24 17:52:54 EDT 2009


2009/3/24 Manlio Perillo <manlio_perillo at libero.it>:
> Jonathan Cast ha scritto:
>>
>> [...]
>>
>> I think, in general, the best way to document the purpose of the
>> function is
>>
>>    -- | Split a function into a sequence of partitions of specified
>> lenth
>>    takeList :: [Int] -> [a] -> [[a]]

*That* was what I craved for. With the type and a name like
"partitions", I would hardly have to look at the code at all. The
comment is almost superfluous.

> Note that I was not speaking about the best way to document a function.
>
> I was speaking about the best way to write a function, so that it may help
> someone who is learning Haskell.

Then, the first version plus the documentation above would be perfect.
Instant understanding about the purpose of the function, and insight
about a how to write it.

Loup


More information about the Haskell-Cafe mailing list