title: How to create a data (or preferabbly newtype) wrapper for a constrained function?
body: <p>I'd like to create a type that holds a particular class of functions. Hopefully this is the right way to go about it (maybe <code>newtype</code> would be better? but I'm using GADTs):</p>
  
  <pre><code>data TraversableFun t a where
    TraversableFun :: Traversable t =&gt; (t a -&gt; a) -&gt; TraversableFun (t a -&gt; a)
  </code></pre>
  
  <p>This results in the error:</p>
  
  <pre><code>    • Expecting one more argument to ‘TraversableFun (t a -&gt; a)’
        Expected a type, but ‘TraversableFun (t a -&gt; a)’ has kind ‘k0 -&gt; *’
      • In the type ‘TraversableFun (t a -&gt; a)’
        In the definition of data constructor ‘TraversableFun’
        In the data declaration for ‘TraversableFun’
     |
  55 |   TraversableFun :: Traversable t =&gt; (t a -&gt; a) -&gt; TraversableFun (t a -&gt; a)
     |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  </code></pre>
  
  <p>I'm pretty sure I'm doing something similar here, maybe I should just sleep on it, but it's 5 PM on a Friday.</p>