make LTS branch pre-releases
[cabal.git] / Cabal-syntax / src / Distribution / Types / ExposedModule.hs
blob4afd03a32632bf809542968dd2d26ed40666ccc2
1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE DeriveGeneric #-}
4 module Distribution.Types.ExposedModule where
6 import Distribution.Compat.Prelude
7 import Prelude ()
9 import Distribution.Backpack
10 import Distribution.ModuleName
11 import Distribution.Parsec
12 import Distribution.Pretty
14 import qualified Distribution.Compat.CharParsing as P
15 import qualified Text.PrettyPrint as Disp
17 data ExposedModule = ExposedModule
18 { exposedName :: ModuleName
19 , exposedReexport :: Maybe OpenModule
21 deriving (Eq, Generic, Read, Show, Typeable)
23 instance Pretty ExposedModule where
24 pretty (ExposedModule m reexport) =
25 Disp.hsep
26 [ pretty m
27 , case reexport of
28 Just m' -> Disp.hsep [Disp.text "from", pretty m']
29 Nothing -> Disp.empty
32 instance Parsec ExposedModule where
33 parsec = do
34 m <- parsecMaybeQuoted parsec
35 P.spaces
37 reexport <- P.optional $ do
38 _ <- P.string "from"
39 P.skipSpaces1
40 parsec
42 return (ExposedModule m reexport)
44 instance Binary ExposedModule
45 instance Structured ExposedModule
46 instance NFData ExposedModule where rnf = genericRnf