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 -> Set QName
- getModule :: MonadState State m => QName -> m (Maybe ModuleState)
- getSources :: MonadState State m => m ModuleToSource
- modifyInsert :: MonadReader Environment m => MonadState State m => Range -> RangeInfo -> m ()
- modifyDelete :: MonadReader Environment m => MonadState State m => Set Range -> m ()
- modifyBlock :: MonadState State m => QName -> m ()
- modifyCheck :: MonadState State m => QName -> Context -> m ()
- modifySources :: MonadState State m => ModuleToSource -> 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.
Get
getModule :: MonadState State m => QName -> m (Maybe ModuleState) Source #
Get the state of a module.
getSources :: MonadState State m => m ModuleToSource Source #
Get the cache of source paths.
Modify
modifyInsert :: MonadReader Environment m => MonadState State m => Range -> RangeInfo -> m () Source #
Record a new unused item.
modifyDelete :: MonadReader Environment m => MonadState State m => Set Range -> m () Source #
Mark a list of items as used.
modifyBlock :: MonadState State m => QName -> m () Source #
Mark that we are beginning to check a module.
modifyCheck :: MonadState State m => QName -> Context -> m () Source #
Record the results of checking a module.
modifySources :: MonadState State m => ModuleToSource -> m () Source #
Update the cache of sources.