Is Haskell a Lisp?

2020-02-03 09:31发布

I've been reading The Haskell Road to Logic, Maths and Programming by Doets and Eijck 2004. It seems to be a well respected book, but I was struck when it claims that Haskell is a member of the Lisp family. Is this accurate? I would characterise Lisps with s-expressions, impure functions, and lists as the only composite data structure. Haskell has none of that. What justification is there for that claim?

9条回答
家丑人穷心不美
2楼-- · 2020-02-03 09:45

Arguably, all functional languages are descendants of Scheme to the extent that Scheme stumbled into, roughly, implementing the lambda calculus (though with quirks), and functional languages also implement the lambda calculus, though they don't necessarily always look like it. Also, arguably, the ML lineage is completely distinct because it goes back to Landin's ISWIM, which was influential but never implemented, had very little to do with Lisp, and from the start knew its theoretical foundations.

The real thing though is that Haskell and Lisp have much more in common with one another than either has with either the C family or the Prolog family.

I would have argued that folks should look past syntactic issues, but I forgot that Lispers define syntax as a key part of what it means to be a lisp. Which I think is goofy because then arguably Haskell isn't a Lisp, but Liskell is, even though the latter is basically a processor for the former.

查看更多
可以哭但决不认输i
3楼-- · 2020-02-03 09:50

Lisp is a very vague concept. I see two more or less useful interpretations:

  1. Lisp as a family of languages which share some common ideas. In a wide interpretation very different languages belong to this family: Common Lisp, Scheme, Logo, Dylan, Emacs Lisp, Clojure, RLisp, 3Lisp and many, many others.

  2. Lisp as a lineage of languages that are somehow implementing a core language (CAR, CDR, CONS, LAMBDA, PROG, SET, SETQ, QUOTE, DEFUN, IF, COND, DO, ...): Lisp 1.5, MacLisp, Lisp Machine Lisp, Emacs Lisp, Common Lisp, ISLisp. Note that these languages usually have 'Lisp' as part of their name.

Some typical things we find in Lisp dialects: strict evaluation, side effects, direct imperative programming, functional programming constructs, s-expressions, evaluation, macros.

Haskell is a very different language: non-strict evaluation, syntax not based on top of s-expressions, static typing, purely functional.

Haskell does not fit 1 nor 2. So, I would say Haskell is not a Lisp.

Similar we can say that a Functional Programming language is:

  1. a language that supports Functional Programming: Lisp, APL, ..., ML, SML, OCAML, F#, Miranda, Haskell, ...

  2. a language that enforces Functional Programming. Here Lisp already does not really fit in, since imperative or even object-oriented programming is not second class in Lisp.

  3. a language that enforces Pure Functional Programming. Here we have Haskell as a good example. As a relatively new Lisp dialect Clojure also might fit in.

Usually Lisp does only support, but not enforce Functional Programming. So it is a Functional Programming Language in a wider interpretation.

Haskell is one of the languages that is seen as a Purely Functional Programming Language.

查看更多
甜甜的少女心
4楼-- · 2020-02-03 09:53

I'd say that both are functional languages, which makes them belong to the same family. However, I wouldn't call Haskell a Lisp derivative (like Scheme).

查看更多
该账号已被封号
5楼-- · 2020-02-03 09:54

I think Haskell is a Lisp in the sense that they're both based on the λ calculus. Haskell is an implementation of λ.

Though most people would say that Haskell belongs to the ML family. ML is also based on λ, as are all functional languages I know of.

Under the hood, OCam (descended from ML) is compiled to combinatory logic, a formalism that is equivalent to λ calculus, and was invented by Haskell Curry, the logician whom Haskell is named after. But the use of combinatory logic for functional langauge compilation seems to be less popular nowadays, so I'm not sure about modern compilers like GHC.

Lisp's syntax is almost identical with λ calculus, which makes this family (Scheme, Clojure, etc) very special.

查看更多
▲ chillily
6楼-- · 2020-02-03 09:54

Hoyte compares some languages and claims that Haskell is NOT a Lisp for it is too strict in types and only for academics, whereas Common Lisp is more like a prototyping language (no strictness, dynamic typing).

See: Let Over Lambda—50 Years of Lisp by Doug Hoyte (an advanced book about Common Lisp, http://letoverlambda.com/)

Haskell and Common Lisp (probably all Lisps) are optimized against the functional programming (FP) paradigm. Haskell is pure, whereas Common Lisp is unpure. Contrast the term FP also with "total functional programming".

Also have a look at this diagram comparing programming language paradigms: http://www.info.ucl.ac.be/~pvr/paradigms.html

查看更多
劳资没心,怎么记你
7楼-- · 2020-02-03 10:02

I would not agree with that. They're both functional programming languages and Lisp influenced Haskell, but Haskell is not a Lisp derivative. Just look at the amount of parenthesis and you can tell.

查看更多
登录 后发表回答