title: Updating a Maybe Record in Elm
body: <p>I have an app where a user can create projects. The <code>currentProject</code> in the model is a <code>Maybe Project</code> type with the initial value set to <code>Nothing</code> (since there may be no projects created yet by that user).</p>
  
  <pre><code>type alias Project =
      { name : String }
  
  type alias Model =
      { user : User
      , currentProject : Maybe Project
      }
  </code></pre>
  
  <p>This is in the <code>init</code> for the Model:</p>
  
  <p><code>currentProject = Nothing</code></p>
  
  <p>I then have a dropdown where the user can select a project. Upon selecting it the <code>onClick</code> calls the following update:</p>
  
  <pre><code>type Msg
      = ...
      | SetProject Project
  </code></pre>
  
  <p>The update function that I try to run looks like this:</p>
  
  <pre><code>SetProject project -&gt;
      case project of
         Just project -&gt;
           ( { model | currentProject = project }, Cmd.none )
  
         Nothing -&gt;
           ( model, Cmd.none )
  </code></pre>
  
  <p>I get an error because <code>project</code> is of type <code>Project</code> and not <code>Maybe Project</code>. </p>
  
  <p>I know the project exists because it's coming from an existing list of projects in the app. But, I cannot set <code>currentProject</code> to type <code>Project</code> because I need to initialize the Model with <code>Nothing</code>.</p>
  
  <p>So, how can I update the <code>Maybe Project</code> record with type <code>Project</code>?</p>