make some Applicative functions into methods, and split off Data.Functor (proposal...
[ghc-base.git] / Data / Functor.hs
diff --git a/Data/Functor.hs b/Data/Functor.hs
new file mode 100644 (file)
index 0000000..c3e36fd
--- /dev/null
@@ -0,0 +1,28 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Functor
+-- Copyright   :  (c) The University of Glasgow 2001
+-- License     :  BSD-style (see the file libraries/base/LICENSE)
+-- 
+-- Maintainer  :  libraries@haskell.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- Functors: uniform action over a parameterized type, generalizing the
+-- 'map' function on lists.
+
+module Data.Functor
+    (
+      Functor(fmap, (<$)),
+      (<$>),
+    ) where
+
+#ifdef __GLASGOW_HASKELL__
+import GHC.Base (Functor(..))
+#endif
+
+infixl 4 <$>
+
+-- | An infix synonym for 'fmap'.
+(<$>) :: Functor f => (a -> b) -> f a -> f b
+(<$>) = fmap