Safe Haskell | None |
---|---|
Language | Haskell2010 |
A state monad for determining unused code.
Synopsis
- data ModuleState where
- Blocked :: ModuleState
- Checked :: !Context -> ModuleState
- data State
- stateEmpty :: State
- stateItems :: State -> [(Range, RangeInfo)]
- stateModules :: State -> [QName]
- stateBlock :: QName -> State -> State
- stateCheck :: QName -> Context -> State -> State
- stateLookup :: QName -> State -> Maybe ModuleState
- modifyDelete :: MonadReader Environment m => MonadState State m => [Range] -> m ()
- modifyInsert :: MonadReader Environment m => MonadState State m => Range -> RangeInfo -> m ()
Definitions
data ModuleState where Source #
Cache the results of checking modules. This allows us to:
- Avoid duplicate computations.
- Handle cyclic module dependencies without nontermination.
Blocked :: ModuleState | |
Checked :: !Context -> ModuleState |
Instances
Show ModuleState Source # | |
Defined in Agda.Unused.Monad.State showsPrec :: Int -> ModuleState -> ShowS # show :: ModuleState -> String # showList :: [ModuleState] -> ShowS # |
The current computation state.
Interface
stateEmpty :: State Source #
Construct an empty state.
stateItems :: State -> [(Range, RangeInfo)] Source #
Get a sorted list of state items.
If one state item contains another (e.g., an open
statement containing
using
directives), then keep only the containing item.
stateModules :: State -> [QName] Source #
Get a list of visited modules.
stateLookup :: QName -> State -> Maybe ModuleState Source #
Lookup the state of a module.
Modify
modifyDelete :: MonadReader Environment m => MonadState State m => [Range] -> m () Source #
Mark a list of items as used.
modifyInsert :: MonadReader Environment m => MonadState State m => Range -> RangeInfo -> m () Source #
Record a new unused item.