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 I want to extract a value from a Maybe, but I don't particularly care to apply a function to it, I can write (for instance) maybe 0 id ma Where 'ma' is my maybe value. (There's a library function fromMaybe, but this should illustrate the idea.) On Mon, Dec 20, 2010 at 5:14 PM, A Smith <asmith9...@gmail.com> wrote: > 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. > -- > Andrew > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- ------ Edward Amsden Undergraduate Computer Science Rochester Institute of Technology _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe