[Haskell-beginners] dealing with chained functions

Stephen Tetley stephen.tetley at gmail.com
Sat Sep 4 03:55:47 EDT 2010


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


More information about the Beginners mailing list