Safe Haskell | None |
---|---|
Language | Haskell2010 |
Defines the monad for the units-of-measure modules
Synopsis
- type UA = Analysis (UnitAnnotation A)
- type VV = (Name, Name)
- type UnitSolver = StateT UnitState UnitAnalysis
- data UnitOpts = UnitOpts {}
- unitOpts0 :: UnitOpts
- data UnitState
- data UnitEnv = UnitEnv {
- unitOpts :: UnitOpts
- unitProgramFile :: ProgramFile Annotation
- data LiteralsOpt
- type VarUnitMap = Map VV UnitInfo
- type GivenVarSet = Set Name
- type UnitAliasMap = Map String UnitInfo
- type TemplateMap = Map Name Constraints
- type CallIdMap = IntMap Int
- type NameParamMap = Map ProgramUnitName (Map NameParamKey [UnitInfo])
- data NameParamKey
- = NPKParam PP Int
- | NPKVariable VV
- freshId :: UnitSolver Int
- getConstraints :: UnitSolver Constraints
- getNameParamMap :: UnitSolver NameParamMap
- getProgramFile :: UnitSolver (ProgramFile UA)
- getTemplateMap :: UnitSolver TemplateMap
- getUnitAliasMap :: UnitSolver UnitAliasMap
- getVarUnitMap :: UnitSolver VarUnitMap
- usCallIdRemap :: UnitState -> CallIdMap
- usConstraints :: UnitState -> Constraints
- usGivenVarSet :: UnitState -> GivenVarSet
- usNameParamMap :: UnitState -> NameParamMap
- usProgramFile :: UnitState -> ProgramFile UA
- usTemplateMap :: UnitState -> TemplateMap
- usUnitAliasMap :: UnitState -> UnitAliasMap
- usVarUnitMap :: UnitState -> VarUnitMap
- modifyCallIdRemap :: (CallIdMap -> CallIdMap) -> UnitSolver ()
- modifyCallIdRemapM :: (CallIdMap -> UnitSolver (a, CallIdMap)) -> UnitSolver a
- modifyConstraints :: (Constraints -> Constraints) -> UnitSolver ()
- modifyGivenVarSet :: (GivenVarSet -> GivenVarSet) -> UnitSolver ()
- modifyNameParamMap :: (NameParamMap -> NameParamMap) -> UnitSolver ()
- modifyProgramFile :: (ProgramFile UA -> ProgramFile UA) -> UnitSolver ()
- modifyProgramFileM :: (ProgramFile UA -> UnitSolver (ProgramFile UA)) -> UnitSolver ()
- modifyTemplateMap :: (TemplateMap -> TemplateMap) -> UnitSolver ()
- modifyUnitAliasMap :: (UnitAliasMap -> UnitAliasMap) -> UnitSolver ()
- modifyVarUnitMap :: (VarUnitMap -> VarUnitMap) -> UnitSolver ()
- runUnitSolver :: ProgramFile UA -> UnitSolver a -> UnitAnalysis (a, UnitState)
- runUnitAnalysis :: UnitEnv -> UnitAnalysis a -> AnalysisT () () IO a
Documentation
type UnitSolver = StateT UnitState UnitAnalysis Source #
UnitSolvers are analyses annotated with unit information.
Options for the unit solver
UnitOpts | |
|
Instances
Eq UnitOpts Source # | |
Data UnitOpts Source # | |
Defined in Camfort.Specification.Units.MonadTypes gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnitOpts -> c UnitOpts # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnitOpts # toConstr :: UnitOpts -> Constr # dataTypeOf :: UnitOpts -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnitOpts) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnitOpts) # gmapT :: (forall b. Data b => b -> b) -> UnitOpts -> UnitOpts # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnitOpts -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnitOpts -> r # gmapQ :: (forall d. Data d => d -> u) -> UnitOpts -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnitOpts -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnitOpts -> m UnitOpts # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitOpts -> m UnitOpts # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitOpts -> m UnitOpts # | |
Ord UnitOpts Source # | |
Defined in Camfort.Specification.Units.MonadTypes | |
Show UnitOpts Source # | |
Working state for the monad
Instances
Data UnitState Source # | |
Defined in Camfort.Specification.Units.MonadTypes gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnitState -> c UnitState # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnitState # toConstr :: UnitState -> Constr # dataTypeOf :: UnitState -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnitState) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnitState) # gmapT :: (forall b. Data b => b -> b) -> UnitState -> UnitState # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnitState -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnitState -> r # gmapQ :: (forall d. Data d => d -> u) -> UnitState -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnitState -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnitState -> m UnitState # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitState -> m UnitState # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitState -> m UnitState # | |
Show UnitState Source # | |
UnitEnv | |
|
data LiteralsOpt Source #
Some options about how to handle literals.
LitPoly | All literals are polymorphic. |
LitUnitless | All literals are unitless. |
LitMixed | The literal "0" or "0.0" is fully parametric polymorphic. All other literals are monomorphic, possibly unitless. |
Instances
type GivenVarSet = Set Name Source #
Set of variables given explicit unit annotations
type TemplateMap = Map Name Constraints Source #
Function/subroutine name -> associated, parametric polymorphic constraints
type NameParamMap = Map ProgramUnitName (Map NameParamKey [UnitInfo]) Source #
mapped to a list of units (to be multiplied together)
data NameParamKey Source #
Things that can be exported from modules
NPKParam PP Int | Function/subroutine name, position of parameter |
NPKVariable VV | variable |
Instances
State Helpers
freshId :: UnitSolver Int Source #
Generate a number guaranteed to be unique in the current analysis.
Getters
getProgramFile :: UnitSolver (ProgramFile UA) Source #
usCallIdRemap :: UnitState -> CallIdMap Source #
usConstraints :: UnitState -> Constraints Source #
usGivenVarSet :: UnitState -> GivenVarSet Source #
usProgramFile :: UnitState -> ProgramFile UA Source #
usTemplateMap :: UnitState -> TemplateMap Source #
usVarUnitMap :: UnitState -> VarUnitMap Source #
Modifiers
modifyCallIdRemap :: (CallIdMap -> CallIdMap) -> UnitSolver () Source #
modifyCallIdRemapM :: (CallIdMap -> UnitSolver (a, CallIdMap)) -> UnitSolver a Source #
modifyConstraints :: (Constraints -> Constraints) -> UnitSolver () Source #
modifyGivenVarSet :: (GivenVarSet -> GivenVarSet) -> UnitSolver () Source #
modifyNameParamMap :: (NameParamMap -> NameParamMap) -> UnitSolver () Source #
modifyProgramFile :: (ProgramFile UA -> ProgramFile UA) -> UnitSolver () Source #
modifyProgramFileM :: (ProgramFile UA -> UnitSolver (ProgramFile UA)) -> UnitSolver () Source #
modifyTemplateMap :: (TemplateMap -> TemplateMap) -> UnitSolver () Source #
modifyUnitAliasMap :: (UnitAliasMap -> UnitAliasMap) -> UnitSolver () Source #
modifyVarUnitMap :: (VarUnitMap -> VarUnitMap) -> UnitSolver () Source #
Runners
runUnitSolver :: ProgramFile UA -> UnitSolver a -> UnitAnalysis (a, UnitState) Source #
Runs the stateful part of the unit solver.
runUnitAnalysis :: UnitEnv -> UnitAnalysis a -> AnalysisT () () IO a Source #