[Haskell-cafe] Wikipedia on first-class object

Derek Elkins derek.a.elkins at gmail.com
Sun Jan 6 17:27:57 EST 2008

On Sun, 2008-01-06 at 23:28 +0100, jerzy.karczmarczuk at info.unicaen.fr
> Derek Elkins writes: 
> > Jonathan Cast wrote:
> >> I find the only  
> >> similarity between Haskell and Prolog to be that neither is imperative.
> > 
> > Indeed, you've discovered it.  The definition of "declarative" is often
> > "not imperative." 
> I disagree. Practically. (I won't discuss doctrinal matter nor linguistic
> hairsplitting). 

I wasn't being that serious there, though oftentimes "declarative" -is-
used in a way that is mostly meaningless or as a buzzword.  One thing I
will stand by, however, is that the consensus is that "declarative" and
"imperative" are meant to be exhaustive and ideally disjoint (though
where to draw the line is tricky), and thus in that sense, "declarative"
is "not imperative" (and, as I said originally though you elided it,
vice versa.)

> The relational syntax of Prolog is more "universal" than the functional
> notation, since you have logic variables and logical-non-determinism, and
>  - thus - the possibility of making predicates where the roles of input and
> output parameters are not pre-assigned, - 
>  - but there is a *strong* (meaning important) functional layer within,
> and plenty of Prolog algorithms are expressed similarly in Lisp or in
> Haskell. 
> Many non-deterministic ones have natural translation into the List monad.
> Some "circular" definitions using laziness are related to ones with
> non-instantiated logical variables. 
> If you don't want to see similarities, you won't.  But I assure you that
> I have profited enormously from tha *affinities* between functional and
> logic approaches, and you won't convince me that "declarative" is without
> substance. 

"declarative" is often used in a way where HTML, XML and such are
"declarative languages".

At any rate, also in the elided part of my reply, was the statement that
"imperative"/"declarative" are often defined by example, and the above
is just such a case (unless you have a clear definition of "functional"
and "logical").  This simply defines "declarative" to mean
"functional"+"logical" making "declarative" a pure name devoid of any
descriptive power.

To make this email constructive, however, I will propose a slightly less
fuzzy criterion: namely a declarative language is one that, via the
Curry-Howard correspondence(s), corresponds strongly with (a relatively
"standard") logic.  This arguably can be used to give some oomph to the
usage of the term "declarative" rather than it being just a name, though
I'll not bother.  This recovers the fact that "functional" and "logic"
languages are declarative and gives a -specific- similarity.  It agrees
fairly well with the ordering "more declarative than" determined by
consensus.  Finally, it points the way to allowing other languages
rather than "not (functional or logical) => not declarative."

More information about the Haskell-Cafe mailing list