Another attempt to explain Haskell to the wilfully ignorant.

Another attempt to explain Haskell to the wilfully ignorant.

This post is an experiment I decided to attempt after conversations with Ben Lesh and some other folks. I will assume as little knowledge of Haskell as I possibly can here. Later we’ll talk about some tools we have in Haskell to make the pattern more conceptually compact.

How to deeply clone an object in JavaScript? The simplest way is via JSON eg.

How to deeply clone an object in JavaScript? The simplest way is via JSON eg.

JSON.parse(JSON.stringify(obj))

See below for two alternatives which use browser APIs in unexpected ways.

The first one, the asynchronous PostMessage version runs 7 times faster than the JSON approach. These methods also have the advantage of working with circular references and non-serializable types like Dates, Sets, Maps and ArrayBuffers etc.

Something a little less wierd really needs to get built into JavaScript.

https://twitter.com/dassurma/status/955484341358022657