make some Applicative functions into methods, and split off Data.Functor (proposal...
[ghc-base.git] / GHC / Base.lhs
index 71876d3..62612b0 100644 (file)
@@ -113,6 +113,7 @@ import GHC.Unit ()
 
 infixr 9  .
 infixr 5  ++
+infixl 4  <$
 infixl 1  >>, >>=
 infixr 0  $
 
@@ -176,6 +177,12 @@ defined in the "Prelude" satisfy these laws.
 class  Functor f  where
     fmap        :: (a -> b) -> f a -> f b
 
+    -- | Replace all locations in the input with the same value.
+    -- The default definition is @'fmap' . 'const'@, but this may be
+    -- overridden with a more efficient version.
+    (<$)        :: a -> f b -> f a
+    (<$)        =  fmap . const
+
 {- | The 'Monad' class defines the basic operations over a /monad/,
 a concept from a branch of mathematics known as /category theory/.
 From the perspective of a Haskell programmer, however, it is best to