agda-unused-0.1.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 -> [QName] Source #

Get a list of visited modules.

stateBlock :: QName -> State -> State Source #

Mark that we are beginning to check a module.

stateCheck :: QName -> Context -> State -> State Source #

Record the results of checking a module.

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.