GHC: Ticket #3335: make some Applicative functions into methods, and split off Data.Functor
http://ghc.haskell.org/trac/ghc/ticket/3335
<p>
The following functions
</p>
<pre class="wiki">(<$) :: Functor f => a -> f b -> f a
(*>) :: Applicative f => f a -> f b -> f b
(<*) :: Applicative f => f a -> f b -> f a
some :: Alternative f => f a -> f [a]
many :: Alternative f => f a -> f [a]
</pre><p>
are moved into the corresponding classes, with the existing implementations as default definitions. This gives people creating instances the option of defining specialized implementations of these functions, though they should be equivalent to the default definitions.
</p>
<p>
Although (<$) is now a method of the Functor class, it is hidden in the re-export by the Prelude, Control.Monad and Monad. The new module Data.Functor exposes the full class, plus the function (<$>). These are also re-exported by Control.Applicative.
</p>
<p>
Discussion on libraries@… to 20th July 2009.
</p>
en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/3335
Trac 1.2rossMon, 29 Jun 2009 12:43:37 GMTattachment set
http://ghc.haskell.org/trac/ghc/ticket/3335
http://ghc.haskell.org/trac/ghc/ticket/3335
<ul>
<li><strong>attachment</strong>
set to <em>ApplicativeMethods.patch</em>
</li>
</ul>
<p>
patch
</p>
TicketrossMon, 29 Jun 2009 12:49:31 GMTattachment set
http://ghc.haskell.org/trac/ghc/ticket/3335
http://ghc.haskell.org/trac/ghc/ticket/3335
<ul>
<li><strong>attachment</strong>
set to <em>ApplicativeMethods.2.patch</em>
</li>
</ul>
<p>
patch
</p>
TicketiglooMon, 13 Jul 2009 10:57:47 GMTdifficulty, milestone set
http://ghc.haskell.org/trac/ghc/ticket/3335#comment:1
http://ghc.haskell.org/trac/ghc/ticket/3335#comment:1
<ul>
<li><strong>difficulty</strong>
set to <em>Unknown</em>
</li>
<li><strong>milestone</strong>
set to <em>Not GHC</em>
</li>
</ul>
TicketrossWed, 16 Sep 2009 08:19:47 GMTstatus changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/3335#comment:2
http://ghc.haskell.org/trac/ghc/ticket/3335#comment:2
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
There was substantial discussion by 8 people over 2 months.
</p>
<ul><li>Making these methods redefinable allows significantly more efficient implementations for some instances (e.g. (<$) for Seq, (*>) and (<*) for parsers Edward Kmett is working on, some and many for first/empty calculations for recursive descent parsers). The same could be achieved by RULES, but these are GHC-only, and relying on the optimizer for asymptotic improvements is dangerous.
</li></ul><ul><li>Other functions were suggested for the same treatment, but they can be left to another proposal: (<strong>), liftA2 and pair (= liftA2 (,)).
</strong></li></ul>
Ticket