These are chat archives for ramda/ramda

Dec 2018
Shane Keulen
Dec 13 2018 19:43 UTC

am i correct that with the introduction of "module: es/index.js" that with webpack 4 i should no longer need babel-plugin-ramda or similar since tree shaking would actually give me a smaller bundle size

(i'm doing testing and that is what i'm seeing but just hoping that my assumption is correct)

Ian Hofmann-Hicks
Dec 13 2018 21:41 UTC
@rakeshpai Sorry one thing I forgot to mention about the Maybe datatype, it is in fact way more than just a null checker, it implements a pattern that is as close as we can get to a Set Union between two types. So if you have a Maybe String, that is actually a Union of all Strings that can be created with JavaScript and a special Unit type, which is any singleton set in JS (Null/Undefined, but typically undefined) so you can think of Maybe as 1 + a, and because of that + it is called a Sum Type (the addition of two types). In type notation, we typically show unit as () so Maybe is really defined as Maybe () a, but it is always fixed to that () on the left Nothing, so we typically remove it from the siggy and just write Maybe a. On the right is the Just, or that any type a. And the reason we have both Nothingand Just is because Maybe is more than just a Union Type, it is actually what is called a Tagged Union, and tells you which side the value came from. In our case we tell which side it is based on the instance type of either Nothing or Just. It does not matter too much with Maybe, but there are times we care with other Sum Types like Either, like if we have Either Number Number (Number + Number), we know we have a Number, But from which side? A Number from the Left has a different context as the Number from the Right. <end theory>
Ian Hofmann-Hicks
Dec 13 2018 21:48 UTC
Also that Unit type is what people in Category Theory call a Terminal Object in the Category of JavaScript Types and Functions for a little google search bait