Re: [Haskell-cafe] identity function

2010-12-20 Thread Edward Amsden
It does precisely what you'd think. It returns the value passed in. It's mainly used in cases where a higher-order function expects a function, but you don't want to modify anything. See for instance http://www.haskell.org/ghc/docs/7.0-latest/html/libraries/base-4.3.0.0/Data-Maybe.html#v:maybe If

Re: [Haskell-cafe] identity function

2010-12-20 Thread Sean Leather
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