e5b8166319508e86569ad739a9f79901c69841ba
[ghc-base.git] / Data / Functor.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module      :  Data.Functor
4 -- Copyright   :  (c) The University of Glasgow 2001
5 -- License     :  BSD-style (see the file libraries/base/LICENSE)
6 -- 
7 -- Maintainer  :  libraries@haskell.org
8 -- Stability   :  provisional
9 -- Portability :  portable
10 --
11 -- Functors: uniform action over a parameterized type, generalizing the
12 -- 'map' function on lists.
13
14 module Data.Functor
15     (
16       Functor(fmap),
17       (<$),
18       (<$>),
19     ) where
20
21 #ifdef __GLASGOW_HASKELL__
22 import GHC.Base (Functor(..))
23 #else
24 (<$) :: Functor f => a -> f b -> f a
25 (<$) =  fmap . const
26 #endif
27
28 infixl 4 <$>
29
30 -- | An infix synonym for 'fmap'.
31 (<$>) :: Functor f => (a -> b) -> f a -> f b
32 (<$>) = fmap