Last active
March 16, 2018 06:39
-
-
Save Svetixbot/5ca9160f37eb02b7c64b75f110f9b0ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1, d2, d3 are functions to deconstruct the {data} | |
t1, t2, t3 are functions to transform each of the destructed pieces | |
<*> apply function from Applicative. | |
// The <*> function is from Applicative and enables apply array of functions to an argument. | |
// The A[x] would hold a value of computation of an exception/null in case something went wrong. | |
var resultOfDestruct = [d1, d2, d3] <*> data // [A[a], A[b], A[c]] | |
var resultOfTransform = (resultDestruct) zip [t1, t2, t3] (<*>) // [A[a1], A[b1], A[c1]] | |
var transformation = resultOfTransform.filterFailures.Reduce(merge); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment