camfort-1.0.1: CamFort - Cambridge Fortran infrastructure
Safe HaskellNone
LanguageHaskell2010

Camfort.Specification.Units.Monad

Description

Defines the monad for the units-of-measure modules

Synopsis

Documentation

type UA = Analysis (UnitAnnotation A) Source #

type VV = (Name, Name) Source #

A (unique name, source name) variable

type UnitSolver = StateT UnitState UnitAnalysis Source #

UnitSolvers are analyses annotated with unit information.

data UnitOpts Source #

Options for the unit solver

Constructors

UnitOpts 

Fields

Instances

Instances details
Eq UnitOpts Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Data UnitOpts Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Methods

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 # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Show UnitOpts Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

data UnitState Source #

Working state for the monad

Instances

Instances details
Data UnitState Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Methods

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 # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

data UnitEnv Source #

Constructors

UnitEnv 

Fields

data LiteralsOpt Source #

Some options about how to handle literals.

Constructors

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

Instances details
Eq LiteralsOpt Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Data LiteralsOpt Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LiteralsOpt -> c LiteralsOpt #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LiteralsOpt #

toConstr :: LiteralsOpt -> Constr #

dataTypeOf :: LiteralsOpt -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LiteralsOpt) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LiteralsOpt) #

gmapT :: (forall b. Data b => b -> b) -> LiteralsOpt -> LiteralsOpt #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LiteralsOpt -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LiteralsOpt -> r #

gmapQ :: (forall d. Data d => d -> u) -> LiteralsOpt -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LiteralsOpt -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LiteralsOpt -> m LiteralsOpt #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LiteralsOpt -> m LiteralsOpt #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LiteralsOpt -> m LiteralsOpt #

Ord LiteralsOpt Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Read LiteralsOpt Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Show LiteralsOpt Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

type VarUnitMap = Map VV UnitInfo Source #

Variable => unit

type GivenVarSet = Set Name Source #

Set of variables given explicit unit annotations

type UnitAliasMap = Map String UnitInfo Source #

Alias name => definition

type TemplateMap = Map Name Constraints Source #

Function/subroutine name -> associated, parametric polymorphic constraints

type CallIdMap = IntMap Int Source #

Map of CallId to CallId

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

Constructors

NPKParam PP Int

Function/subroutine name, position of parameter

NPKVariable VV

variable

Instances

Instances details
Eq NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Data NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NameParamKey -> c NameParamKey #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NameParamKey #

toConstr :: NameParamKey -> Constr #

dataTypeOf :: NameParamKey -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NameParamKey) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameParamKey) #

gmapT :: (forall b. Data b => b -> b) -> NameParamKey -> NameParamKey #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NameParamKey -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NameParamKey -> r #

gmapQ :: (forall d. Data d => d -> u) -> NameParamKey -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> NameParamKey -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> NameParamKey -> m NameParamKey #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NameParamKey -> m NameParamKey #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NameParamKey -> m NameParamKey #

Ord NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Show NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Generic NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

Associated Types

type Rep NameParamKey :: Type -> Type #

Binary NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

type Rep NameParamKey Source # 
Instance details

Defined in Camfort.Specification.Units.MonadTypes

type Rep NameParamKey = D1 ('MetaData "NameParamKey" "Camfort.Specification.Units.MonadTypes" "camfort-1.0.1-inplace" 'False) (C1 ('MetaCons "NPKParam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PP) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "NPKVariable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VV)))

State Helpers

freshId :: UnitSolver Int Source #

Generate a number guaranteed to be unique in the current analysis.

Getters

usProgramFile :: UnitState -> ProgramFile UA Source #

Modifiers

modifyProgramFile :: (ProgramFile UA -> ProgramFile UA) -> UnitSolver () Source #

modifyProgramFileM :: (ProgramFile UA -> UnitSolver (ProgramFile UA)) -> UnitSolver () Source #

Runners

runUnitSolver :: ProgramFile UA -> UnitSolver a -> UnitAnalysis (a, UnitState) Source #

Runs the stateful part of the unit solver.