If we change the variants' constructors to pass a string to them to represent each possible category (for example Facebook(string), which could give Facebook("social") or Facebook("business")), we can do the trick. The additional pattern matching could then be something like this:
Facebook(str) => switch str {
| "social" => "facebook, messenger, instagram"
| "business" => "facebook ads"
So, let's start the second version of our code by defining the internet company variant type, as follows:
type internetCompany =
| Facebook(string)
| Google(string)
| Twitter(string);
And, as we planned, our function's pattern matching code could evolve, as follows:
let apps = (company: internetCompany) : string => {
switch (company) {
...