GHC.Types.DefaultEnv

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

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.DefaultEnv

Synopsis

- data ClassDefaults = ClassDefaults {
  - cd_class :: Class
  - cd_types :: [Type]
  - cd_provenance :: DefaultProvenance
  - cd_warn :: Maybe (WarningTxt GhcRn)
  }
- data DefaultProvenance
  - = DP_Local {
    - defaultDeclLoc :: SrcSpan
    - defaultDeclH98 :: Bool
    }
  - | DP_Builtin
  - | DP_Imported Module
- type DefaultEnv = NameEnv ClassDefaults
- emptyDefaultEnv :: DefaultEnv
- isEmptyDefaultEnv :: DefaultEnv -> Bool
- defaultEnv :: [ClassDefaults] -> DefaultEnv
- unitDefaultEnv :: ClassDefaults -> DefaultEnv
- lookupDefaultEnv :: DefaultEnv -> Name -> Maybe ClassDefaults
- filterDefaultEnv :: (ClassDefaults -> Bool) -> DefaultEnv -> DefaultEnv
- defaultList :: DefaultEnv -> [ClassDefaults]
- plusDefaultEnv :: DefaultEnv -> DefaultEnv -> DefaultEnv
- mkDefaultEnv :: [(Name, ClassDefaults)] -> DefaultEnv
- insertDefaultEnv :: ClassDefaults -> DefaultEnv -> DefaultEnv
- isHaskell2010Default :: DefaultProvenance -> Bool

# Documentation

data ClassDefaults #

Defaulting type assignments for the given class.

Constructors

ClassDefaults |
Fields cd_class :: Class The class whose defaults are being defined cd_types :: [Type] cd_provenance :: DefaultProvenance Where the defaults came from see Note [Default exports] in GHC.Tc.Gen.Export cd_warn :: Maybe (WarningTxt GhcRn) Warning emitted when the default is used

#### Instances

Instances details

Data ClassDefaults # |
Instance details Defined in GHC.Types.DefaultEnv Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ClassDefaults -> c ClassDefaults # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ClassDefaults # toConstr :: ClassDefaults -> Constr # dataTypeOf :: ClassDefaults -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ClassDefaults) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ClassDefaults) # gmapT :: (forall b. Data b => b -> b) -> ClassDefaults -> ClassDefaults # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ClassDefaults -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ClassDefaults -> r # gmapQ :: (forall d. Data d => d -> u) -> ClassDefaults -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ClassDefaults -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ClassDefaults -> m ClassDefaults # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ClassDefaults -> m ClassDefaults # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ClassDefaults -> m ClassDefaults #
Outputable ClassDefaults # |
Instance details Defined in GHC.Types.DefaultEnv Methods ppr :: ClassDefaults -> SDoc #

data DefaultProvenance #

The provenance of a collection of default types for a class. see Note [DefaultProvenance] for more details

Constructors

DP_Local | A locally defined default declaration.
Fields defaultDeclLoc :: SrcSpan The `SrcSpan` of the default declaration defaultDeclH98 :: Bool Is this a Haskell 98 default declaration?
DP_Builtin | Built-in class defaults.
DP_Imported | Imported class defaults.
Fields Module The module from which the defaults were imported

#### Instances

Instances details

Data DefaultProvenance # |
Instance details Defined in GHC.Types.DefaultEnv Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DefaultProvenance -> c DefaultProvenance # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DefaultProvenance # toConstr :: DefaultProvenance -> Constr # dataTypeOf :: DefaultProvenance -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DefaultProvenance) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DefaultProvenance) # gmapT :: (forall b. Data b => b -> b) -> DefaultProvenance -> DefaultProvenance # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DefaultProvenance -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DefaultProvenance -> r # gmapQ :: (forall d. Data d => d -> u) -> DefaultProvenance -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DefaultProvenance -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DefaultProvenance -> m DefaultProvenance # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DefaultProvenance -> m DefaultProvenance # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DefaultProvenance -> m DefaultProvenance #
Outputable DefaultProvenance # |
Instance details Defined in GHC.Types.DefaultEnv Methods ppr :: DefaultProvenance -> SDoc #
Eq DefaultProvenance # |
Instance details Defined in GHC.Types.DefaultEnv Methods (==) :: DefaultProvenance -> DefaultProvenance -> Bool # (/=) :: DefaultProvenance -> DefaultProvenance -> Bool #

type DefaultEnv = NameEnv ClassDefaults #

Default environment mapping class name `Name` to their default type lists

NB: this includes Haskell98 default declarations, at the `Num` key.

emptyDefaultEnv :: DefaultEnv #

isEmptyDefaultEnv :: DefaultEnv -> Bool #

defaultEnv :: [ClassDefaults] -> DefaultEnv #

unitDefaultEnv :: ClassDefaults -> DefaultEnv #

lookupDefaultEnv :: DefaultEnv -> Name -> Maybe ClassDefaults #

filterDefaultEnv :: (ClassDefaults -> Bool) -> DefaultEnv -> DefaultEnv #

defaultList :: DefaultEnv -> [ClassDefaults] #

plusDefaultEnv :: DefaultEnv -> DefaultEnv -> DefaultEnv #

mkDefaultEnv :: [(Name, ClassDefaults)] -> DefaultEnv #

Create a `DefaultEnv` from a list of (Name, ClassDefaults) pairs it is useful if we don't want to poke into the `ClassDefaults` structure to get the `Name` of the class, it can be problematic, see #25858

insertDefaultEnv :: ClassDefaults -> DefaultEnv -> DefaultEnv #

isHaskell2010Default :: DefaultProvenance -> Bool #