make some Applicative functions into methods, and split off Data.Functor (proposal...
authorRoss Paterson <ross@soi.city.ac.uk>
Tue, 15 Sep 2009 17:31:09 +0000 (17:31 +0000)
committerRoss Paterson <ross@soi.city.ac.uk>
Tue, 15 Sep 2009 17:31:09 +0000 (17:31 +0000)
commitccf049137fe5848ce934315e4de18cecf75b08e3
tree2fc694dc3e5dcae28096ff7cf2b854d65f26a669
parentde76ff60453a0a57a9a942e4f0130ec2eca921f0
make some Applicative functions into methods, and split off Data.Functor (proposal #3335)

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.
Control/Applicative.hs
Data/Functor.hs [new file with mode: 0644]
GHC/Base.lhs
base.cabal