Transcript from the "Maybe Overview" Lesson
 on an array that is empty. So what about in Elm?
[00:00:42] Elm doesn't have a concept of undefined, so clearly it's going to have to do something else. So here I'm defining the same function. First users =, and I'm saying List.head users. So in Elm, List.head means gives me the first element in the list. I can call first passing Sam and Jess.
[00:01:15] Well, those are basically part of a unit type call, sorry a custom type call maybe. So it's kind of like compare the implications of using these two different approaches. So here we saw two different outcomes. Calling it with an array that was not empty, that had Sam as the first element, got us back Sam.
[00:01:35] Calling it with empty array got us back undefined. On the Elm side, we got back just and nothing. So if I were to call first our new users, it's new users being either Sam or undefined. And I call .length on that, It'll give me back two if I successfully got back something valid.
[00:01:56] Or I might give back, hey cannot read property length of undefined. Like I said, that should be a three, Sam has three letters in it. In contrast, the Elm version I have just "Sam" and Nothing. Because this is not a string, this is actually a wrapper around a string, this is a custom type wrapper around a string.
[00:02:17] I have to do a case expression on it before I can actually do anything with that string. So I can say case first newUsers of and if I got a Just, then I unwrap the string in there and give it a name, I'll call it user. And now I can call String.length on that, that'll work.
[00:02:34] If I got Nothing, I have to do something else, I don't have the user in scope to attempt to do anything on. So, maybe I'll just default to returning 0. So the difference here is that if I want to operate on the results of List.head, I first have to run this case expression to deal with the two variants inside this custom type know as maybe.
[00:02:56] If I got adjust, then I can actually work on it. If I got Nothing, I can't work on it. And so this is the difference, List.head will give you back just wrapped around the particular value inside the list that was there if it found one. And if the list was empty, it will give you back nothing.
[00:03:13] Which doesn't wrap anything, because in that circumstance, there is nothing to give back.
>> Richard Feldman: So if we call List.head passing Sam and Jess, we get back to Sam. List.head of Sam and Jess is being called on a list of strings and we get back what's known as a Maybe String.
[00:03:32] So Maybe is a parameterize type and its type parameter matches the list that it got. So if I call List.head on two floats, that would give me back a Maybe Float. And of course, if I call List.head on two Booleans, it would give me back a Maybe Bool.