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