Cabal-syntax-3.12.1.0: A library for working with .cabal files

Safe Haskell | None
Language | Haskell2010

Distribution.Types.ModuleRenaming

Synopsis

- data ModuleRenaming
  - = ModuleRenaming [(ModuleName, ModuleName)]
  - | DefaultRenaming
  - | HidingRenaming [ModuleName]
- interpModuleRenaming :: ModuleRenaming -> ModuleName -> Maybe ModuleName
- defaultRenaming :: ModuleRenaming
- isDefaultRenaming :: ModuleRenaming -> Bool

# Documentation

data ModuleRenaming Source #

Renaming applied to the modules provided by a package. The boolean indicates whether or not to also include all of the original names of modules. Thus, `ModuleRenaming False []` is "don't expose any modules, and `ModuleRenaming True [(Data.Bool, Bool)]` is, "expose all modules, but also expose `Data.Bool` as `Bool`". If a renaming is omitted you get the `DefaultRenaming`.

(NB: This is a list not a map so that we can preserve order.)

Constructors

ModuleRenaming [(ModuleName, ModuleName)] | A module renaming/thinning; e.g., `(A as B, C as C)` brings `B` and `C` into scope.
DefaultRenaming | The default renaming, bringing all exported modules into scope.
HidingRenaming [ModuleName] | Hiding renaming, e.g., `hiding (A, B)`, bringing all exported modules into scope except the hidden ones.

#### Instances

Instances details

Parsec ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods parsec :: CabalParsing m => m ModuleRenaming Source #
Pretty ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods pretty :: ModuleRenaming -> Doc Source # prettyVersioned :: CabalSpecVersion -> ModuleRenaming -> Doc Source #
Structured ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods structure :: Proxy ModuleRenaming -> Structure Source # structureHash' :: Tagged ModuleRenaming MD5
Binary ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods put :: ModuleRenaming -> Put Source # get :: Get ModuleRenaming Source # putList :: [ModuleRenaming] -> Put Source #
NFData ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods rnf :: ModuleRenaming -> () Source #
Data ModuleRenaming Source # |

Instance details

Defined in Distribution.Types.ModuleRenaming

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ModuleRenaming -> c ModuleRenaming #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ModuleRenaming #

toConstr :: ModuleRenaming -> Constr #

dataTypeOf :: ModuleRenaming -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ModuleRenaming) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ModuleRenaming) #

gmapT :: (forall b. Data b => b -> b) -> ModuleRenaming -> ModuleRenaming #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ModuleRenaming -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ModuleRenaming -> r #

gmapQ :: (forall d. Data d => d -> u) -> ModuleRenaming -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleRenaming -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ModuleRenaming -> m ModuleRenaming #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleRenaming -> m ModuleRenaming #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleRenaming -> m ModuleRenaming #

Generic ModuleRenaming Source # |

Instance details

Defined in Distribution.Types.ModuleRenaming

Associated Types

type Rep ModuleRenaming |

Instance details

Defined in Distribution.Types.ModuleRenaming

type Rep ModuleRenaming = D1 ('MetaData "ModuleRenaming" "Distribution.Types.ModuleRenaming" "Cabal-syntax-3.12.1.0-5c0e" 'False) (C1 ('MetaCons "ModuleRenaming" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(ModuleName, ModuleName)])) :+: (C1 ('MetaCons "DefaultRenaming" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HidingRenaming" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ModuleName]))))

Methods

from :: ModuleRenaming -> Rep ModuleRenaming x #

to :: Rep ModuleRenaming x -> ModuleRenaming #

Read ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods readsPrec :: Int -> ReadS ModuleRenaming # readList :: ReadS [ModuleRenaming] # readPrec :: ReadPrec ModuleRenaming # readListPrec :: ReadPrec [ModuleRenaming] #
Show ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods showsPrec :: Int -> ModuleRenaming -> ShowS # show :: ModuleRenaming -> String # showList :: [ModuleRenaming] -> ShowS #
Eq ModuleRenaming Source # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods (==) :: ModuleRenaming -> ModuleRenaming -> Bool # (/=) :: ModuleRenaming -> ModuleRenaming -> Bool #
Ord ModuleRenaming Source # |

Instance details

Defined in Distribution.Types.ModuleRenaming

Methods

compare :: ModuleRenaming -> ModuleRenaming -> Ordering #

(<) :: ModuleRenaming -> ModuleRenaming -> Bool #

(<=) :: ModuleRenaming -> ModuleRenaming -> Bool #

(>) :: ModuleRenaming -> ModuleRenaming -> Bool #

(>=) :: ModuleRenaming -> ModuleRenaming -> Bool #

max :: ModuleRenaming -> ModuleRenaming -> ModuleRenaming #

min :: ModuleRenaming -> ModuleRenaming -> ModuleRenaming #

type Rep ModuleRenaming Source # |

Instance details

Defined in Distribution.Types.ModuleRenaming

type Rep ModuleRenaming = D1 ('MetaData "ModuleRenaming" "Distribution.Types.ModuleRenaming" "Cabal-syntax-3.12.1.0-5c0e" 'False) (C1 ('MetaCons "ModuleRenaming" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(ModuleName, ModuleName)])) :+: (C1 ('MetaCons "DefaultRenaming" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HidingRenaming" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ModuleName]))))

interpModuleRenaming :: ModuleRenaming -> ModuleName -> Maybe ModuleName Source #

Interpret a `ModuleRenaming` as a partial map from `ModuleName` to `ModuleName`. For efficiency, you should partially apply it with `ModuleRenaming` and then reuse it.

defaultRenaming :: ModuleRenaming Source #

The default renaming, if something is specified in `build-depends` only.

isDefaultRenaming :: ModuleRenaming -> Bool Source #

Tests if its the default renaming; we can use a more compact syntax in `IncludeRenaming` in this case.