title: Designing a purely functional web application handler in Scala
body: <p>In a webapplication a handler typically consists of a function taking a Request and return a Response:</p>
  
  <pre><code>val handler:Request=&gt;Response
  </code></pre>
  
  <p>What would the the "most pure" functional approach if <em>handler</em> takes some parameters from the Requests, changes some shared mutable state (for example a database), and then return a Response?</p>