GHC.Core.UsageEnv

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

Safe Haskell | Ignore
Language | GHC2021

GHC.Core.UsageEnv

Synopsis

- data Usage
  - = Zero
  - | Bottom
  - | MUsage Mult
- data UsageEnv
- addUE :: UsageEnv -> UsageEnv -> UsageEnv
- addUsage :: Usage -> Usage -> Usage
- bottomUE :: UsageEnv
- deleteUE :: NamedThing n => UsageEnv -> n -> UsageEnv
- lookupUE :: NamedThing n => UsageEnv -> n -> Usage
- popUE :: NamedThing n => UsageEnv -> n -> (Usage, UsageEnv)
- scaleUE :: Mult -> UsageEnv -> UsageEnv
- scaleUsage :: Mult -> Usage -> Usage
- supUE :: UsageEnv -> UsageEnv -> UsageEnv
- supUEs :: [UsageEnv] -> UsageEnv
- singleUsageUE :: Id -> UsageEnv
- zeroUE :: UsageEnv

# Documentation

data Usage #

Constructors

Zero |
Bottom |
MUsage Mult |

#### Instances

Instances details

Outputable Usage # |
Instance details Defined in GHC.Core.UsageEnv Methods ppr :: Usage -> SDoc #

data UsageEnv #

#### Instances

Instances details

Outputable UsageEnv # |
Instance details Defined in GHC.Core.UsageEnv Methods ppr :: UsageEnv -> SDoc #

addUE :: UsageEnv -> UsageEnv -> UsageEnv #

addUsage :: Usage -> Usage -> Usage #

bottomUE :: UsageEnv #

deleteUE :: NamedThing n => UsageEnv -> n -> UsageEnv #

lookupUE :: NamedThing n => UsageEnv -> n -> Usage #

|lookupUE x env| returns the multiplicity assigned to |x| in |env|, if |x| is not bound in |env|, then returns |Zero| or |Bottom|.

popUE :: NamedThing n => UsageEnv -> n -> (Usage, UsageEnv) #

scaleUE :: Mult -> UsageEnv -> UsageEnv #

scaleUsage :: Mult -> Usage -> Usage #

supUE :: UsageEnv -> UsageEnv -> UsageEnv #

supUEs :: [UsageEnv] -> UsageEnv #

singleUsageUE :: Id -> UsageEnv #

Record a single usage of an Id, i.e. {n: 1} Exception: We do not record external names (both GlobalIds and top-level LocalIds) because they're not relevant to linearity checking.

zeroUE :: UsageEnv #