title: elm - executing multiple lines in a function
body: <p>In elm, is something like the below possible</p>
  
  <pre class="lang-elm prettyprint-override"><code>foo : Int -&gt; Html
  foo inputNum =
    addToNumHistory inputNum ;
    display inputNum
  </code></pre>
  
  <p>where the aim of the above is to execute multiple lines of code?</p>
  
  <p>If not, is this because the above is an example of a side effect?</p>
  
  <p>If something like the above syntax is not possible, how would one go about executing two functions/lines of code simultaneously, as in the above, or as a result of a given input (case branch) ?</p>
  
  <h2>Edit</h2>
  
  <p>The above is a bad example. The following uses the Elm Architecture:</p>
  
  <pre class="lang-elm prettyprint-override"><code>--Model
  type alias Model =
    { number : Int
    , numberHistory : List Int
    }
  
  type Action
    = Number Int
  
  
  --Update
  update : Action -&gt; Model
  update action =
    case action of
      Number num-&gt;
        addToNumHistory num           
  
  addToNumHistory : Int -&gt; Model -&gt; Model 
  addToNumHistory num modelHistory =
    { model 
      | number = num
      , numberHistory = num :: model.numberHistory
    }
  
  --View     
  view : Signal.Address Action -&gt; Model -&gt; Html
  view action model =
    div []
      [  field 
         "text" 
         address 
         Number model.number
         "Enter lucky number here pal!"
         model.number 
      ]
  </code></pre>
  
  <p>Given this, am I right in presuming that to 'execute multiple lines' in such a fashion as to alter an underlying model, one would simply use/extend the model - for example, to effect a change analogous to the following:</p>
  
  <pre class="lang-elm prettyprint-override"><code>--Update
  update : Action -&gt; Model
  update action =
    case action of
      Number num-&gt;
        addToNumHistory num;
        addToChangeHistory
  </code></pre>
  
  <p>one would simply extend the model as follows:</p>
  
  <pre class="lang-elm prettyprint-override"><code>--Model
  type alias Model =
    { number : Int
    , numberHistory : List Int
    , changeHistory : List Date
    }
  
  --Update
  update : Action -&gt; Model
  update action =
    case action of
      Number num-&gt;
        addToNumHistoryWithChangeHistory num
  
  addToNumHistoryWithChangeHistory : Int -&gt; Model -&gt; Model 
  addToNumHistory num modelHistory =
    { model 
      | number = num
      , numberHistory = num :: model.numberHistory
      , changeHistory = getCurrentDate :: model.changeHistory
    }
  
  getCurrentDate : Date
  </code></pre>