Safe Haskell | None |
---|---|
Language | Haskell2010 |
Defines the monad for the units-of-measure modules
- type UA = Analysis (UnitAnnotation A)
- type VV = (Name, Name)
- type UnitSolver a = ExceptT UnitException (RWS UnitOpts UnitLogs UnitState) a
- data UnitOpts = UnitOpts {
- uoDebug :: Bool
- uoLiterals :: LiteralsOpt
- uoNameMap :: NameMap
- unitOpts0 :: UnitOpts
- type UnitLogs = String
- data UnitState = UnitState {}
- data LiteralsOpt
- type UnitException = ()
- whenDebug :: UnitSolver () -> UnitSolver ()
- modifyVarUnitMap :: (VarUnitMap -> VarUnitMap) -> UnitSolver ()
- modifyGivenVarSet :: (GivenVarSet -> GivenVarSet) -> UnitSolver ()
- modifyUnitAliasMap :: (UnitAliasMap -> UnitAliasMap) -> UnitSolver ()
- type VarUnitMap = Map VV UnitInfo
- type GivenVarSet = Set Name
- type UnitAliasMap = Map String UnitInfo
- type TemplateMap = Map Name Constraints
- type CallIdMap = IntMap Int
- modifyTemplateMap :: (TemplateMap -> TemplateMap) -> UnitSolver ()
- modifyProgramFile :: (ProgramFile UA -> ProgramFile UA) -> UnitSolver ()
- modifyProgramFileM :: (ProgramFile UA -> UnitSolver (ProgramFile UA)) -> UnitSolver ()
- modifyCallIdRemapM :: (CallIdMap -> UnitSolver (a, CallIdMap)) -> UnitSolver a
- runUnitSolver :: UnitOpts -> ProgramFile UA -> UnitSolver a -> (Either UnitException a, UnitState, UnitLogs)
- evalUnitSolver :: UnitOpts -> ProgramFile UA -> UnitSolver a -> (Either UnitException a, UnitLogs)
- execUnitSolver :: UnitOpts -> ProgramFile UA -> UnitSolver a -> Either UnitException (UnitState, UnitLogs)
Documentation
type UnitSolver a = ExceptT UnitException (RWS UnitOpts UnitLogs UnitState) a Source #
The monad
UnitOpts | |
|
Working state for the monad
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. |
type UnitException = () Source #
whenDebug :: UnitSolver () -> UnitSolver () Source #
Only run the argument if debugging mode enabled.
modifyVarUnitMap :: (VarUnitMap -> VarUnitMap) -> UnitSolver () Source #
modifyGivenVarSet :: (GivenVarSet -> GivenVarSet) -> UnitSolver () Source #
modifyUnitAliasMap :: (UnitAliasMap -> UnitAliasMap) -> UnitSolver () Source #
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
modifyTemplateMap :: (TemplateMap -> TemplateMap) -> UnitSolver () Source #
modifyProgramFile :: (ProgramFile UA -> ProgramFile UA) -> UnitSolver () Source #
modifyProgramFileM :: (ProgramFile UA -> UnitSolver (ProgramFile UA)) -> UnitSolver () Source #
modifyCallIdRemapM :: (CallIdMap -> UnitSolver (a, CallIdMap)) -> UnitSolver a Source #
runUnitSolver :: UnitOpts -> ProgramFile UA -> UnitSolver a -> (Either UnitException a, UnitState, UnitLogs) Source #
Run the unit solver monad.
evalUnitSolver :: UnitOpts -> ProgramFile UA -> UnitSolver a -> (Either UnitException a, UnitLogs) Source #
execUnitSolver :: UnitOpts -> ProgramFile UA -> UnitSolver a -> Either UnitException (UnitState, UnitLogs) Source #