[GHC] #3335: make some Applicative functions into methods,
and split off Data.Functor
GHC
trac at galois.com
Mon Jun 29 08:42:58 EDT 2009
#3335: make some Applicative functions into methods, and split off Data.Functor
-----------------------------+----------------------------------------------
Reporter: ross | Owner:
Type: proposal | Status: new
Priority: normal | Component: libraries/base
Version: | Severity: normal
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
The following functions
{{{
(<$) :: 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]
}}}
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.
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.
Discussion on libraries at haskell.org to 20th July 2009.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3335>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list