So I only scanned the article, but I am guessing it is similar to how Haskell instantiates the lazy lists data type into the Monad type class.
Monadic “bind” is the concatMap function, “return” creates a list singleton, alternatives are list append operations, and the functor map is the ordinary list map function. The MonadFail instance is defined to automatically filter elements that don’t pattern match.
It results in some of the most elegant code I’ve ever written.
Has ecmascript always had lambdas or is this a new thing?
LikeLike
They’re new to es6
It had anonymous functions for a long time but fat arrow lambda functions are new.
They can also be curried
a => b => a * b;
LikeLike
Cool. Learned something new today.
LikeLike
There are a lot of really good things in es6 or es2015 as it’s now called. Chrome handles most of them natively. es6-features.org – ECMAScript 6: New Features: Overview and Comparison
LikeLike
So I only scanned the article, but I am guessing it is similar to how Haskell instantiates the lazy lists data type into the Monad type class.
Monadic “bind” is the concatMap function, “return” creates a list singleton, alternatives are list append operations, and the functor map is the ordinary list map function. The MonadFail instance is defined to automatically filter elements that don’t pattern match.
It results in some of the most elegant code I’ve ever written.
LikeLike