Lesson 3: Validation functions

Video
  • 15 minutes
Tags
case expression pattern matching Maybe

In this lesson we get into the code that we will stay with through the rest of the course. To start, we need to write three functions. One checks a String for a maximum length. The second verifies that a String input is all alphanumeric characters – no special characters allowed in our passwords! The third will strip any leading white space off of a String input. All three return a Maybe String, so invalid inputs are all Nothing. This lesson ends with an exercise for the viewer.