eaa15dcf3e7f0db2d9d96f8e76415e406bc033cc
[packages/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
22 -- A version of Control.Category.>>> overloaded on Arrow
23 #ifndef __HADDOCK__
24 (>>>) :: forall arr. Arrow arr => forall a b c. arr a b -> arr b c -> arr a c
25 #endif
26 -- NB: the type of this function is the "shape" that GHC expects
27 -- in tcInstClassOp. So don't put all the foralls at the front!
28 -- Yes, this is a bit grotesque, but heck it works and the whole
29 -- arrows stuff needs reworking anyway!
30 f >>> g = g . f
31
32 -- A wrapper data type that lets the typechecker get at the appropriate dictionaries for an annotation
33 data AnnotationWrapper = forall a. (Data a) => AnnotationWrapper a
34
35 toAnnotationWrapper :: (Data a) => a -> AnnotationWrapper
36 toAnnotationWrapper what = AnnotationWrapper what