[Haskell-cafe] Monad explanation
wren ng thornton
wren at freegeek.org
Tue Feb 10 20:01:16 EST 2009
Richard O'Keefe wrote:
> Gregg Reynolds wrote:
> > Sure, you can treat a morphism as an object, but only by moving to a
> > higher (or different) level of abstraction.
>
> False as a generalisation about mathematics.
> False about functional programming languages, the very essence
> of which is treating functions ("morphisms") as values ("objects")
> exactly like any other values.
>
> > That doesn't erase the difference between object and morphism.
>
> There is no intrinsic difference between objects and morphisms.
> It's what you DO with something that makes it an object or a
> morphism (or both).
>
> > This is way confusing.
>
> Composer (Haskell program) writes score (computes getChar).
> Performer (Haskell environment) sings score (performs Gamaliel).
> Sound happens (a character is read).
+1.
The only difference between objects and morphisms is in the decision by
some supreme entity (human reader, Haskell runtime) to treat them
differently. There is nothing different between them other than our
decisions to treat them differently.
As for the concrete example about "3", I define:
> let 3 = \f x -> f(f(f x))
which is as valid as any other definition. Oh noes, you say, it's a
function and therefore a morphism. And certainly it is. However, it's
perfectly fine to treat that as a value and define a "real" function
like addition:
> let m + n = \f x -> m f (n f x)
When people see something like "1 + 2 + 3" they choose to think of 1, 2,
and 3 as "objects" and choose to think of (+) and (+) as "morphisms",
but who cares? Any datum can be encoded as a function, the execution of
which enacts the existence of the object the function denotes. And, in
functional languages, functions can be passed around and clubbed over
the head just like every other value.
And therein lies the rub: "the execution of which enacts the existence
of the object the function denotes." The only thing that distinguishes
objects and morphisms is the decision by some supreme entity to treat
them that way. Just as you once said that values don't concatenate, so
neither do functions apply. The application of functions can only be
observed by some evaluator for the structure generated by application.
Application itself has no semantics, it just builds ASTs and
uninterpreted terms; only our choice to evaluate ASTs and terms gives
them meaning.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list