#monads and More in 5 Minutes or Less
▻https://hackernoon.com/monads-and-more-in-5-minutes-or-less-80d71f19dc11?source=rss----3a8144ea
Plain English not Crazy JargonThe necessity of monads in #haskell maintains the pure functionality of the language but can test the patience of its programmers. An understanding of monads is essential if you want to work with Haskell. This tutorial offers a quick look at the structure of the Monad typeclass. While you’ll need familiarity with Haskell, specifically, to understand how to tackle its Monad typeclass, the concepts presented in this tutorial are easily transferred to other languages. We’ll also be covering the #applicative and #functor typeclasses. Let’s start with the boring, technical definition. A monad is a particular typeclass that is primarily composed of 2 functions, bind and return. This is simple enough, right? Now let’s break down some terminology and find out why these 2 (...)
]]>Functional Programming: Alternatives to the IF #Functional #JavaScript
▻https://hackernoon.com/functional-programming-alternatives-to-the-if-functional-javascript-8804
A couple of times I have been asked “How would you do X in functional programming?” I absolutely love these types of questions.I do my best to answer every question, but I think there are many questions interesting enough to warrant their own articles.So for this article I would like to demonstrate how I could recreate this imperative function in a more functional manner.This function has an if statement without an else. So while a ternary operator could work, it is not ideal.▻https://medium.com/media/29d9e7511c38ea379b141ea5967caa66/hrefHere we need to run dispatch
only when we have a value
, otherwise we do nothing.One option is to use a short circuit operator:▻https://medium.com/media/6c715f86b93a7d7c84c35e5a16814a00/hrefShort circuit and ternary and both ways you can solve this (...)
]]>