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

Ross Mellgren rmm-haskell at z.odi.ac
Tue Mar 24 17:50:21 EDT 2009


As (yet another?) Haskell newbie, with a day job using Java (where  
"keep it simple, stupid" is not a principle, it's a language enforced  
requirement), I would much prefer the function is implemented in the  
most concise and idiomatic style that the writer is capable of. That  
is, either the zipWith...scanl solution (or its variants) or the state  
solution.

I've found that I learn considerably more from functions written this  
way that also have a good documentation comment than from munching on  
the standard pattern matching recursion again and again. If the  
function is well described, and short in purpose and text, I can use  
the fact that with functional programming (with some exception)  
ensures that all I need to understand the behavior should be right in  
front of me and I can spend time learning the patterns.

Just my 2 cents,

-Ross

On Mar 24, 2009, at 5:43 PM, Manlio Perillo wrote:

> 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]]
>
> 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.
>
> > [...]
>
> Manlio
> _______________________________________________
> 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