agda-unused-0.2.0: Check for unused code in an Agda project.
Safe HaskellNone
LanguageHaskell2010

Agda.Unused.Monad.State

Description

A state monad for determining unused code.

Synopsis

Definitions

data ModuleState where Source #

Cache the results of checking modules. This allows us to:

  • Avoid duplicate computations.
  • Handle cyclic module dependencies without nontermination.

Constructors

Blocked :: ModuleState 
Checked :: !Context -> ModuleState 

Instances

Instances details
Show ModuleState Source # 
Instance details

Defined in Agda.Unused.Monad.State

data State Source #

The current computation state.

Instances

Instances details
Show State Source # 
Instance details

Defined in Agda.Unused.Monad.State

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

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 -> Set QName Source #

Get a list of visited modules.

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.