title: Scala type keyword: how best to use it across multiple classes
body: <p>Coming back to Scala after a spell writing Haskell, I've started using the type keyword to make my class definitions a bit more readable, eg:</p>
  
  <pre><code>type RestfulParams = Map[String, String]
  def canonicalize(params: RestfulParams): String = { ... }
  </code></pre>
  
  <p>The trouble I've run into is that these type definitions need to live inside a class or object - they're not "first class citizens" like they are in Haskell. If I try to define a type outside of a class or object, I get a compiler <code>expected class or object definition</code>.</p>
  
  <p>My problem then is how to use these types across multiple classes and objects in a package? What I've done now seems quite ugly:</p>
  
  <pre><code>object RestfulTypes { type RestfulParams = Map[String, String] etc }
  </code></pre>
  
  <p>And then in another class file:</p>
  
  <pre><code>import utils.{RestfulTypes =&gt; RT}
  def get(resource: String, params: RT.RestfulParams): String = { ... }
  </code></pre>
  
  <p>Is there a nicer way of doing this - and incidentally do the Scala gurus think it's a good thing or a bad thing that types can only be defined inside classes/objects?</p>