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