[Haskell-cafe] What are side effects in Haskell?
Sterling Clover
s.clover at gmail.com
Fri Jan 2 16:12:50 EST 2009
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
> <frodo at theshire.org> wrote:
> On Tue, Dec 30, 2008 at 8:35 AM, Conal Elliott <conal at conal.net>
> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list