Hook
I thought I could get away with not knowing Haskell. Turns out I can't, so I went to read a tutorial about it, like the basic stuff, and it is actually kind of interesting. So the way function calls work in Haskell is you give a function name, then you pass in the arguments, all with space in between. You can understand it as a function with a list of arguments, but the way it actually works is that the function takes the first argument, returns another function, then this function takes the second argument. So essentially there's currying happening at every function call. You can also put the arguments in between parentheses, but now it means a very different thing. Now this function only takes one argument and this big tuple of your arguments. Like the white space in between is almost like an operator. It has a meaning, it's a function application, and it has the highest priority in execution. If we see this white space as a function application operator and it's left binding, means any value is from left to right, the left one takes the higher priority. And there is a $ operator which is like reverse white space. So instead of white space you put a $ in there, then it becomes right binding and it takes the lowest precedence. For example, I have a function that takes one argument. If I say this function, then I pass 1+1 to it, because it's a white space in between it, it actually takes the first one, apply this function to the one, then try to plus one on top of it. Whereas if I put $ between, it actually reverses the whole thing. It becomes left binding and it takes lowest precedence, which means the plus will be evaluated first. So we are now applying this function to the value of 2, which is the result of 1+1.
More breakout videos from this creator.