Need advice about which tool to choose?Ask the StackShare community!
Common Lisp vs Haskell: What are the differences?
## Key Differences between Common Lisp and Haskell
Common Lisp and Haskell are two popular programming languages with significant differences in their design and usage. Below are the key differences between Common Lisp and Haskell:
1. **Programming Paradigm**: Common Lisp is a multi-paradigm language that supports imperative, functional, and object-oriented programming styles. In contrast, Haskell is a purely functional language that does not allow side effects and emphasizes immutability.
2. **Type System**: Common Lisp has a dynamic type system where types are determined during runtime, allowing for flexibility but potentially leading to runtime errors. On the other hand, Haskell has a strong, static type system that ensures type safety at compile time and helps prevent errors.
3. **Syntax**: Common Lisp has a more traditional syntax with parentheses for function calls and prefix notation for expressions. Haskell, on the other hand, uses a more mathematical syntax with curried functions, pattern matching, and higher-order functions.
4. **Lazy Evaluation**: Haskell employs lazy evaluation by default, postponing the computation of expressions until their results are actually needed. In contrast, Common Lisp uses strict evaluation, which means that arguments are evaluated before a function is called.
5. **Recursion vs. Loops**: Haskell encourages the use of recursion for repetitive tasks, leveraging the power of higher-order functions and pattern matching. Common Lisp provides loop constructs for iterative tasks and supports traditional looping mechanisms like do, do*, and dolist.
6. **Concurrency**: Haskell has built-in support for lightweight threads, software transactional memory (STM), and asynchronous programming, making it well-suited for concurrent and parallel programming. Common Lisp, while not lacking in concurrency tools, may require external libraries for advanced concurrency features.
In Summary, Common Lisp and Haskell differ in programming paradigm flexibility, type system strength, syntax style, evaluation strategy, looping approaches, and concurrency support.
We have a lot of experience in JavaScript, writing our services in NodeJS allows developers to transition to the back end without any friction, without having to learn a new language. There is also the option to write services in TypeScript, which adds an expressive type layer. The semi-shared ecosystem between front and back end is nice as well, though specifically NodeJS libraries sometimes suffer in quality, compared to other major languages.
As for why we didn't pick the other languages, most of it comes down to "personal preference" and historically grown code bases, but let's do some post-hoc deduction:
Go is a practical choice, reasonably easy to learn, but until we find performance issues with our NodeJS stack, there is simply no reason to switch. The benefits of using NodeJS so far outweigh those of picking Go. This might change in the future.
PHP is a language we're still using in big parts of our system, and are still sometimes writing new code in. Modern PHP has fixed some of its issues, and probably has the fastest development cycle time, but it suffers around modelling complex asynchronous tasks, and (on a personal note) lack of support for writing in a functional style.
We don't use Python, Elixir or Ruby, mostly because of personal preference and for historic reasons.
Rust, though I personally love and use it in my projects, would require us to specifically hire for that, as the learning curve is quite steep. Its web ecosystem is OK by now (see https://www.arewewebyet.org/), but in my opinion, it is still no where near that of the other web languages. In other words, we are not willing to pay the price for playing this innovation card.
Haskell, as with Rust, I personally adore, but is simply too esoteric for us. There are problem domains where it shines, ours is not one of them.
Pros of Common Lisp
- Flexibility24
- High-performance22
- Comfortable: garbage collection, closures, macros, REPL17
- Stable13
- Lisp12
- Code is data8
- Can integrate with C (via CFFI)6
- Multi paradigm6
- Lisp is fun5
- Macros4
- Easy Setup4
- Parentheses3
- Open source3
- Purelly functional3
- Elegant3
- DSLs1
- Multiple values1
- CLOS/MOP1
- Clean semantics1
- Will still be relevant 100 years from now1
- Still decades ahead of almost all programming languages1
- Best programming language1
- Simple syntax1
- Powerful1
- Generic functions1
- Can implement almost any feature as a library1
- Formal specification, multiple implementations1
Pros of Haskell
- Purely-functional programming90
- Statically typed66
- Type-safe59
- Open source39
- Great community38
- Built-in concurrency31
- Built-in parallelism30
- Composable30
- Referentially transparent24
- Generics20
- Type inference15
- Intellectual satisfaction15
- If it compiles, it's correct12
- Flexible8
- Monads8
- Great type system5
- Proposition testing with QuickCheck4
- One of the most powerful languages *(see blub paradox)*4
- Purely-functional Programming4
- Highly expressive, type-safe, fast development time3
- Pattern matching and completeness checking3
- Great maintainability of the code3
- Fun3
- Reliable3
- Best in class thinking tool2
- Kind system2
- Better type-safe than sorry2
- Type classes2
- Predictable1
- Orthogonality1
Sign up to add or upvote prosMake informed product decisions
Cons of Common Lisp
- Too many Parentheses4
- Standard did not evolve since 19943
- Small library ecosystem2
- No hygienic macros2
- Inadequate community infrastructure1
- Ultra-conservative community1
Cons of Haskell
- Too much distraction in language extensions9
- Error messages can be very confusing8
- Libraries have poor documentation5
- No good ABI3
- No best practices3
- Poor packaging for apps written in it for Linux distros2
- Sometimes performance is unpredictable2
- Slow compilation1
- Monads are hard to understand1