7422cd77edc10f6e652735d232dd077f693954d9
[ghc-base.git] / GHC / Desugar.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module      :  GHC.Desugar
4 -- Copyright   :  (c) The University of Glasgow, 2007
5 -- License     :  see libraries/base/LICENSE
6 -- 
7 -- Maintainer  :  cvs-ghc@haskell.org
8 -- Stability   :  internal
9 -- Portability :  non-portable (GHC extensions)
10 --
11 -- Support code for desugaring in GHC
12 -- 
13 -----------------------------------------------------------------------------
14
15 -- #hide
16 module GHC.Desugar ((>>>), AnnotationWrapper(..), toAnnotationWrapper) where
17
18 import Control.Arrow    (Arrow(..))
19 import Control.Category ((.))
20 import Data.Data        (Data)
21 import Prelude hiding ((.))
22
23 -- A version of Control.Category.>>> overloaded on Arrow
24 #ifndef __HADDOCK__
25 (>>>) :: forall arr. Arrow arr => forall a b c. arr a b -> arr b c -> arr a c
26 #endif
27 -- NB: the type of this function is the "shape" that GHC expects
28 --     in tcInstClassOp.  So don't put all the foralls at the front!  
29 --     Yes, this is a bit grotesque, but heck it works and the whole
30 --     arrows stuff needs reworking anyway!
31 f >>> g = g . f
32
33 -- A wrapper data type that lets the typechecker get at the appropriate dictionaries for an annotation
34 data AnnotationWrapper = forall a. (Data a) => AnnotationWrapper a
35
36 toAnnotationWrapper :: (Data a) => a -> AnnotationWrapper
37 toAnnotationWrapper what = AnnotationWrapper what