FmapFunc is just a test module I created with<br><br>instance Functor ((-&gt;) r) where ...<br><br>  -- ryan<br><br><div class="gmail_quote">On Tue, Aug 31, 2010 at 12:03 PM, michael rice <span dir="ltr">&lt;<a href="mailto:nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">
Hi, Ryan and all,<br><br>Bingo! I guess my question was all right after all.<br><br>I tried creating an instance earlier but <br><br>*Main&gt; :t (-&gt;) Int Char<br><br>&lt;interactive&gt;:1:1: parse error on input `-&gt;&#39;<br>
<br>What got loaded with FmapFunc? I Hoogled it and got back nothing.<br><br>Michael<br><br>--- On <b>Tue, 8/31/10, Ryan Ingram <i>&lt;<a href="mailto:ryani.spam@gmail.com" target="_blank">ryani.spam@gmail.com</a>&gt;</i></b> wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Ryan Ingram &lt;<a href="mailto:ryani.spam@gmail.com" target="_blank">ryani.spam@gmail.com</a>&gt;<div class="im">
<br>Subject: Re: [Haskell-cafe] On to applicative<br>To: &quot;michael rice&quot; &lt;<a href="mailto:nowgate@yahoo.com" target="_blank">nowgate@yahoo.com</a>&gt;<br></div>Cc: &quot;Vo Minh Thu&quot; &lt;<a href="mailto:noteed@gmail.com" target="_blank">noteed@gmail.com</a>&gt;, <a href="mailto:haskell-cafe@haskell.org" target="_blank">haskell-cafe@haskell.org</a><br>
Date: Tuesday, August 31, 2010, 2:36 PM<div><div></div><div class="h5"><br><br><div>Prelude FmapFunc&gt; let s = show :: ((-&gt;) Int) String<br>Prelude
 FmapFunc&gt; :t s<br>s :: Int -&gt; String<br>Prelude FmapFunc&gt; let v = fmap (&quot;hello &quot; ++) s<br>Prelude FmapFunc&gt; :t v<br>v :: Int -&gt; String<br>
Prelude FmapFunc&gt; v 1<br>&quot;hello 1&quot;<br><br>  -- ryan<br><br><div>On Tue, Aug 31, 2010 at 11:28 AM, michael rice <span dir="ltr">&lt;<a rel="nofollow" href="http://mc/compose?to=nowgate@yahoo.com" target="_blank">nowgate@yahoo.com</a>&gt;</span> wrote:<br>

<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">
I&#39;m not sure if my terminology is correct or even if my question makes sense, but I can create &quot;instances&quot; of Maybe, List, IO, and Either.<br><br>Prelude Data.Either&gt; let m = Just 7<br>Prelude Data.Either&gt; :t m<br>

m :: Maybe Integer<br><br>Prelude Data.Either&gt; let l = 2:[]<br>Prelude Data.Either&gt; :t l<br>l :: [Integer]<br><br>Prelude Data.Either&gt; let g = getLine<br>Prelude Data.Either&gt; :t g<br>g :: IO String<br><br>Prelude Data.Either&gt; let e = Right &quot;abc&quot;<br>

Prelude Data.Either&gt; :t e<br>e :: Either a [Char]<br><br>All these instances are functors, each with its own version of fmap that can be applied to it.<br><br>How can I similarly create an instance of (-&gt;) so I can apply (-&gt;)&#39;s version of fmap<br>

<br>instance Functor ((-&gt;) r) where  <br>    fmap f g = (\x -&gt; f (g x))<br><br>to
 it?<div><br><br>Michael<br><br>--- On <b>Tue, 8/31/10, Vo Minh Thu <i>&lt;<a rel="nofollow" href="http://mc/compose?to=noteed@gmail.com" target="_blank">noteed@gmail.com</a>&gt;</i></b> wrote:<br></div><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">

<div><br>From: Vo Minh Thu &lt;<a rel="nofollow" href="http://mc/compose?to=noteed@gmail.com" target="_blank">noteed@gmail.com</a>&gt;<br>Subject: Re: [Haskell-cafe] On to applicative<br>To: &quot;michael rice&quot; &lt;<a rel="nofollow" href="http://mc/compose?to=nowgate@yahoo.com" target="_blank">nowgate@yahoo.com</a>&gt;<br>

Cc: <a rel="nofollow" href="http://mc/compose?to=haskell-cafe@haskell.org" target="_blank">haskell-cafe@haskell.org</a><br></div>Date: Tuesday, August 31, 2010, 1:50 PM<div><div></div><div><br><br><div>2010/8/31 michael rice &lt;<a rel="nofollow" href="http://mc/compose?to=nowgate@yahoo.com" target="_blank">nowgate@yahoo.com</a>&gt;<br>

&gt;<br>&gt; So it&#39;s a type constructor, not a type? Could you please provide a simple example of its usage?<br><br>Sure, although I&#39;m sure you&#39;ve come by some already.<br><br>-- the identity function<br>id :: a -&gt; a<br>

-- often, we write it like this:<br>-- id x = x<br>-- but here we see the relationship between the ananymous function<br>syntax and the function
 type:<br>id = \x -&gt; x<br><br>In fact, if you write in prefix form, it is quite familiar:<br>f :: (-&gt;) Int Bool<br>e = Either String Float<br><br>Cheers,<br>Thu<br><br>&gt; Michael<br>&gt;<br>&gt; --- On Tue, 8/31/10, Vo Minh Thu &lt;<a rel="nofollow" href="http://mc/compose?to=noteed@gmail.com" target="_blank">noteed@gmail.com</a>&gt; wrote:<br>

&gt;<br>&gt; From: Vo Minh Thu &lt;<a rel="nofollow" href="http://mc/compose?to=noteed@gmail.com" target="_blank">noteed@gmail.com</a>&gt;<br>&gt; Subject: Re: [Haskell-cafe] On to applicative<br>&gt; To: &quot;michael rice&quot; &lt;<a rel="nofollow" href="http://mc/compose?to=nowgate@yahoo.com" target="_blank">nowgate@yahoo.com</a>&gt;<br>

&gt; Cc: <a rel="nofollow" href="http://mc/compose?to=haskell-cafe@haskell.org" target="_blank">haskell-cafe@haskell.org</a><br>&gt; Date: Tuesday, August 31, 2010, 1:17 PM<br>&gt;<br>&gt; 2010/8/31 michael rice &lt;<a rel="nofollow" href="http://mc/compose?to=nowgate@yahoo.com" target="_blank">nowgate@yahoo.com</a>&gt;<br>

&gt; &gt;<br>&gt; &gt; &quot;Learn You a Haskell ...&quot;  says that (-&gt;) is a type just like Either. Where can I find its type definition?<br>&gt;<br>&gt; You can&#39;t define it *in* Haskell as user code. It is a built-in infix<br>

&gt; type constructor (Either or Maybe are type constructors too, not just<br>&gt; types). In fact, if you want to implement a simple, typed functional<br>&gt; language, you&#39;ll find it is the only built-in type constructor you<br>

&gt; have to implement (as the implementor of the language).<br>&gt;<br>&gt; Also,<br>&gt;   Show a =&gt; a<br>&gt; is a type too, but you won&#39;t find a definition for &#39;a&#39; or for &#39;=&gt;&#39;.<br>&gt; All those things are defined by the language.<br>

&gt;<br>&gt; Cheers,<br>&gt; Thu<br>&gt;<br></div></div></div></blockquote></td></tr></tbody></table><br>

      <br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a rel="nofollow" href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>
</div></div></div></blockquote></td></tr></tbody></table><br>

      </blockquote></div><br>