[Haskell-beginners] dealing with chained functions
Alec Benzer
alecbenzer at gmail.com
Sat Sep 4 04:06:53 EDT 2010
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.
> With composable functions you may find the intermediate steps f1, f2 &
> f3 are useful in other contexts.
Ya, that was what prompted me to think about this in the first place
(needing to use an intermediate value in another context when I had
set up the functions in the latter fashion). Does this fact make
writing the functions like that better practice though, or is it
pretty much left up to context as to which of the two methods to use?
On Sat, Sep 4, 2010 at 3:55 AM, Stephen Tetley <stephen.tetley at gmail.com> wrote:
>
> Hello Alec
>
> The first version composes whereas the second one doesn't. With the
> first version you should be able to write final like this:
>
> final :: a -> d
> final x = f3 $ f2 $ f1 x
>
> or pointfree
>
> final :: a -> d
> final = f3 . f2 . f1
>
> With composable functions you may find the intermediate steps f1, f2 &
> f3 are useful in other contexts.
>
> Best wishes
>
> Stephen
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list