Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
-- | simple/basic Scala -> Haskell translation of Runar's presentation | |
-- | (https://dl.dropboxusercontent.com/u/4588997/ReasonablyPriced.pdf) | |
-- | trying to use minimal extensions and magic. | |
-- | (earlier I had a version using MultiParamTypeClasses for Runar's | |
-- | Inject class, but scraped it opting for simplicity) | |
-- | my question: what do we lose by moving towards simplicity? | |
-- | Future work: use DataKinds, TypeOperators, and potentially TypeFamilies | |
-- | to maintain and automate the folding of types in Coproduct. | |
{-# LANGUAGE Rank2Types, DeriveFunctor #-} |
Lately I've been annoyed that Haskell has tuples with more than 2 elements. It seems to me like a great deal of boilerplate in Haskell comes from writing code like Data.Profunctor.Product. One can find many, many more examples like this in Haskell libraries.
That is to say, suppose you could define types like this:
type alias A = (x,(x,x))
npm_bin:=$(shell npm bin) | |
psc=$(npm_bin)/psc | |
bower=$(npm_bin)/bower | |
outdir=target | |
all: $(outdir)/js/HelloWorld.js | |
$(outdir)/js/HelloWorld.js: src/HelloWorld.purs |
This is pretty out of date now... you may want to look elsewhere
Newer guides than mine (mine is a bit dated and has a lot of rough edges):
Have you looked at these?
initial code with some really convoluted error handling. | |
The problem on this is that it must check for 2 different error cases and also return a different result in those error cases | |
dot :: Matrix -> Matrix -> Either MatrixError Number | |
dot (Matrix a sa) (Matrix b sb) = if areSimilarVectors sa sb then Right $ dot' a b else failed sa sb | |
where | |
areSimilarVectors s1 s2 = isVector s1 s2 && isSameSize s1 s2 | |
dot' a b = _dot (join a) (join b) | |
isVector sa sb = fst sa == 1 && fst sb == 1 | |
isSameSize sa sb = snd sa == snd sb |
Card payments with Stripe should be performed with PaymentIntents.
This API was created to handle modern payments, where the cardholder's bank may require the user to authenticate themselves with the bank before a payment can be authorized.
Authentication requirements first started to appear with European banks regulated by PSD2 which introduced [Strong Customer Authentication