Skip to content

Instantly share code, notes, and snippets.

@bobbicodes
Last active November 13, 2022 18:33
Show Gist options
  • Save bobbicodes/2ce641a9b08113398e4d6518ec55e22a to your computer and use it in GitHub Desktop.
Save bobbicodes/2ce641a9b08113398e4d6518ec55e22a to your computer and use it in GitHub Desktop.
Transcript: Monads in Clojure
[[{"text": "now the first topic that um i'm gonna", "start": 0.0, "duration": 4.96}, {"text": "talk about today is probably using", "start": 2.639, "duration": 5.12}, {"text": "closure to do functional programming so", "start": 4.96, "duration": 3.84}, {"text": "when we talk about functional", "start": 7.759, "duration": 2.641}, {"text": "programming most people will", "start": 8.8, "duration": 4.24}, {"text": "say oh monets let's talk about how to", "start": 10.4, "duration": 4.0}, {"text": "use closure to", "start": 13.04, "duration": 5.04}, {"text": "write monet and then it's a", "start": 14.4, "duration": 6.16}, {"text": "pretty useful skill actually i'll say", "start": 18.08, "duration": 3.359}, {"text": "that it's like", "start": 20.56, "duration": 4.639}, {"text": "a software design pattern", "start": 21.439, "duration": 7.041}, {"text": "except that it's very powerful let's", "start": 25.199, "duration": 6.641}, {"text": "get started", "start": 28.48, "duration": 3.36}, {"text": "the operating system that i use is osx", "start": 32.16, "duration": 4.32}, {"text": "the editor that i'm use", "start": 34.8, "duration": 4.88}, {"text": "is space max", "start": 36.48, "duration": 5.36}, {"text": "i like this setup because it's very", "start": 39.68, "duration": 3.36}, {"text": "minimalistic", "start": 41.84, "duration": 3.039}, {"text": "i don't need to spend a lot of time to", "start": 43.04, "duration": 4.32}, {"text": "play with how to configure my emacs", "start": 44.879, "duration": 4.401}, {"text": "and i don't need to spend a lot of time", "start": 47.36, "duration": 4.24}, {"text": "to twinkle with the operating system", "start": 49.28, "duration": 5.119}, {"text": "everything just works out of the box so", "start": 51.6, "duration": 3.76}, {"text": "monads", "start": 54.399, "duration": 2.32}, {"text": "i'm trying to answer these three", "start": 55.36, "duration": 3.039}, {"text": "questions what are monets", "start": 56.719, "duration": 4.16}, {"text": "why do we care as closureist and can we", "start": 58.399, "duration": 4.241}, {"text": "understand it without knowing those", "start": 60.879, "duration": 2.961}, {"text": "fancy types", "start": 62.64, "duration": 3.519}, {"text": "this tutorial is inspired by conrad", "start": 63.84, "duration": 4.08}, {"text": "tinsen's monet tutorial", "start": 66.159, "duration": 4.721}, {"text": "it's a very good tutorial and it has", "start": 67.92, "duration": 4.239}, {"text": "four parts", "start": 70.88, "duration": 3.36}, {"text": "and it covers more topics but i found", "start": 72.159, "duration": 3.121}, {"text": "that", "start": 74.24, "duration": 3.76}, {"text": "using this rapport style to introduce", "start": 75.28, "duration": 3.44}, {"text": "monets", "start": 78.0, "duration": 4.24}, {"text": "is more visually easier to understand", "start": 78.72, "duration": 4.56}, {"text": "for beginners", "start": 82.24, "duration": 4.4}, {"text": "so let's get started let's try to make", "start": 83.28, "duration": 5.839}, {"text": "the form bigger", "start": 86.64, "duration": 4.56}, {"text": "so first how do we assign values to", "start": 89.119, "duration": 3.601}, {"text": "names without defining stuff in the", "start": 91.2, "duration": 2.559}, {"text": "global space", "start": 92.72, "duration": 3.359}, {"text": "as you can see defining values in the", "start": 93.759, "duration": 3.121}, {"text": "global space", "start": 96.079, "duration": 2.72}, {"text": "is side effects functional programming", "start": 96.88, "duration": 3.12}, {"text": "is all about getting rid of", "start": 98.799, "duration": 4.32}, {"text": "side effects so let's say that we have", "start": 100.0, "duration": 6.64}, {"text": "these anonymous functions and we try to", "start": 103.119, "duration": 6.481}, {"text": "assign these values to the names and you", "start": 106.64, "duration": 5.28}, {"text": "can see that the first function", "start": 109.6, "duration": 4.72}, {"text": "we take the parameters of a assign the", "start": 111.92, "duration": 3.92}, {"text": "value of one", "start": 114.32, "duration": 4.32}, {"text": "we try to assign the value of one to a", "start": 115.84, "duration": 4.639}, {"text": "using this anonymous function", "start": 118.64, "duration": 3.759}, {"text": "basically what it says is we define an", "start": 120.479, "duration": 3.68}, {"text": "another function", "start": 122.399, "duration": 4.881}, {"text": "it takes a and then we apply the", "start": 124.159, "duration": 3.841}, {"text": "function", "start": 127.28, "duration": 3.92}, {"text": "with 1 and then", "start": 128.0, "duration": 6.319}, {"text": "within the first function we try to bind", "start": 131.2, "duration": 4.56}, {"text": "another value", "start": 134.319, "duration": 4.56}, {"text": "2 to the name of b so we do the same", "start": 135.76, "duration": 3.76}, {"text": "thing", "start": 138.879, "duration": 3.681}, {"text": "we define another anonymous function and", "start": 139.52, "duration": 4.719}, {"text": "then we assign the 2", "start": 142.56, "duration": 4.72}, {"text": "to the function and now we have a equals", "start": 144.239, "duration": 3.921}, {"text": "to 1", "start": 147.28, "duration": 3.12}, {"text": "b equals to 2 and then we can perform", "start": 148.16, "duration": 3.04}, {"text": "our final", "start": 150.4, "duration": 4.559}, {"text": "computation a plus b and the result", "start": 151.2, "duration": 7.52}, {"text": "evaluated to three pretty simple", "start": 154.959, "duration": 6.481}, {"text": "now this is pretty ugly can we make it", "start": 158.72, "duration": 3.2}, {"text": "better", "start": 161.44, "duration": 2.799}, {"text": "for example like can we not do this", "start": 161.92, "duration": 3.12}, {"text": "weird stuff", "start": 164.239, "duration": 3.28}, {"text": "where one and a are spread from each", "start": 165.04, "duration": 4.16}, {"text": "other pretty far away", "start": 167.519, "duration": 3.761}, {"text": "and the more steps of computation we", "start": 169.2, "duration": 3.759}, {"text": "have the further away", "start": 171.28, "duration": 3.92}, {"text": "the name and the value will be this is", "start": 172.959, "duration": 4.0}, {"text": "not good of course we can", "start": 175.2, "duration": 3.6}, {"text": "so let's say that we define these two", "start": 176.959, "duration": 3.041}, {"text": "functions", "start": 178.8, "duration": 3.84}, {"text": "the first function is m bind basically", "start": 180.0, "duration": 5.28}, {"text": "just takes a value and a function", "start": 182.64, "duration": 5.84}, {"text": "and it applies the value to the function", "start": 185.28, "duration": 5.76}, {"text": "and then we have the end result it just", "start": 188.48, "duration": 4.08}, {"text": "returns the with", "start": 191.04, "duration": 3.839}, {"text": "the same value that passing this is same", "start": 192.56, "duration": 4.16}, {"text": "as the identity function", "start": 194.879, "duration": 4.08}, {"text": "so we have these two functions m-bind", "start": 196.72, "duration": 4.32}, {"text": "and m-cell some people call it magnetic", "start": 198.959, "duration": 2.801}, {"text": "bind", "start": 201.04, "duration": 4.16}, {"text": "and magnetic result it's basically the", "start": 201.76, "duration": 4.399}, {"text": "same thing", "start": 205.2, "duration": 2.88}, {"text": "and now that we have these two functions", "start": 206.159, "duration": 3.521}, {"text": "we can do this", "start": 208.08, "duration": 4.719}, {"text": "we can unbind a value to a function with", "start": 209.68, "duration": 5.44}, {"text": "the reverse order", "start": 212.799, "duration": 3.841}, {"text": "and the second step is the same we", "start": 215.12, "duration": 4.399}, {"text": "embind another value to another function", "start": 216.64, "duration": 5.04}, {"text": "and then finally we can have our final", "start": 219.519, "duration": 4.401}, {"text": "computation of m result", "start": 221.68, "duration": 5.919}, {"text": "a plus b so we bind a", "start": 223.92, "duration": 6.959}, {"text": "to one we bind b", "start": 227.599, "duration": 6.481}, {"text": "to two and we have a plus b which is", "start": 230.879, "duration": 5.601}, {"text": "three this looks better you can see that", "start": 234.08, "duration": 3.68}, {"text": "the name and the value", "start": 236.48, "duration": 4.399}, {"text": "are close to each other and", "start": 237.76, "duration": 5.119}, {"text": "they are on the same line but what is", "start": 240.879, "duration": 4.241}, {"text": "this to do with monet", "start": 242.879, "duration": 6.161}, {"text": "among that is exactly this two basic", "start": 245.12, "duration": 6.8}, {"text": "functions or a set of operations the", "start": 249.04, "duration": 5.04}, {"text": "magnetic bind and the magnetic result", "start": 251.92, "duration": 4.24}, {"text": "now we have this specific types of", "start": 254.08, "duration": 5.119}, {"text": "homonet called identity monet", "start": 256.16, "duration": 6.72}, {"text": "which has a magnetic", "start": 259.199, "duration": 6.56}, {"text": "result and magnetic bind the magnetic", "start": 262.88, "duration": 5.12}, {"text": "result is an identity function", "start": 265.759, "duration": 4.88}, {"text": "and the magnetic binding again is using", "start": 268.0, "duration": 4.56}, {"text": "have some identity characteristics", "start": 270.639, "duration": 4.721}, {"text": "i'll explain later so of course the end", "start": 272.56, "duration": 3.44}, {"text": "bind", "start": 275.36, "duration": 2.64}, {"text": "still not looking good because you can", "start": 276.0, "duration": 3.44}, {"text": "see that even though", "start": 278.0, "duration": 3.28}, {"text": "the names and the values are close to", "start": 279.44, "duration": 3.36}, {"text": "each other they are within the", "start": 281.28, "duration": 3.84}, {"text": "different scope we still have this", "start": 282.8, "duration": 3.52}, {"text": "separation", "start": 285.12, "duration": 3.359}, {"text": "between the name and the value because", "start": 286.32, "duration": 3.04}, {"text": "they are within", "start": 288.479, "duration": 4.401}, {"text": "different functions that's where", "start": 289.36, "duration": 6.08}, {"text": "macro is coming as a lisp we have the", "start": 292.88, "duration": 3.36}, {"text": "power", "start": 295.44, "duration": 3.52}, {"text": "of change our semantics so we define", "start": 296.24, "duration": 3.519}, {"text": "this run", "start": 298.96, "duration": 4.56}, {"text": "monet the normal net is a macro that", "start": 299.759, "duration": 4.321}, {"text": "given", "start": 303.52, "duration": 3.519}, {"text": "a monet what is the monette well not is", "start": 304.08, "duration": 3.839}, {"text": "two functions", "start": 307.039, "duration": 3.841}, {"text": "remember the amps and then by so this is", "start": 307.919, "duration": 5.361}, {"text": "exactly what this small net is", "start": 310.88, "duration": 6.4}, {"text": "and then given those steps", "start": 313.28, "duration": 8.479}, {"text": "steps is a pairs of names", "start": 317.28, "duration": 9.28}, {"text": "we call it war and values we call it val", "start": 321.759, "duration": 8.081}, {"text": "and it's a collection of these pairs", "start": 326.56, "duration": 5.44}, {"text": "and finally we have our n expression", "start": 329.84, "duration": 6.4}, {"text": "that's basically is the final expression", "start": 332.0, "duration": 7.52}, {"text": "so when we have the steps as a", "start": 336.24, "duration": 4.32}, {"text": "collection", "start": 339.52, "duration": 4.16}, {"text": "that is not empty we do the end bind", "start": 340.56, "duration": 6.4}, {"text": "recursively this is just templating but", "start": 343.68, "duration": 3.84}, {"text": "all it does", "start": 346.96, "duration": 3.28}, {"text": "is end binding function to the values", "start": 347.52, "duration": 3.679}, {"text": "recursively", "start": 350.24, "duration": 4.08}, {"text": "until we reach the last step", "start": 351.199, "duration": 6.081}, {"text": "when the step is empty we'll be going", "start": 354.32, "duration": 4.719}, {"text": "into the ending condition of", "start": 357.28, "duration": 5.12}, {"text": "having the end result apply", "start": 359.039, "duration": 5.801}, {"text": "to the final expression or the final", "start": 362.4, "duration": 3.68}, {"text": "computation", "start": 364.84, "duration": 4.6}, {"text": "and let's see what is this", "start": 366.08, "duration": 3.36}, {"text": "as you can see we have the identity", "start": 369.919, "duration": 3.28}, {"text": "monet which is", "start": 371.759, "duration": 3.201}, {"text": "again the end result and m bind", "start": 373.199, "duration": 4.161}, {"text": "functions and now we can", "start": 374.96, "duration": 5.04}, {"text": "assign the values to the names in a very", "start": 377.36, "duration": 4.0}, {"text": "convenient way", "start": 380.0, "duration": 5.039}, {"text": "and it looks very clean and nice", "start": 381.36, "duration": 6.959}, {"text": "and let's see what this actually is", "start": 385.039, "duration": 7.801}, {"text": "and what we can do is we use macro", "start": 388.319, "duration": 6.88}, {"text": "expand", "start": 392.84, "duration": 5.479}, {"text": "you can see that basically same thing is", "start": 395.199, "duration": 7.44}, {"text": "binding the function with", "start": 398.319, "duration": 8.521}, {"text": "the value and apply it to another", "start": 402.639, "duration": 5.921}, {"text": "function", "start": 406.84, "duration": 5.32}, {"text": "under the context of the identity moment", "start": 408.56, "duration": 6.96}, {"text": "and do it recursively", "start": 412.16, "duration": 3.36}, {"text": "so you can see that this is exactly this", "start": 420.72, "duration": 4.24}, {"text": "trying to make the match", "start": 425.759, "duration": 6.241}, {"text": "so m bind one function and bind two", "start": 429.28, "duration": 3.28}, {"text": "function", "start": 432.0, "duration": 3.52}, {"text": "and then end result final computation", "start": 432.56, "duration": 4.24}, {"text": "same thing", "start": 435.52, "duration": 3.76}, {"text": "m by under the contents of the monet", "start": 436.8, "duration": 6.32}, {"text": "which we define here globally", "start": 439.28, "duration": 3.84}, {"text": "apply 1 to the function", "start": 446.96, "duration": 7.6}, {"text": "which names the value as a and apply", "start": 450.8, "duration": 7.839}, {"text": "2 to the function having the name of b", "start": 454.56, "duration": 6.88}, {"text": "and finally the final expression a plus", "start": 458.639, "duration": 4.721}, {"text": "b", "start": 461.44, "duration": 4.24}, {"text": "so you can see that it expands to the", "start": 463.36, "duration": 3.6}, {"text": "same thing", "start": 465.68, "duration": 4.4}, {"text": "looks familiar yes this is exactly the", "start": 466.96, "duration": 6.239}, {"text": "same as the kosher late form", "start": 470.08, "duration": 5.519}, {"text": "so what is kosher led oh it's just remo", "start": 473.199, "duration": 3.761}, {"text": "net under the context", "start": 475.599, "duration": 3.6}, {"text": "of identity monet which means you're", "start": 476.96, "duration": 3.04}, {"text": "giving", "start": 479.199, "duration": 5.12}, {"text": "values names that's identity make sense", "start": 480.0, "duration": 6.72}, {"text": "now let's introduce the elgomone library", "start": 484.319, "duration": 3.041}, {"text": "is", "start": 486.72, "duration": 3.919}, {"text": "a culture library is very minimalistic", "start": 487.36, "duration": 5.92}, {"text": "that is very easy to understand and very", "start": 490.639, "duration": 4.721}, {"text": "easy to extend if you want to change it", "start": 493.28, "duration": 4.479}, {"text": "the feature is a little bit lagging it's", "start": 495.36, "duration": 4.08}, {"text": "a good library if you want to learn", "start": 497.759, "duration": 3.44}, {"text": "about monet but there are", "start": 499.44, "duration": 3.92}, {"text": "better libraries out there that if you", "start": 501.199, "duration": 4.241}, {"text": "actually want to use monet to help you", "start": 503.36, "duration": 3.44}, {"text": "with production systems", "start": 505.44, "duration": 4.4}, {"text": "we'll talk about that later so", "start": 506.8, "duration": 5.04}, {"text": "you can see that the alcohol monet", "start": 509.84, "duration": 3.52}, {"text": "basically is just", "start": 511.84, "duration": 4.16}, {"text": "same thing do more net we call it run", "start": 513.36, "duration": 5.28}, {"text": "monet but they're the same thing", "start": 516.0, "duration": 5.68}, {"text": "identity m which is remember", "start": 518.64, "duration": 5.759}, {"text": "the identity monet which has two", "start": 521.68, "duration": 3.92}, {"text": "functions", "start": 524.399, "duration": 3.841}, {"text": "or two types of operations and let's go", "start": 525.6, "duration": 5.359}, {"text": "into the library and see what is", "start": 528.24, "duration": 5.2}, {"text": "oh it's just m result and m bind and we", "start": 530.959, "duration": 3.841}, {"text": "saw its identity", "start": 533.44, "duration": 3.44}, {"text": "which takes a value and returns the", "start": 534.8, "duration": 6.4}, {"text": "value this is exactly what we have done", "start": 536.88, "duration": 4.32}, {"text": "and it evaluated to 3 same thing", "start": 541.92, "duration": 6.56}, {"text": "now let's look at the maybe type let's", "start": 546.16, "duration": 4.08}, {"text": "assume we want to perform", "start": 548.48, "duration": 4.56}, {"text": "three steps of computation first", "start": 550.24, "duration": 3.68}, {"text": "computation", "start": 553.04, "duration": 3.52}, {"text": "is some super duper computation but it", "start": 553.92, "duration": 3.599}, {"text": "will fail", "start": 556.56, "duration": 3.2}, {"text": "and returns the billion dollar mistake a", "start": 557.519, "duration": 3.841}, {"text": "no pointer", "start": 559.76, "duration": 3.12}, {"text": "and then we have the second step of", "start": 561.36, "duration": 4.0}, {"text": "computation that relies on the first", "start": 562.88, "duration": 4.639}, {"text": "computation but it also does some", "start": 565.36, "duration": 4.88}, {"text": "expensive computation", "start": 567.519, "duration": 4.561}, {"text": "here the computation let's say that it", "start": 570.24, "duration": 3.52}, {"text": "takes five seconds", "start": 572.08, "duration": 4.319}, {"text": "and finally we have a final computation", "start": 573.76, "duration": 4.4}, {"text": "which relies on the first two", "start": 576.399, "duration": 4.401}, {"text": "computation results", "start": 578.16, "duration": 5.76}, {"text": "and plus 42 and let's see", "start": 580.8, "duration": 10.159}, {"text": "what is this", "start": 583.92, "duration": 9.44}, {"text": "you can see that it takes a long wait", "start": 590.959, "duration": 3.121}, {"text": "around five", "start": 593.36, "duration": 3.2}, {"text": "seconds and then returns the no pointer", "start": 594.08, "duration": 3.52}, {"text": "exception", "start": 596.56, "duration": 3.279}, {"text": "let's say that for these types of", "start": 597.6, "duration": 3.2}, {"text": "computation", "start": 599.839, "duration": 3.68}, {"text": "we can have a maybe monet and maybe", "start": 600.8, "duration": 3.279}, {"text": "monet", "start": 603.519, "duration": 3.121}, {"text": "is basically an identity function again", "start": 604.079, "duration": 3.921}, {"text": "as the end result", "start": 606.64, "duration": 4.72}, {"text": "and magnetic bind function which", "start": 608.0, "duration": 7.12}, {"text": "applies the f with the value v", "start": 611.36, "duration": 6.8}, {"text": "except that it's time if the value is a", "start": 615.12, "duration": 4.32}, {"text": "new", "start": 618.16, "duration": 3.119}, {"text": "we will not do anything only if the", "start": 619.44, "duration": 3.28}, {"text": "value is not new", "start": 621.279, "duration": 4.321}, {"text": "then we apply the f function so you may", "start": 622.72, "duration": 3.28}, {"text": "ask", "start": 625.6, "duration": 3.76}, {"text": "what is the meaning of the function", "start": 626.0, "duration": 7.839}, {"text": "f here", "start": 629.36, "duration": 4.479}, {"text": "the f basically means the rest of the", "start": 633.92, "duration": 3.919}, {"text": "computation", "start": 636.72, "duration": 3.679}, {"text": "so you can see that the m bind function", "start": 637.839, "duration": 4.0}, {"text": "got executed", "start": 640.399, "duration": 5.041}, {"text": "between each step of the computations", "start": 641.839, "duration": 6.641}, {"text": "so by having defining the magnetic bond", "start": 645.44, "duration": 4.0}, {"text": "function here", "start": 648.48, "duration": 4.479}, {"text": "we can programmatically control", "start": 649.44, "duration": 5.92}, {"text": "what will happen for each step of the", "start": 652.959, "duration": 3.201}, {"text": "computation", "start": 655.36, "duration": 3.76}, {"text": "this is a very powerful characteristic", "start": 656.16, "duration": 6.239}, {"text": "let's see what this will do", "start": 659.12, "duration": 3.279}, {"text": "again run monet this time we use maybe", "start": 663.92, "duration": 5.039}, {"text": "monet", "start": 667.12, "duration": 3.839}, {"text": "and same thing first we do the super", "start": 668.959, "duration": 3.601}, {"text": "duper computation", "start": 670.959, "duration": 4.0}, {"text": "which will fail and returns the null and", "start": 672.56, "duration": 4.48}, {"text": "then we have another step of computation", "start": 674.959, "duration": 3.921}, {"text": "which relies on the previous", "start": 677.04, "duration": 4.799}, {"text": "computation result and also it takes", "start": 678.88, "duration": 3.68}, {"text": "around", "start": 681.839, "duration": 3.761}, {"text": "five seconds to finish and finally we", "start": 682.56, "duration": 3.6}, {"text": "have", "start": 685.6, "duration": 3.679}, {"text": "plus 42 a point on the previous", "start": 686.16, "duration": 5.919}, {"text": "computations", "start": 689.279, "duration": 2.8}, {"text": "you can see that it evaluated to the", "start": 693.12, "duration": 3.52}, {"text": "result", "start": 695.92, "duration": 3.359}, {"text": "new instantly we are not paying the", "start": 696.64, "duration": 3.6}, {"text": "price for this", "start": 699.279, "duration": 3.361}, {"text": "expensive computation here which takes", "start": 700.24, "duration": 3.44}, {"text": "five seconds", "start": 702.64, "duration": 5.12}, {"text": "we also don't use the previous fail", "start": 703.68, "duration": 7.279}, {"text": "computation returning the new value here", "start": 707.76, "duration": 6.8}, {"text": "and apply trying to add 42 to this", "start": 710.959, "duration": 6.401}, {"text": "new value how magical this is the power", "start": 714.56, "duration": 4.16}, {"text": "of magnetic binding", "start": 717.36, "duration": 3.599}, {"text": "you can see that for each steps of the", "start": 718.72, "duration": 4.559}, {"text": "computation we check the new value if", "start": 720.959, "duration": 3.12}, {"text": "it's new", "start": 723.279, "duration": 3.841}, {"text": "we simply do not apply rest of the", "start": 724.079, "duration": 4.76}, {"text": "computation", "start": 727.12, "duration": 5.6}, {"text": "amazing again the algomonet", "start": 728.839, "duration": 7.161}, {"text": "library has the same thing dumont is the", "start": 732.72, "duration": 4.32}, {"text": "remo net", "start": 736.0, "duration": 3.44}, {"text": "same thing it's just different names", "start": 737.04, "duration": 4.96}, {"text": "maybe m", "start": 739.44, "duration": 2.56}, {"text": "is basically the two sets of", "start": 742.56, "duration": 7.12}, {"text": "operations", "start": 746.959, "duration": 2.721}, {"text": "and we can ignore the m m 0 and m plus", "start": 750.24, "duration": 6.08}, {"text": "right now we don't use it the most", "start": 753.6, "duration": 4.32}, {"text": "important thing is the m result and the", "start": 756.32, "duration": 2.48}, {"text": "magnetic bind", "start": 757.92, "duration": 2.4}, {"text": "and you can see that same thing we", "start": 758.8, "duration": 3.12}, {"text": "perform the new check", "start": 760.32, "duration": 4.72}, {"text": "for the magnetic binds", "start": 761.92, "duration": 3.12}, {"text": "and let's evaluate this instant results", "start": 765.44, "duration": 6.639}, {"text": "now let's think about what is the monet", "start": 768.639, "duration": 4.0}, {"text": "again", "start": 772.079, "duration": 2.56}, {"text": "as you can see the monet here is about", "start": 772.639, "duration": 3.601}, {"text": "the magnetic bank right", "start": 774.639, "duration": 4.961}, {"text": "and i said the f represents", "start": 776.24, "duration": 5.92}, {"text": "the rest of the computation if you heard", "start": 779.6, "duration": 3.4}, {"text": "of the term", "start": 782.16, "duration": 3.76}, {"text": "continuation that's the same thing a", "start": 783.0, "duration": 4.279}, {"text": "continuation", "start": 785.92, "duration": 3.919}, {"text": "is the rest of the computation at a", "start": 787.279, "duration": 3.521}, {"text": "certain point", "start": 789.839, "duration": 4.0}, {"text": "of your program a monette we think is", "start": 790.8, "duration": 4.479}, {"text": "magnetic bind", "start": 793.839, "duration": 3.841}, {"text": "the f here is the rest of the", "start": 795.279, "duration": 4.161}, {"text": "computation except that the magnetic", "start": 797.68, "duration": 3.04}, {"text": "bind is executed", "start": 799.44, "duration": 4.24}, {"text": "for each step of the computation that's", "start": 800.72, "duration": 4.08}, {"text": "why it's so powerful", "start": 803.68, "duration": 2.959}, {"text": "that's why people call it the", "start": 804.8, "duration": 4.159}, {"text": "programmable semicolons", "start": 806.639, "duration": 6.0}, {"text": "but you might ask so all you can do is", "start": 808.959, "duration": 6.241}, {"text": "you insert computations in the", "start": 812.639, "duration": 4.32}, {"text": "sequential of computations", "start": 815.2, "duration": 4.8}, {"text": "that's not very useful right i'll say", "start": 816.959, "duration": 6.24}, {"text": "no it's i'll say not only that the monad", "start": 820.0, "duration": 3.92}, {"text": "can be", "start": 823.199, "duration": 5.281}, {"text": "apply computation in a sequence manner", "start": 823.92, "duration": 7.599}, {"text": "it can also achieve non-linearity what", "start": 828.48, "duration": 4.479}, {"text": "is nonlinearities", "start": 831.519, "duration": 4.0}, {"text": "if you are doing three traverse you can", "start": 832.959, "duration": 3.12}, {"text": "see that", "start": 835.519, "duration": 4.241}, {"text": "each branch of the knot can be traveled", "start": 836.079, "duration": 6.801}, {"text": "and to travel all the notes the size", "start": 839.76, "duration": 5.68}, {"text": "of your travel will become exponential", "start": 842.88, "duration": 3.68}, {"text": "so let's see", "start": 845.44, "duration": 3.839}, {"text": "sequence monet sequence monet is again", "start": 846.56, "duration": 3.76}, {"text": "two functions", "start": 849.279, "duration": 4.881}, {"text": "m result is a magnetic result this time", "start": 850.32, "duration": 7.04}, {"text": "we have list that means instead of", "start": 854.16, "duration": 4.72}, {"text": "identity function", "start": 857.36, "duration": 5.76}, {"text": "we always returns a list", "start": 858.88, "duration": 6.079}, {"text": "and also we have the magnetic bind what", "start": 863.12, "duration": 3.279}, {"text": "does the magnetic bind do", "start": 864.959, "duration": 3.44}, {"text": "the magnetic binding basically applies", "start": 866.399, "duration": 3.68}, {"text": "the function", "start": 868.399, "duration": 4.961}, {"text": "f the rest of the computation to the", "start": 870.079, "duration": 4.641}, {"text": "value of v", "start": 873.36, "duration": 4.96}, {"text": "and this time we map the rest", "start": 874.72, "duration": 7.2}, {"text": "of the computation f to the value v", "start": 878.32, "duration": 7.12}, {"text": "what is we we has a type the type of we", "start": 881.92, "duration": 6.4}, {"text": "is a list that's what the end result", "start": 885.44, "duration": 3.92}, {"text": "means", "start": 888.32, "duration": 4.24}, {"text": "it defines the type of the value of the", "start": 889.36, "duration": 4.64}, {"text": "topic here", "start": 892.56, "duration": 4.56}, {"text": "and then after we compute all the", "start": 894.0, "duration": 5.519}, {"text": "rest of the computation on each value of", "start": 897.12, "duration": 3.839}, {"text": "the wii we flatten", "start": 899.519, "duration": 4.801}, {"text": "the list into a single list instead of", "start": 900.959, "duration": 7.041}, {"text": "list of list let's see what this do", "start": 904.32, "duration": 7.36}, {"text": "we have a value", "start": 908.0, "duration": 7.04}, {"text": "of a list of five", "start": 911.68, "duration": 6.399}, {"text": "starting from zero zero one two three", "start": 915.04, "duration": 6.72}, {"text": "and we bind this value to a", "start": 918.079, "duration": 7.12}, {"text": "so a is a list of five numbers starting", "start": 921.76, "duration": 4.96}, {"text": "from zero", "start": 925.199, "duration": 5.681}, {"text": "same thing here we have a list of a", "start": 926.72, "duration": 7.44}, {"text": "and we bind the list of a to b remember", "start": 930.88, "duration": 3.759}, {"text": "a is", "start": 934.16, "duration": 3.28}, {"text": "the result of the first computation", "start": 934.639, "duration": 3.841}, {"text": "which is", "start": 937.44, "duration": 4.0}, {"text": "five numbers keep that in mind and", "start": 938.48, "duration": 3.919}, {"text": "finally we", "start": 941.44, "duration": 4.399}, {"text": "plus a and b together let's see what it", "start": 942.399, "duration": 5.281}, {"text": "does", "start": 945.839, "duration": 5.281}, {"text": "oh we have one two three three four five", "start": 947.68, "duration": 6.399}, {"text": "four five six seven so we are not just", "start": 951.12, "duration": 3.44}, {"text": "doing", "start": 954.079, "duration": 3.041}, {"text": "five computations so we are not just", "start": 954.56, "duration": 4.959}, {"text": "doing two steps of computations here", "start": 957.12, "duration": 5.36}, {"text": "it appears that we are doing one two", "start": 959.519, "duration": 3.361}, {"text": "three", "start": 962.48, "duration": 3.52}, {"text": "four five six seven eight nine ten ten", "start": 962.88, "duration": 4.399}, {"text": "computations here", "start": 966.0, "duration": 6.079}, {"text": "how is that let's try to trace this down", "start": 967.279, "duration": 8.8}, {"text": "let's print out the value of v here", "start": 972.079, "duration": 4.0}, {"text": "and let's fire up our useful repo", "start": 978.24, "duration": 7.68}, {"text": "and let's perform this computation again", "start": 983.04, "duration": 3.68}, {"text": "you can see", "start": 985.92, "duration": 4.08}, {"text": "for the first step we have", "start": 986.72, "duration": 7.039}, {"text": "the value as the five numbers and then", "start": 990.0, "duration": 7.199}, {"text": "for the second step range a", "start": 993.759, "duration": 6.801}, {"text": "the first of range a is an empty list", "start": 997.199, "duration": 4.161}, {"text": "why is that", "start": 1000.56, "duration": 4.079}, {"text": "oh it's because the first element of the", "start": 1001.36, "duration": 7.039}, {"text": "list is 0 and range 0 is empty list", "start": 1004.639, "duration": 5.841}, {"text": "and then for the second element is one", "start": 1008.399, "duration": 3.041}, {"text": "range one", "start": 1010.48, "duration": 4.88}, {"text": "is zero range two is zero one", "start": 1011.44, "duration": 6.959}, {"text": "range three is zero one two and range", "start": 1015.36, "duration": 3.52}, {"text": "four", "start": 1018.399, "duration": 3.68}, {"text": "is zero one two three oh so this", "start": 1018.88, "duration": 6.24}, {"text": "sequence smallnet is not linear it's a", "start": 1022.079, "duration": 4.0}, {"text": "nasty loop", "start": 1025.12, "duration": 3.04}, {"text": "it performs the second steps of", "start": 1026.079, "duration": 3.681}, {"text": "computation on each", "start": 1028.16, "duration": 5.519}, {"text": "element of the period step", "start": 1029.76, "duration": 3.919}, {"text": "again the algorithm on evolution is the", "start": 1034.16, "duration": 5.679}, {"text": "same thing except at this time", "start": 1036.24, "duration": 5.92}, {"text": "you can see that we use we actually use", "start": 1039.839, "duration": 4.561}, {"text": "the m result function", "start": 1042.16, "duration": 5.36}, {"text": "why is that first of all we have five", "start": 1044.4, "duration": 4.24}, {"text": "elements", "start": 1047.52, "duration": 2.64}, {"text": "and you can see that the difference of", "start": 1048.64, "duration": 4.08}, {"text": "the second step of computation is that", "start": 1050.16, "duration": 5.759}, {"text": "instead of making another range", "start": 1052.72, "duration": 8.16}, {"text": "or list of numbers we just return", "start": 1055.919, "duration": 4.961}, {"text": "plus 1 of a", "start": 1061.679, "duration": 2.88}, {"text": "and that is a number and remember for", "start": 1064.72, "duration": 4.0}, {"text": "each step of", "start": 1067.84, "duration": 3.04}, {"text": "the computation we are expecting the", "start": 1068.72, "duration": 3.52}, {"text": "value of we", "start": 1070.88, "duration": 4.32}, {"text": "to be the type of a list so that's where", "start": 1072.24, "duration": 3.84}, {"text": "the end result", "start": 1075.2, "duration": 2.96}, {"text": "the magnetic result comes in handy we", "start": 1076.08, "duration": 3.04}, {"text": "can always apply", "start": 1078.16, "duration": 4.0}, {"text": "a value with this m result and returns", "start": 1079.12, "duration": 4.48}, {"text": "the list type", "start": 1082.16, "duration": 4.48}, {"text": "so now the types are in line so we can", "start": 1083.6, "duration": 3.76}, {"text": "see that", "start": 1086.64, "duration": 3.12}, {"text": "for the first step we have five elements", "start": 1087.36, "duration": 4.16}, {"text": "for the second step", "start": 1089.76, "duration": 4.4}, {"text": "we increment the value of each element", "start": 1091.52, "duration": 4.56}, {"text": "by one but we are returning", "start": 1094.16, "duration": 3.44}, {"text": "at this so we are not breaking the", "start": 1096.08, "duration": 3.04}, {"text": "magnetic rules", "start": 1097.6, "duration": 4.959}, {"text": "or some called the magnetic laws", "start": 1099.12, "duration": 6.4}, {"text": "and now you might see this form before a", "start": 1102.559, "duration": 4.24}, {"text": "four", "start": 1105.52, "duration": 4.88}, {"text": "some people say there's a loop for each", "start": 1106.799, "duration": 7.041}, {"text": "a in the element of five", "start": 1110.4, "duration": 6.32}, {"text": "right but then again the second step is", "start": 1113.84, "duration": 4.64}, {"text": "a sequence monad", "start": 1116.72, "duration": 4.88}, {"text": "and it evaluated to the same thing", "start": 1118.48, "duration": 6.16}, {"text": "so this is not a single layers of loop", "start": 1121.6, "duration": 6.72}, {"text": "it's a nexted loop or also known as", "start": 1124.64, "duration": 7.76}, {"text": "the sequential net so", "start": 1128.32, "duration": 6.4}, {"text": "finally why do we care as closurist", "start": 1132.4, "duration": 4.0}, {"text": "because magnet is everywhere", "start": 1134.72, "duration": 3.6}, {"text": "people are using it without knowing it a", "start": 1136.4, "duration": 3.519}, {"text": "lot of people are using four", "start": 1138.32, "duration": 3.04}, {"text": "a lot of people are using these", "start": 1139.919, "duration": 3.601}, {"text": "comprehensions a lot of people are using", "start": 1141.36, "duration": 4.16}, {"text": "maybe types some language called", "start": 1143.52, "duration": 4.24}, {"text": "optionals and we are definitely everyone", "start": 1145.52, "duration": 3.519}, {"text": "is using the lab form", "start": 1147.76, "duration": 3.12}, {"text": "so how do i learn to use it pretty easy", "start": 1149.039, "duration": 5.121}, {"text": "we have this repo system like koshers", "start": 1150.88, "duration": 5.44}, {"text": "then we can learn any language concepts", "start": 1154.16, "duration": 3.36}, {"text": "using the rapport", "start": 1156.32, "duration": 3.12}, {"text": "you can wrap up this exercise and have", "start": 1157.52, "duration": 3.92}, {"text": "fun and there's", "start": 1159.44, "duration": 3.92}, {"text": "more useful types of homonets like", "start": 1161.44, "duration": 4.0}, {"text": "aeromonets so instead of the maybe", "start": 1163.36, "duration": 4.96}, {"text": "monet type we can have the error message", "start": 1165.44, "duration": 3.44}, {"text": "store", "start": 1168.32, "duration": 2.719}, {"text": "in the monet itself so that when things", "start": 1168.88, "duration": 4.72}, {"text": "go wrong we know what exactly is wrong", "start": 1171.039, "duration": 5.281}, {"text": "and we can have the trial monet", "start": 1173.6, "duration": 3.76}, {"text": "basically we", "start": 1176.32, "duration": 4.239}, {"text": "try each computation and if we catch an", "start": 1177.36, "duration": 5.84}, {"text": "error we wrap the error like an error", "start": 1180.559, "duration": 4.961}, {"text": "monet and pass it down", "start": 1183.2, "duration": 5.68}, {"text": "so that we have the exception handled by", "start": 1185.52, "duration": 5.279}, {"text": "the magnetic binding function", "start": 1188.88, "duration": 4.88}, {"text": "so we don't need to try catch every time", "start": 1190.799, "duration": 5.041}, {"text": "we call something that might fail", "start": 1193.76, "duration": 3.84}, {"text": "and then monet transformers are", "start": 1195.84, "duration": 3.6}, {"text": "interesting they combine", "start": 1197.6, "duration": 4.48}, {"text": "two monads together for example for the", "start": 1199.44, "duration": 4.08}, {"text": "sequence monet", "start": 1202.08, "duration": 4.959}, {"text": "for each steps of non-linear operations", "start": 1203.52, "duration": 5.039}, {"text": "it might still fail", "start": 1207.039, "duration": 4.801}, {"text": "what if we want to wrap the failure", "start": 1208.559, "duration": 5.841}, {"text": "using an arimonet that we can use a", "start": 1211.84, "duration": 4.079}, {"text": "monet transformer", "start": 1214.4, "duration": 3.84}, {"text": "to combine the arimonet and the sequence", "start": 1215.919, "duration": 3.201}, {"text": "moment", "start": 1218.24, "duration": 3.28}, {"text": "so again you can check out this", "start": 1219.12, "duration": 3.52}, {"text": "presentation", "start": 1221.52, "duration": 4.72}, {"text": "using this repository and feel free to", "start": 1222.64, "duration": 6.08}, {"text": "ask me questions about it thank you for", "start": 1226.24, "duration": 5.04}, {"text": "watching", "start": 1228.72, "duration": 2.56}]]
now the first topic that um i'm gonna
talk about today is probably using
closure to do functional programming so
when we talk about functional
programming most people will
say oh monets let's talk about how to
use closure to
write monet and then it's a
pretty useful skill actually i'll say
that it's like
a software design pattern
except that it's very powerful let's
get started
the operating system that i use is osx
the editor that i'm use
is space max
i like this setup because it's very
minimalistic
i don't need to spend a lot of time to
play with how to configure my emacs
and i don't need to spend a lot of time
to twinkle with the operating system
everything just works out of the box so
monads
i'm trying to answer these three
questions what are monets
why do we care as closureist and can we
understand it without knowing those
fancy types
this tutorial is inspired by conrad
tinsen's monet tutorial
it's a very good tutorial and it has
four parts
and it covers more topics but i found
that
using this rapport style to introduce
monets
is more visually easier to understand
for beginners
so let's get started let's try to make
the form bigger
so first how do we assign values to
names without defining stuff in the
global space
as you can see defining values in the
global space
is side effects functional programming
is all about getting rid of
side effects so let's say that we have
these anonymous functions and we try to
assign these values to the names and you
can see that the first function
we take the parameters of a assign the
value of one
we try to assign the value of one to a
using this anonymous function
basically what it says is we define an
another function
it takes a and then we apply the
function
with 1 and then
within the first function we try to bind
another value
2 to the name of b so we do the same
thing
we define another anonymous function and
then we assign the 2
to the function and now we have a equals
to 1
b equals to 2 and then we can perform
our final
computation a plus b and the result
evaluated to three pretty simple
now this is pretty ugly can we make it
better
for example like can we not do this
weird stuff
where one and a are spread from each
other pretty far away
and the more steps of computation we
have the further away
the name and the value will be this is
not good of course we can
so let's say that we define these two
functions
the first function is m bind basically
just takes a value and a function
and it applies the value to the function
and then we have the end result it just
returns the with
the same value that passing this is same
as the identity function
so we have these two functions m-bind
and m-cell some people call it magnetic
bind
and magnetic result it's basically the
same thing
and now that we have these two functions
we can do this
we can unbind a value to a function with
the reverse order
and the second step is the same we
embind another value to another function
and then finally we can have our final
computation of m result
a plus b so we bind a
to one we bind b
to two and we have a plus b which is
three this looks better you can see that
the name and the value
are close to each other and
they are on the same line but what is
this to do with monet
among that is exactly this two basic
functions or a set of operations the
magnetic bind and the magnetic result
now we have this specific types of
homonet called identity monet
which has a magnetic
result and magnetic bind the magnetic
result is an identity function
and the magnetic binding again is using
have some identity characteristics
i'll explain later so of course the end
bind
still not looking good because you can
see that even though
the names and the values are close to
each other they are within the
different scope we still have this
separation
between the name and the value because
they are within
different functions that's where
macro is coming as a lisp we have the
power
of change our semantics so we define
this run
monet the normal net is a macro that
given
a monet what is the monette well not is
two functions
remember the amps and then by so this is
exactly what this small net is
and then given those steps
steps is a pairs of names
we call it war and values we call it val
and it's a collection of these pairs
and finally we have our n expression
that's basically is the final expression
so when we have the steps as a
collection
that is not empty we do the end bind
recursively this is just templating but
all it does
is end binding function to the values
recursively
until we reach the last step
when the step is empty we'll be going
into the ending condition of
having the end result apply
to the final expression or the final
computation
and let's see what is this
as you can see we have the identity
monet which is
again the end result and m bind
functions and now we can
assign the values to the names in a very
convenient way
and it looks very clean and nice
and let's see what this actually is
and what we can do is we use macro
expand
you can see that basically same thing is
binding the function with
the value and apply it to another
function
under the context of the identity moment
and do it recursively
so you can see that this is exactly this
trying to make the match
so m bind one function and bind two
function
and then end result final computation
same thing
m by under the contents of the monet
which we define here globally
apply 1 to the function
which names the value as a and apply
2 to the function having the name of b
and finally the final expression a plus
b
so you can see that it expands to the
same thing
looks familiar yes this is exactly the
same as the kosher late form
so what is kosher led oh it's just remo
net under the context
of identity monet which means you're
giving
values names that's identity make sense
now let's introduce the elgomone library
is
a culture library is very minimalistic
that is very easy to understand and very
easy to extend if you want to change it
the feature is a little bit lagging it's
a good library if you want to learn
about monet but there are
better libraries out there that if you
actually want to use monet to help you
with production systems
we'll talk about that later so
you can see that the alcohol monet
basically is just
same thing do more net we call it run
monet but they're the same thing
identity m which is remember
the identity monet which has two
functions
or two types of operations and let's go
into the library and see what is
oh it's just m result and m bind and we
saw its identity
which takes a value and returns the
value this is exactly what we have done
and it evaluated to 3 same thing
now let's look at the maybe type let's
assume we want to perform
three steps of computation first
computation
is some super duper computation but it
will fail
and returns the billion dollar mistake a
no pointer
and then we have the second step of
computation that relies on the first
computation but it also does some
expensive computation
here the computation let's say that it
takes five seconds
and finally we have a final computation
which relies on the first two
computation results
and plus 42 and let's see
what is this
you can see that it takes a long wait
around five
seconds and then returns the no pointer
exception
let's say that for these types of
computation
we can have a maybe monet and maybe
monet
is basically an identity function again
as the end result
and magnetic bind function which
applies the f with the value v
except that it's time if the value is a
new
we will not do anything only if the
value is not new
then we apply the f function so you may
ask
what is the meaning of the function
f here
the f basically means the rest of the
computation
so you can see that the m bind function
got executed
between each step of the computations
so by having defining the magnetic bond
function here
we can programmatically control
what will happen for each step of the
computation
this is a very powerful characteristic
let's see what this will do
again run monet this time we use maybe
monet
and same thing first we do the super
duper computation
which will fail and returns the null and
then we have another step of computation
which relies on the previous
computation result and also it takes
around
five seconds to finish and finally we
have
plus 42 a point on the previous
computations
you can see that it evaluated to the
result
new instantly we are not paying the
price for this
expensive computation here which takes
five seconds
we also don't use the previous fail
computation returning the new value here
and apply trying to add 42 to this
new value how magical this is the power
of magnetic binding
you can see that for each steps of the
computation we check the new value if
it's new
we simply do not apply rest of the
computation
amazing again the algomonet
library has the same thing dumont is the
remo net
same thing it's just different names
maybe m
is basically the two sets of
operations
and we can ignore the m m 0 and m plus
right now we don't use it the most
important thing is the m result and the
magnetic bind
and you can see that same thing we
perform the new check
for the magnetic binds
and let's evaluate this instant results
now let's think about what is the monet
again
as you can see the monet here is about
the magnetic bank right
and i said the f represents
the rest of the computation if you heard
of the term
continuation that's the same thing a
continuation
is the rest of the computation at a
certain point
of your program a monette we think is
magnetic bind
the f here is the rest of the
computation except that the magnetic
bind is executed
for each step of the computation that's
why it's so powerful
that's why people call it the
programmable semicolons
but you might ask so all you can do is
you insert computations in the
sequential of computations
that's not very useful right i'll say
no it's i'll say not only that the monad
can be
apply computation in a sequence manner
it can also achieve non-linearity what
is nonlinearities
if you are doing three traverse you can
see that
each branch of the knot can be traveled
and to travel all the notes the size
of your travel will become exponential
so let's see
sequence monet sequence monet is again
two functions
m result is a magnetic result this time
we have list that means instead of
identity function
we always returns a list
and also we have the magnetic bind what
does the magnetic bind do
the magnetic binding basically applies
the function
f the rest of the computation to the
value of v
and this time we map the rest
of the computation f to the value v
what is we we has a type the type of we
is a list that's what the end result
means
it defines the type of the value of the
topic here
and then after we compute all the
rest of the computation on each value of
the wii we flatten
the list into a single list instead of
list of list let's see what this do
we have a value
of a list of five
starting from zero zero one two three
and we bind this value to a
so a is a list of five numbers starting
from zero
same thing here we have a list of a
and we bind the list of a to b remember
a is
the result of the first computation
which is
five numbers keep that in mind and
finally we
plus a and b together let's see what it
does
oh we have one two three three four five
four five six seven so we are not just
doing
five computations so we are not just
doing two steps of computations here
it appears that we are doing one two
three
four five six seven eight nine ten ten
computations here
how is that let's try to trace this down
let's print out the value of v here
and let's fire up our useful repo
and let's perform this computation again
you can see
for the first step we have
the value as the five numbers and then
for the second step range a
the first of range a is an empty list
why is that
oh it's because the first element of the
list is 0 and range 0 is empty list
and then for the second element is one
range one
is zero range two is zero one
range three is zero one two and range
four
is zero one two three oh so this
sequence smallnet is not linear it's a
nasty loop
it performs the second steps of
computation on each
element of the period step
again the algorithm on evolution is the
same thing except at this time
you can see that we use we actually use
the m result function
why is that first of all we have five
elements
and you can see that the difference of
the second step of computation is that
instead of making another range
or list of numbers we just return
plus 1 of a
and that is a number and remember for
each step of
the computation we are expecting the
value of we
to be the type of a list so that's where
the end result
the magnetic result comes in handy we
can always apply
a value with this m result and returns
the list type
so now the types are in line so we can
see that
for the first step we have five elements
for the second step
we increment the value of each element
by one but we are returning
at this so we are not breaking the
magnetic rules
or some called the magnetic laws
and now you might see this form before a
four
some people say there's a loop for each
a in the element of five
right but then again the second step is
a sequence monad
and it evaluated to the same thing
so this is not a single layers of loop
it's a nexted loop or also known as
the sequential net so
finally why do we care as closurist
because magnet is everywhere
people are using it without knowing it a
lot of people are using four
a lot of people are using these
comprehensions a lot of people are using
maybe types some language called
optionals and we are definitely everyone
is using the lab form
so how do i learn to use it pretty easy
we have this repo system like koshers
then we can learn any language concepts
using the rapport
you can wrap up this exercise and have
fun and there's
more useful types of homonets like
aeromonets so instead of the maybe
monet type we can have the error message
store
in the monet itself so that when things
go wrong we know what exactly is wrong
and we can have the trial monet
basically we
try each computation and if we catch an
error we wrap the error like an error
monet and pass it down
so that we have the exception handled by
the magnetic binding function
so we don't need to try catch every time
we call something that might fail
and then monet transformers are
interesting they combine
two monads together for example for the
sequence monet
for each steps of non-linear operations
it might still fail
what if we want to wrap the failure
using an arimonet that we can use a
monet transformer
to combine the arimonet and the sequence
moment
so again you can check out this
presentation
using this repository and feel free to
ask me questions about it thank you for
watching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment