> I've been reviewing the library, and have come unstuck with the *id*function. > What's its purpose and can someone give me an example of its practical use. >
It's purpose is simply to be the identity function. The type says exactly what it does. Prelude> :t id id :: a -> a It's often useful in combination with higher-order functions. Prelude> :t foldr (.) id foldr (.) id :: [a -> a] -> a -> a Here's a slightly complicated way to add a list of numbers: Prelude> foldr (.) id (map (+) [1..5]) 0 15 Sean
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe