title: Haskell "pseudo-functor"
body: <p>I have a polynomial</p>
  
  <pre><code>data Poly a = Poly [a]
  </code></pre>
  
  <p>I would like to be able to do something like <code>fmap (take  3) polynomial</code> but I can't since <code>Poly</code> isn't really a functor in that the <code>f</code> I use in <code>fmap</code> can only be of type <code>[a] -&gt; [b]</code>, not <code>a -&gt; b</code>.</p>
  
  <p>Is there an idiom or way I can express what I want?</p>
  
  <hr>
  
  <p>EDIT: here is a function which does what I want</p>
  
  <pre><code>myMap :: ([a] -&gt;[b]) -&gt; P a -&gt; P b
  myMap f (P x) = P (f x)
  </code></pre>
  
  <p>usage:</p>
  
  <pre><code>*Main&gt; myMap (take 3) (P [1..])
  P [1,2,3]
  </code></pre>
  
  <p>You can see from the type sig that it's <em>almost</em> fmap, but not quite. I'm obviously capable of writing the code for <code>myMap</code>, but I just want to know if there's another idiom I should be using instead.</p>