title: typealias generic function
body: <p>As a learning exercise I'm trying to write a small functional library. Many of the functions in my library require a function to be passed in. I would like to "typealias" this function so that the user of my library has to pass in a function with a specific signature.</p>
  
  <p>I've tried this:</p>
  
  <p><code>typealias Callback = Result&lt;AnyObject&gt; -&gt; ()</code></p>
  
  <p>This kind of works but I would like the <code>AnyObject</code> part to be <em>anything</em>. Not specifically <code>AnyObject</code>, since that's actually some kind of real type(?). My <code>Result</code> enum i based on this <a href="http://owensd.io/2014/07/09/error-handling.html" rel="nofollow">article</a> about error handling in Swift. It's a generic enum, so that's what I want to reflect in my function signatures.</p>
  
  <p>If I remove the <code>&lt;AnyObject&gt;</code> part I get an error saying:</p>
  
  <blockquote>
    <p>Reference to generic type 'Result' requires arguments in &lt;...></p>
  </blockquote>
  
  <p>And if I just to <code>Result&lt;T&gt;</code> I get the error:</p>
  
  <blockquote>
    <p>Use of undeclared type 'T'</p>
  </blockquote>
  
  <p>As far as I've understood it it's not possible to typealias generics. So.. is there away around this?</p>
  
  <p>TLDR;</p>
  
  <p>I have a bunch of functions that I want to take a function of a specific signature as a parameter, in my case:</p>
  
  <p><code>(result: Result&lt;T&gt;) -&gt; ()</code></p>
  
  <p>How do I force this?</p>