Instructor: Let's make our data constructor with the keyword, data. Foo equals foo, pipe, then bar, and string. This is saying we have a data constructor of foo, and it has two types of foo and bar, which expects a string.
Let's make a function runFoo, with the types of foo to string. Now, we're going to do a bit of pattern matching. On the next line, runFoo foo equals a string of, "Damn right, it's foo." If we look to the right, we have an error.
What it's saying is that all the cases in the foo constructor haven't been covered. We've done runFoo foo. Now, we also need to do runFoo bar, S for the string. Then that equals, "Yeah, and it's bar," and the symbols less than, greater than S.
Let's see this in action by typing runFoo, foo. As you can see, it outputs, "Damn right, it's foo." If we look at runFoo, it did a pattern match on foo, and gave us back the string, "Damn right, it's foo." Let me explain something.
It might be a little bit confusing when we look at data foo equals foo, then bar, string. What we'll do is we'll change the second value to foo one. On line 10, we'll change foo one there. Now, you can see that on line nine, we have runFoo, which uses a data constructor of foo, which tells us that we need to pattern match against foo on and bar.
Let's test this out. We'll go to runFoo, and we will change it to bracket, bar, and then the string, "His buddy." I'll runFoo function pattern matches on the bar, and it takes the S as, "His buddy." It concatenates S, which is, "His buddy." It's, "Yeah, it's bar and his buddy."
It should be added that if you were to do runFoo, bar, and then say one, the compiler would fail with a type error, because it is expecting a string. There you have it, some basic data constructors in PureScript.