
Granting the "everything is a function" idea the best intent, maybe what it's trying to express is the related but different notion that everything *can be* a function -- i.e. that any value can be replaced by a function which yields a value of the appropriate type. Alternately, it could be a confusion between the untyped lambda calculus, in which everything really is a function, and the typed lambda calculus, in which things are more complicated? --S. On Jan 2, 2009, at 2:53 PM, Conal Elliott wrote:
Hi Cristiano,
Similarly, any value can be thought of as a list (perhaps singleton), a Maybe (Just), a pair ((,) undefined or (,) mempty), an IO (return), ... (any Applicative).
And yet I've heard "everything is a function" on several occasions, but not these others. Hence my (continuing) puzzlement about the source of that idea. I have some speculations:
* In pure "OO" programming, everything is an object, so in pure "functional" programming, one might assume everything is a function. I find the term "value-oriented programming" a more accurate label than "functional programming".
* C has definitions for functions but assignments for other types. Since pure functional languages eliminate assignment, one might assume that only functions remain. (I also hear people refer to top-level definitions in a Haskell module as "functions", whether they're of function type or not.)
Are there other thoughts & insights about the source of the idea that "everything is a function"?
Thanks,
- Conal
On Fri, Jan 2, 2009 at 2:52 AM, Cristiano Paris
wrote: On Tue, Dec 30, 2008 at 8:35 AM, Conal Elliott wrote: Everything in Haskell is a function [...]
Where did this idea come from?
I'd say every expression in Haskell denotes a pure value, only some of which are functions (have type a->b for some types a & b).
Maybe more formally correct, but my statement still holds true as any values can be tought as constant functions, even those representing functions themselves.
Cristiano
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe