ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.Avail

Synopsis

- type Avails = [AvailInfo]
- data AvailInfo
  - = Avail Name
  - | AvailTC Name [Name]
- availsToNameSet :: [AvailInfo] -> NameSet
- availsToNameEnv :: [AvailInfo] -> NameEnv AvailInfo
- availExportsDecl :: AvailInfo -> Bool
- availName :: AvailInfo -> Name
- availNames :: AvailInfo -> [Name]
- availSubordinateNames :: AvailInfo -> [Name]
- stableAvailCmp :: AvailInfo -> AvailInfo -> Ordering
- plusAvail :: AvailInfo -> AvailInfo -> AvailInfo
- trimAvail :: AvailInfo -> Name -> AvailInfo
- filterAvail :: (Name -> Bool) -> AvailInfo -> [AvailInfo] -> [AvailInfo]
- filterAvails :: (Name -> Bool) -> [AvailInfo] -> [AvailInfo]
- nubAvails :: [AvailInfo] -> [AvailInfo]
- sortAvails :: Avails -> DetOrdAvails
- newtype DetOrdAvails where
  - DefinitelyDeterministicAvails {
    - getDetOrdAvails :: Avails
    }
  - pattern DetOrdAvails :: Avails -> DetOrdAvails
- emptyDetOrdAvails :: DetOrdAvails

# Documentation

type Avails = [AvailInfo] #

A collection of `AvailInfo` - several things that are "available"

data AvailInfo #

Records what things are "available", i.e. in scope

Constructors

Avail Name | An ordinary identifier in scope, or a field label without a parent type (see Note [Representing pattern synonym fields in AvailInfo]).
AvailTC | A type or class in scope The AvailTC Invariant: If the type or class is itself to be in scope, it must be first in this list. Thus, typically:
    AvailTC Eq [Eq, ==, \/=]
Fields Name The name of the type or class [Name] The available pieces of type or class

#### Instances

Instances details

NFData AvailInfo # |
Instance details Defined in GHC.Types.Avail Methods rnf :: AvailInfo -> () #
Data AvailInfo # |
Instance details Defined in GHC.Types.Avail Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AvailInfo -> c AvailInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AvailInfo # toConstr :: AvailInfo -> Constr # dataTypeOf :: AvailInfo -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AvailInfo) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AvailInfo) # gmapT :: (forall b. Data b => b -> b) -> AvailInfo -> AvailInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AvailInfo -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AvailInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> AvailInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AvailInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AvailInfo -> m AvailInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AvailInfo -> m AvailInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AvailInfo -> m AvailInfo #
Binary AvailInfo # |
Instance details Defined in GHC.Types.Avail Methods put_ :: WriteBinHandle -> AvailInfo -> IO () # put :: WriteBinHandle -> AvailInfo -> IO (Bin AvailInfo) # get :: ReadBinHandle -> IO AvailInfo #
Outputable AvailInfo # |
Instance details Defined in GHC.Types.Avail Methods ppr :: AvailInfo -> SDoc #

availsToNameSet :: [AvailInfo] -> NameSet #

availsToNameEnv :: [AvailInfo] -> NameEnv AvailInfo #

availExportsDecl :: AvailInfo -> Bool #

Does this `AvailInfo` export the parent decl? This depends on the invariant that the parent is first if it appears at all.

availName :: AvailInfo -> Name #

Just the main name made available, i.e. not the available pieces of type or class brought into scope by the `AvailInfo`

availNames :: AvailInfo -> [Name] #

Names and fields made available by the availability information.

availSubordinateNames :: AvailInfo -> [Name] #

Names and fields made available by the availability information, other than the main decl itself.

stableAvailCmp :: AvailInfo -> AvailInfo -> Ordering #

Compare lexicographically

plusAvail :: AvailInfo -> AvailInfo -> AvailInfo #

trimAvail :: AvailInfo -> Name -> AvailInfo #

trims an `AvailInfo` to keep only a single name

filterAvail :: (Name -> Bool) -> AvailInfo -> [AvailInfo] -> [AvailInfo] #

filters an `AvailInfo` by the given predicate

filterAvails :: (Name -> Bool) -> [AvailInfo] -> [AvailInfo] #

filters `AvailInfo`s by the given predicate

nubAvails :: [AvailInfo] -> [AvailInfo] #

Combines `AvailInfo`s from the same family `avails` may have several items with the same availName E.g import Ix( Ix(..), index ) will give Ix(Ix,index,range) and Ix(index) We want to combine these; plusAvail does that

sortAvails :: Avails -> DetOrdAvails #

Sort `Avails`/`AvailInfo`s

newtype DetOrdAvails #

Occurrences of Avails in interface files must be deterministically ordered to guarantee interface file determinism.

We guarantee a deterministic order by either using the order explicitly given by the user (e.g. in an explicit constructor export list) or instead by sorting the avails with `sortAvails`.

Constructors

DefinitelyDeterministicAvails |
Fields getDetOrdAvails :: Avails

Bundled Patterns

pattern DetOrdAvails :: Avails -> DetOrdAvails | It's always safe to match on `DetOrdAvails`

#### Instances

Instances details

NFData DetOrdAvails # |
Instance details Defined in GHC.Types.Avail Methods rnf :: DetOrdAvails -> () #
Binary DetOrdAvails # |
Instance details Defined in GHC.Types.Avail Methods put_ :: WriteBinHandle -> DetOrdAvails -> IO () # put :: WriteBinHandle -> DetOrdAvails -> IO (Bin DetOrdAvails) # get :: ReadBinHandle -> IO DetOrdAvails #
Outputable DetOrdAvails # |
Instance details Defined in GHC.Types.Avail Methods ppr :: DetOrdAvails -> SDoc #
Eq DetOrdAvails # |
Instance details Defined in GHC.Types.Avail Methods (==) :: DetOrdAvails -> DetOrdAvails -> Bool # (/=) :: DetOrdAvails -> DetOrdAvails -> Bool #
Ord DetOrdAvails # |
Instance details Defined in GHC.Types.Avail Methods compare :: DetOrdAvails -> DetOrdAvails -> Ordering # (<) :: DetOrdAvails -> DetOrdAvails -> Bool # (<=) :: DetOrdAvails -> DetOrdAvails -> Bool # (>) :: DetOrdAvails -> DetOrdAvails -> Bool # (>=) :: DetOrdAvails -> DetOrdAvails -> Bool # max :: DetOrdAvails -> DetOrdAvails -> DetOrdAvails # min :: DetOrdAvails -> DetOrdAvails -> DetOrdAvails #

emptyDetOrdAvails :: DetOrdAvails #

Create an empty DetOrdAvails