Why Haskell?

I work in the IT/Internet industry and thought it would be a nice geek project to setup a Cardano node and self stake my coins. But I see the Cardano-node software requires Haskell and Cabal.
For over 20 years I have worked as a Linux Systems Admin and never needed to use this before, which likely explains why its not even included in my favorite distro.
Cardano wants to be a major player and talks the game so why oh why not using something which is widely supported and native to Linux like C/C++, Perl* or Python?
*Not recommending Perl but just using it as an example.

Haskell is not as obscure as you make it sound. It is by far the most successful of the purely functional programming languages and you can hardly get a computer science degree without having at least heart about it.

It is included in every major Linux distribution: Debian and its derivatives, namely Ubuntu, Fedora, Arch, … If your distro does not contain it, your distro is probably more obscure than Haskell itself.

You do not need to write Haskell code yourself to setup and run a node, just be able to install it, which should really be possible for an experienced administrator.

Of course, a good programmer can shoot herself in the foot in every language, even Haskell. Maybe, you could also get comparable safety in a more wide-spread language by careful code audits and lots of unit tests. Maybe, there would even be more people that could do independent audits than people who can audit Haskell code.

But a purely functional language is, nevertheless a valid choice for a project that values formal verification like Cardano does. It gives you a lot of guarantees regarding program correctness by design.

We can also debate, what exactly are the properties that are formally proven and what is outside of the scope of these proofs. We cannot prove that people cannot fall for scams. We cannot prove that pool operators know at least enough system administration to let them run servers on the Internet in good conscience. We cannot prove that the ecosystem will thrive economically.

It’s the very basic functionality of the chain that is formally proven, not more, not less. Emphasising that might partly be marketing or virtue signalling, but there is some real value underneath that.

By way of elaboration - I have Haskell installed (side note: it was not included with my favorite distro). But Cabal is a whole another show and its required according to the Cardano Node documentation.
Their official website [1] makes liberal use of the term dependency hell and its what I am in.
Sorry to say, no way this is going to get traction if you need a CompSci degree to install it. Wishful thinking and geek interests do not translate to something companies and government departments are going to chose. It appears to not even have a Windows version [2].

I have done some further digging and compared to BTC and LTC, its nowhere in the crypto currency space.

  1. https://hackage.haskell.org/

  2. Installing cardano-node and cardano-cli from source | Cardano Developer Portal
    (I hate Windows and don’t use it, but its what companies like)

I want to add to this that the the plutus core language, which formally is some typed F logic system in lamba calculus, is also formally verified. This means that the scripting language that is used on chain that users can create is also very safe. I think that even Djed (the algo stable coin paper) is formally verified. All these steps are a natural/canonical extension of the Haskell stack. Why do this? For those who missed the news on the MakerDAO (an issuer of stable coins) flash crash that resulted in the loss of many assets. I think that it is a must have to have a certain predictability of protocol behavior in black swan cases. And this is what formal verification provides. For info to read more about this, I think IOG uses Agda (at least they did for Djed).

2 Likes

Hi and welcome to the community :slight_smile:

For clarification, GHC is the most common Haskell compiler, this is almost always installed on linux. What is not always installed is a package manager like Cabal. Similarly in python, either anaconda or pip is used which is not installed by default, it is up to the developer to make this choice. Just as in your favorite distro, you can choose your desktop environment. IOG that develops the core infrastructure of Cardano chose to supply their packages via Cabal (this is the most common one again in the Haskell world).

In addition, Haskell is not so novel as you may think. A lot of banks use it for their core infrastructure (for good type safe reasons!). Also there are some trading firms that use it (most use OCaml, another functional programming language). Even Facebook uses Haskell in their core infrastructure (in a quite scalable manner). Every language has its use cases and it is up to the developer to reason what fits the needs of the application with that choice. I think IOG made a good choice with the use of Haskell in their core infrastructure. As mentioned by @HeptaSean, this does not mean the day to day users have to program everything in Haskell, probably none (disclaimer this excludes plutus which is haskell-ish). If you look at other infrastructure that is out there, like browser based wallets, they often use the standard language for their domain. There are also python or rust based libraries for wallet. It all depends on what you want to do. But remember the use of one does not exclude the use of another. The core needs to be safe, so that is why haskell is used there. Other infrastructure that is build upon has other criteria for usage, so other languages are used there.

1 Like

As a long time linux lover what distro are you using? I may be able to help as I know dozens of them both deb and rpm.

The good news is that in your case if you just want to run a node and play with some cardano CLI commands then you don’t even need to learn Haskell. Since you are a Linux type all you should need to know is terminal shell (bash, zsh, etc), package management (apt, yum, etc), source control (git, svn, etc), compiling source (ghc, cabal, etc) and then you should be good to go as far as prerequisites. Some additional “power user” skills like debugging software, networking, cybersecurity, etc might come in handy as well.

Haskell was likely chosen due to Charles being a mathematician more so than an engineer. However every tool in the software engineering toolbox has a use but can only ever be as useful as the skill of the wielder. I happen to a have a computer science degree and have been programming for decades professionally. The one thing I know for sure is that most of the time if something isn’t working then it is because I need to learn it, fix it, config it, etc.

P.S. Haskell compiles to C similar to how RUST compiles to C++ anyway :wink:

1 Like

Thanks for the offers of assistance and feedback.

I have thought about this and my wider crypto aims and decided to swap out all of my ADA for LTC.

@DinoDude - I am using Slackware64.