Haskell can now run in your browser

  • Cardano chief Charles Hoskinson announced that the smart contracts programming language Haskell can now run in the browser.
  • The Haskell language addresses some of the shortcomings of JavaScript allowing developers to write performant, correct, and maintainable code.

In the latest announcement on Wednesday, December 14, Cardano chief Charles Hoskinson announced that their native smart contracts programming language Haskell can run in the browser.

Haskell is a purely functional programming language that can handle a wide range of applications. It has an expressive syntax and a very rich built-in architecture. Cardano founder Charles Hoskinson has been quite optimistic about the capabilities of Haskell.

Cardano’s smart contracts and Marlowe, the domain-specific language for financial smart contracts, run on the Haskell programming language. Additionally, Cardano’s on-chain and off-chain codes are both written in Haskell.

One of the reasons Cardano’s Hoskinson chose Haskell is because it allows Plutus and Marlowe smart contracts to be built in a precise, formally proven language. This helps to deliver a high level of assurance right away. Now that the Haskell language can run in the browser, it would make the job of developers easier.

Cardano’s engineering team noted that they merged a new JavaScript backend into GHC recently. Thus, in the next release of GHC, it would be able to emit code that can run in browsers without needing any extra tools. This would further enable Haskell for both back-end and front-end applications.

Follow us for the latest crypto news!

Why JavaScript and why Haskell?

The engineering team at Cardano explains why they chose to have JavaScript in the backend. One of the biggest reasons is that JavaScript has a lion’s share of 97.3 percent of client-side programming. Besides it also offers portability allowing the Cardano team to focus majorly on the massive investments in the language and platform.

The Cardano engineering team believes that JavaScript backends provide different strengths. This would ultimately benefit the Haskell community to support both code generation paths in GHC for different use cases and requirements.

However, as per the Cardano team, the JavaScript language has a few shortcomings in early design decisions and downstream effects. Besides, with JavaScript, there are also some fundamental issues with asynchronous and concurrent programming as well as ecosystem security issues. The engineering team of Cardano writes:

Haskell makes this easy; or to get a little technical, the combination of Strong Static Hindley-Milner based typing allows us to write performant, correct, and maintainable code.

The benefit of using Haskell instead is code sharing: we can write the front-end of a web app in Haskell that compiles to JavaScript and the back-end in Haskell that compiles to machine code. In particular, the (de)serialization code (e.g. from/to JSON) is shared and cannot get out of sync between the front-end and the back-end.

Thus, they think that having a JavaScript backend in sync with GHC will add overall value to the Haskell ecosystem while offering a better user experience and reducing costs.

Source link


Leave a Reply

Your email address will not be published. Required fields are marked *