[Haskell-beginners] dealing with chained functions

Federico Mastellone fmaste at gmail.com
Wed Apr 20 21:00:43 CEST 2011


The first version. It is generally considered a good practice to Increase
Cohesion and Decrease Coupling. Its a very common approach, google it.

On Sun, Sep 5, 2010 at 4:50 AM, Alec Benzer <alecbenzer at gmail.com> wrote:

> A) is all I was really asking. I'm not writing a library or exposing
> any functions. I was concerned with how I should write the internals,
> although I see how in certain contexts the latter form may be
> preferable if I was writing a library.
>
> On Sun, Sep 5, 2010 at 3:41 AM, Chaddaï Fouché <chaddai.fouche at gmail.com>
> wrote:
> > On Sat, Sep 4, 2010 at 10:06 AM, Alec Benzer <alecbenzer at gmail.com>
> wrote:
> >> No, ya, I get that differences between the two methods, I was asking
> >> if one of them was generally considered better practice than the
> >> other.
> >
> > I think your question is mixing two different concern : A) how you
> > should write your Haskell functions so that you reap most benefit from
> > its functional nature, and B) what functions you should expose in the
> > interface of your libraries.
> >
> > The answer to A) is that you should use the solution that is more
> > composable (the former), the answer to B) really depends on what your
> > library does and the philosophy of your interface... In other words,
> > it may be better in your specific case to expose the latter functions
> > (probably not often but it may happen) but the internals of your
> > library should most likely be written in the former style (it is easy
> > to form the latter functions from the former, while the opposite is
> > quite impossible).
> >
> > --
> > Jedaï
> >
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Federico Mastellone
Ingeniero Informática - ITBA

".. there are two ways of constructing a software design: One way is to make
it so simple that there are obviously no deficiencies, and the other way is
to make it so complicated that there are no obvious deficiencies. The first
method is far more difficult."

Tony Hoare, 1980 ACM Turing Award Lecture.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110420/136fe4ec/attachment.htm>


More information about the Beginners mailing list