camfort-1.0.1: CamFort - Cambridge Fortran infrastructure
Copyright(c) 2017 Dominic Orchard Andrew Rice Mistral Contrastin Matthew Danish
LicenseApache-2.0
Maintainerdom.orchard@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Camfort.Analysis

Description

This module defines the AnalysisT monad transformer, which encapsulates common functionality for analyses:

Synopsis

Analysis monad

data AnalysisT e w m a Source #

The analysis monad transformer. Will usually be based on Identity (see PureAnalysis) or IO.

Has error messages of type e and warnings of type w.

Instances

Instances details
(Monad m, Describe e, Describe w) => MonadLogger e w (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

setDefaultSourceFile :: FilePath -> AnalysisT e w m () Source #

getDefaultSourceFile :: AnalysisT e w m FilePath Source #

recordLogMessage :: SomeMessage e w -> AnalysisT e w m () Source #

logError :: Origin -> e -> AnalysisT e w m () Source #

logError' :: Spanned a => a -> e -> AnalysisT e w m () Source #

logWarn :: Origin -> w -> AnalysisT e w m () Source #

logWarn' :: Spanned a => a -> w -> AnalysisT e w m () Source #

logInfo :: Origin -> Text -> AnalysisT e w m () Source #

logInfo' :: Spanned a => a -> Text -> AnalysisT e w m () Source #

logInfoNoOrigin :: Text -> AnalysisT e w m () Source #

logDebug :: Origin -> Text -> AnalysisT e w m () Source #

logDebug' :: Spanned a => a -> Text -> AnalysisT e w m () Source #

(Describe e, Describe w, Monad m) => MonadAnalysis e w (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> AnalysisT e w m a Source #

analysisModFiles :: AnalysisT e w m ModFiles Source #

MonadWriter w' m => MonadWriter w' (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

writer :: (a, w') -> AnalysisT e w m a #

tell :: w' -> AnalysisT e w m () #

listen :: AnalysisT e w m a -> AnalysisT e w m (a, w') #

pass :: AnalysisT e w m (a, w' -> w') -> AnalysisT e w m a #

MonadState s m => MonadState s (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

get :: AnalysisT e w m s #

put :: s -> AnalysisT e w m () #

state :: (s -> (a, s)) -> AnalysisT e w m a #

MonadReader r m => MonadReader r (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

ask :: AnalysisT e w m r #

local :: (r -> r) -> AnalysisT e w m a -> AnalysisT e w m a #

reader :: (r -> a) -> AnalysisT e w m a #

MonadError e' m => MonadError e' (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

throwError :: e' -> AnalysisT e w m a #

catchError :: AnalysisT e w m a -> (e' -> AnalysisT e w m a) -> AnalysisT e w m a #

MFunctor (AnalysisT e w :: (Type -> Type) -> Type -> Type) Source #

As per the MFunctor instance for LoggerT, a hoisted analysis cannot output logs on the fly.

Instance details

Defined in Camfort.Analysis

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> AnalysisT e w m b -> AnalysisT e w n b

MonadTrans (AnalysisT e w) Source # 
Instance details

Defined in Camfort.Analysis

Methods

lift :: Monad m => m a -> AnalysisT e w m a #

Monad m => Monad (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

(>>=) :: AnalysisT e w m a -> (a -> AnalysisT e w m b) -> AnalysisT e w m b #

(>>) :: AnalysisT e w m a -> AnalysisT e w m b -> AnalysisT e w m b #

return :: a -> AnalysisT e w m a #

Functor m => Functor (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

fmap :: (a -> b) -> AnalysisT e w m a -> AnalysisT e w m b #

(<$) :: a -> AnalysisT e w m b -> AnalysisT e w m a #

MonadFail m => MonadFail (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

fail :: String -> AnalysisT e w m a #

Monad m => Applicative (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

pure :: a -> AnalysisT e w m a #

(<*>) :: AnalysisT e w m (a -> b) -> AnalysisT e w m a -> AnalysisT e w m b #

liftA2 :: (a -> b -> c) -> AnalysisT e w m a -> AnalysisT e w m b -> AnalysisT e w m c #

(*>) :: AnalysisT e w m a -> AnalysisT e w m b -> AnalysisT e w m b #

(<*) :: AnalysisT e w m a -> AnalysisT e w m b -> AnalysisT e w m a #

MonadIO m => MonadIO (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

liftIO :: IO a -> AnalysisT e w m a #

type PureAnalysis e w = AnalysisT e w Identity Source #

A pure analysis computation which cannot do any IO.

Combinators

mapAnalysisT :: Monad m => (e -> e') -> (w -> w') -> AnalysisT e w m a -> AnalysisT e' w' m a Source #

Change the error and warning types in an analysis. To change the underlying monad use hoist.

generalizePureAnalysis :: Monad m => PureAnalysis e w a -> AnalysisT e w m a Source #

Given a pure analysis action, it can be generalized to run in any Monad. Since the original analysis was pure, it could not have logged anything as it ran. The new analysis cannot log anything as it runs either, even it is based on IO.

class MonadLogger e w m => MonadAnalysis e w m where Source #

Minimal complete definition

Nothing

Methods

failAnalysis :: Origin -> e -> m a Source #

Report a critical error in the analysis at a particular source location and exit early.

default failAnalysis :: (MonadTrans t, MonadAnalysis e w m', m ~ t m') => Origin -> e -> m a Source #

analysisModFiles :: m ModFiles Source #

Get the ModFiles from the analysis environment.

default analysisModFiles :: (MonadTrans t, MonadAnalysis e w m', m ~ t m') => m ModFiles Source #

Instances

Instances details
MonadAnalysis e w m => MonadAnalysis e w (StateT s m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> StateT s m a Source #

analysisModFiles :: StateT s m ModFiles Source #

(MonadAnalysis e w m, Monoid w') => MonadAnalysis e w (WriterT w' m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> WriterT w' m a Source #

analysisModFiles :: WriterT w' m ModFiles Source #

MonadAnalysis e w m => MonadAnalysis e w (StateT s m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> StateT s m a Source #

analysisModFiles :: StateT s m ModFiles Source #

MonadAnalysis e w m => MonadAnalysis e w (ExceptT e' m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> ExceptT e' m a Source #

analysisModFiles :: ExceptT e' m ModFiles Source #

MonadAnalysis e w m => MonadAnalysis e w (ReaderT r m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> ReaderT r m a Source #

analysisModFiles :: ReaderT r m ModFiles Source #

(Describe e, Describe w, Monad m) => MonadAnalysis e w (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> AnalysisT e w m a Source #

analysisModFiles :: AnalysisT e w m ModFiles Source #

(MonadAnalysis e w m, Monoid w') => MonadAnalysis e w (RWST r w' s m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

failAnalysis :: Origin -> e -> RWST r w' s m a Source #

analysisModFiles :: RWST r w' s m ModFiles Source #

failAnalysis' :: (MonadAnalysis e w m, Spanned o) => o -> e -> m a Source #

Report a critical failure in the analysis at no particular source location and exit early.

catchAnalysisT :: Monad m => (LogMessage e -> AnalysisT e w m a) -> AnalysisT e w m a -> AnalysisT e w m a Source #

Run the given analysis and recover with the given handler function if it fails.

loggingAnalysisError :: (Monad m, Describe w, Describe e) => AnalysisT e w m a -> AnalysisT e w m (Maybe a) Source #

Run the given analysis. If it succeeds, return its result value. Otherwise, log the error it creates and return Nothing.

This allows errors in analysis sub-programs to be collected rather than halting the entire analysis.

analysisLiftLogger :: (Monad m, Describe w, Describe e) => LoggerT e w m a -> AnalysisT e w m a Source #

Given a logging computation, lift it into an analysis monad.

Analysis results

data AnalysisResult e r Source #

Constructors

ARFailure Origin e 
ARSuccess r 

Instances

Instances details
Functor (AnalysisResult e) Source # 
Instance details

Defined in Camfort.Analysis

Methods

fmap :: (a -> b) -> AnalysisResult e a -> AnalysisResult e b #

(<$) :: a -> AnalysisResult e b -> AnalysisResult e a #

(Eq e, Eq r) => Eq (AnalysisResult e r) Source # 
Instance details

Defined in Camfort.Analysis

(Show e, Show r) => Show (AnalysisResult e r) Source # 
Instance details

Defined in Camfort.Analysis

Generic (AnalysisResult e r) Source # 
Instance details

Defined in Camfort.Analysis

Associated Types

type Rep (AnalysisResult e r) :: Type -> Type #

Methods

from :: AnalysisResult e r -> Rep (AnalysisResult e r) x #

to :: Rep (AnalysisResult e r) x -> AnalysisResult e r #

(NFData e, NFData r) => NFData (AnalysisResult e r) Source # 
Instance details

Defined in Camfort.Analysis

Methods

rnf :: AnalysisResult e r -> () #

type Rep (AnalysisResult e r) Source # 
Instance details

Defined in Camfort.Analysis

_ARFailure :: forall e r e. Prism (AnalysisResult e r) (AnalysisResult e r) (Origin, e) (Origin, e) Source #

_ARSuccess :: forall e r r. Prism (AnalysisResult e r) (AnalysisResult e r) r r Source #

data AnalysisReport e w r Source #

When an analysis is run, it produces a report consisting of the logs it collect as it ran. In addition, it either fails at a certain location or succeeds with a result value.

Instances

Instances details
Functor (AnalysisReport e w) Source # 
Instance details

Defined in Camfort.Analysis

Methods

fmap :: (a -> b) -> AnalysisReport e w a -> AnalysisReport e w b #

(<$) :: a -> AnalysisReport e w b -> AnalysisReport e w a #

(Eq e, Eq w, Eq r) => Eq (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis

Methods

(==) :: AnalysisReport e w r -> AnalysisReport e w r -> Bool #

(/=) :: AnalysisReport e w r -> AnalysisReport e w r -> Bool #

(Show e, Show w, Show r) => Show (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis

Methods

showsPrec :: Int -> AnalysisReport e w r -> ShowS #

show :: AnalysisReport e w r -> String #

showList :: [AnalysisReport e w r] -> ShowS #

Generic (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis

Associated Types

type Rep (AnalysisReport e w r) :: Type -> Type #

Methods

from :: AnalysisReport e w r -> Rep (AnalysisReport e w r) x #

to :: Rep (AnalysisReport e w r) x -> AnalysisReport e w r #

(NFData e, NFData w, NFData r) => NFData (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis

Methods

rnf :: AnalysisReport e w r -> () #

ExitCodeOfReport r => ExitCodeOfReport (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis

type Rep (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis

type Rep (AnalysisReport e w r) = D1 ('MetaData "AnalysisReport" "Camfort.Analysis" "camfort-1.0.1-inplace" 'False) (C1 ('MetaCons "AnalysisReport" 'PrefixI 'True) (S1 ('MetaSel ('Just "_arSourceFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just "_arMessages") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [SomeMessage e w]) :*: S1 ('MetaSel ('Just "_arResult") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AnalysisResult e r)))))

arMessages :: forall e w r w. Lens (AnalysisReport e w r) (AnalysisReport e w r) [SomeMessage e w] [SomeMessage e w] Source #

arResult :: forall e w r r. Lens (AnalysisReport e w r) (AnalysisReport e w r) (AnalysisResult e r) (AnalysisResult e r) Source #

describeReport :: (Describe e, Describe w, Describe r) => Text -> Maybe LogLevel -> AnalysisReport e w r -> Text Source #

Produce a human-readable version of an AnalysisReport, at the given verbosity level. Giving Nothing for the log level hides all logs.

Running analyses

runAnalysisT Source #

Arguments

:: (Monad m, Describe e, Describe w) 
=> FilePath

The name of the file the analysis is being run on. This is only used for logging.

-> LogOutput m

The logging output function, e.g. logOutputStd for standard output or logOutputNone for no output.

-> LogLevel

The logging verbosity level.

-> ModFiles

The list of analysis modfiles.

-> AnalysisT e w m a

The analysis transformer to run.

-> m (AnalysisReport e w a) 

Run an analysis computation and collect the report.

Logging

See Camfort.Analysis.Logger for more detailed documentation.

class Monad m => MonadLogger e w m | m -> e w where Source #

MTL-style type class for monads that support logging.

Minimal complete definition

Nothing

Methods

logError :: Origin -> e -> m () Source #

Log an error message at the given Origin.

logError' :: Spanned a => a -> e -> m () Source #

Log an error message. The origin is the current default source file, with the source span of the given piece of Fortran syntax.

logWarn :: Origin -> w -> m () Source #

Log a warning message at the given Origin.

logWarn' :: Spanned a => a -> w -> m () Source #

Log a warning message. The origin is the current default source file, with the source span of the given piece of Fortran syntax.

logInfo :: Origin -> Text -> m () Source #

Log an information message at the given Origin.

logInfo' :: Spanned a => a -> Text -> m () Source #

Log an information message. The origin is the current default source file, with the source span of the given piece of Fortran syntax.

logInfoNoOrigin :: Text -> m () Source #

Log an information message with no origin. For example, use this when printing output about the progress of an analysis which cannot be associated with a particular bit of source code.

logDebug :: Origin -> Text -> m () Source #

Log a debugging message at the given Origin.

logDebug' :: Spanned a => a -> Text -> m () Source #

Log a debugging message. The origin is the current default source file, with the source span of the given piece of Fortran syntax.

Instances

Instances details
MonadLogger e w m => MonadLogger e w (TranslateT m) Source # 
Instance details

Defined in Language.Fortran.Model.Translate

Methods

setDefaultSourceFile :: FilePath -> TranslateT m () Source #

getDefaultSourceFile :: TranslateT m FilePath Source #

recordLogMessage :: SomeMessage e w -> TranslateT m () Source #

logError :: Origin -> e -> TranslateT m () Source #

logError' :: Spanned a => a -> e -> TranslateT m () Source #

logWarn :: Origin -> w -> TranslateT m () Source #

logWarn' :: Spanned a => a -> w -> TranslateT m () Source #

logInfo :: Origin -> Text -> TranslateT m () Source #

logInfo' :: Spanned a => a -> Text -> TranslateT m () Source #

logInfoNoOrigin :: Text -> TranslateT m () Source #

logDebug :: Origin -> Text -> TranslateT m () Source #

logDebug' :: Spanned a => a -> Text -> TranslateT m () Source #

MonadLogger e w m => MonadLogger e w (StateT s m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> StateT s m () Source #

getDefaultSourceFile :: StateT s m FilePath Source #

recordLogMessage :: SomeMessage e w -> StateT s m () Source #

logError :: Origin -> e -> StateT s m () Source #

logError' :: Spanned a => a -> e -> StateT s m () Source #

logWarn :: Origin -> w -> StateT s m () Source #

logWarn' :: Spanned a => a -> w -> StateT s m () Source #

logInfo :: Origin -> Text -> StateT s m () Source #

logInfo' :: Spanned a => a -> Text -> StateT s m () Source #

logInfoNoOrigin :: Text -> StateT s m () Source #

logDebug :: Origin -> Text -> StateT s m () Source #

logDebug' :: Spanned a => a -> Text -> StateT s m () Source #

(MonadLogger e w m, Monoid w') => MonadLogger e w (WriterT w' m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> WriterT w' m () Source #

getDefaultSourceFile :: WriterT w' m FilePath Source #

recordLogMessage :: SomeMessage e w -> WriterT w' m () Source #

logError :: Origin -> e -> WriterT w' m () Source #

logError' :: Spanned a => a -> e -> WriterT w' m () Source #

logWarn :: Origin -> w -> WriterT w' m () Source #

logWarn' :: Spanned a => a -> w -> WriterT w' m () Source #

logInfo :: Origin -> Text -> WriterT w' m () Source #

logInfo' :: Spanned a => a -> Text -> WriterT w' m () Source #

logInfoNoOrigin :: Text -> WriterT w' m () Source #

logDebug :: Origin -> Text -> WriterT w' m () Source #

logDebug' :: Spanned a => a -> Text -> WriterT w' m () Source #

MonadLogger e w m => MonadLogger e w (StateT s m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> StateT s m () Source #

getDefaultSourceFile :: StateT s m FilePath Source #

recordLogMessage :: SomeMessage e w -> StateT s m () Source #

logError :: Origin -> e -> StateT s m () Source #

logError' :: Spanned a => a -> e -> StateT s m () Source #

logWarn :: Origin -> w -> StateT s m () Source #

logWarn' :: Spanned a => a -> w -> StateT s m () Source #

logInfo :: Origin -> Text -> StateT s m () Source #

logInfo' :: Spanned a => a -> Text -> StateT s m () Source #

logInfoNoOrigin :: Text -> StateT s m () Source #

logDebug :: Origin -> Text -> StateT s m () Source #

logDebug' :: Spanned a => a -> Text -> StateT s m () Source #

MonadLogger e w m => MonadLogger e w (ExceptT e' m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> ExceptT e' m () Source #

getDefaultSourceFile :: ExceptT e' m FilePath Source #

recordLogMessage :: SomeMessage e w -> ExceptT e' m () Source #

logError :: Origin -> e -> ExceptT e' m () Source #

logError' :: Spanned a => a -> e -> ExceptT e' m () Source #

logWarn :: Origin -> w -> ExceptT e' m () Source #

logWarn' :: Spanned a => a -> w -> ExceptT e' m () Source #

logInfo :: Origin -> Text -> ExceptT e' m () Source #

logInfo' :: Spanned a => a -> Text -> ExceptT e' m () Source #

logInfoNoOrigin :: Text -> ExceptT e' m () Source #

logDebug :: Origin -> Text -> ExceptT e' m () Source #

logDebug' :: Spanned a => a -> Text -> ExceptT e' m () Source #

MonadLogger e w m => MonadLogger e w (ReaderT r m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> ReaderT r m () Source #

getDefaultSourceFile :: ReaderT r m FilePath Source #

recordLogMessage :: SomeMessage e w -> ReaderT r m () Source #

logError :: Origin -> e -> ReaderT r m () Source #

logError' :: Spanned a => a -> e -> ReaderT r m () Source #

logWarn :: Origin -> w -> ReaderT r m () Source #

logWarn' :: Spanned a => a -> w -> ReaderT r m () Source #

logInfo :: Origin -> Text -> ReaderT r m () Source #

logInfo' :: Spanned a => a -> Text -> ReaderT r m () Source #

logInfoNoOrigin :: Text -> ReaderT r m () Source #

logDebug :: Origin -> Text -> ReaderT r m () Source #

logDebug' :: Spanned a => a -> Text -> ReaderT r m () Source #

(Monad m, Describe e, Describe w) => MonadLogger e w (LoggerT e w m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> LoggerT e w m () Source #

getDefaultSourceFile :: LoggerT e w m FilePath Source #

recordLogMessage :: SomeMessage e w -> LoggerT e w m () Source #

logError :: Origin -> e -> LoggerT e w m () Source #

logError' :: Spanned a => a -> e -> LoggerT e w m () Source #

logWarn :: Origin -> w -> LoggerT e w m () Source #

logWarn' :: Spanned a => a -> w -> LoggerT e w m () Source #

logInfo :: Origin -> Text -> LoggerT e w m () Source #

logInfo' :: Spanned a => a -> Text -> LoggerT e w m () Source #

logInfoNoOrigin :: Text -> LoggerT e w m () Source #

logDebug :: Origin -> Text -> LoggerT e w m () Source #

logDebug' :: Spanned a => a -> Text -> LoggerT e w m () Source #

(Monad m, Describe e, Describe w) => MonadLogger e w (AnalysisT e w m) Source # 
Instance details

Defined in Camfort.Analysis

Methods

setDefaultSourceFile :: FilePath -> AnalysisT e w m () Source #

getDefaultSourceFile :: AnalysisT e w m FilePath Source #

recordLogMessage :: SomeMessage e w -> AnalysisT e w m () Source #

logError :: Origin -> e -> AnalysisT e w m () Source #

logError' :: Spanned a => a -> e -> AnalysisT e w m () Source #

logWarn :: Origin -> w -> AnalysisT e w m () Source #

logWarn' :: Spanned a => a -> w -> AnalysisT e w m () Source #

logInfo :: Origin -> Text -> AnalysisT e w m () Source #

logInfo' :: Spanned a => a -> Text -> AnalysisT e w m () Source #

logInfoNoOrigin :: Text -> AnalysisT e w m () Source #

logDebug :: Origin -> Text -> AnalysisT e w m () Source #

logDebug' :: Spanned a => a -> Text -> AnalysisT e w m () Source #

(MonadLogger e w m, Monoid w') => MonadLogger e w (RWST r w' s m) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

setDefaultSourceFile :: FilePath -> RWST r w' s m () Source #

getDefaultSourceFile :: RWST r w' s m FilePath Source #

recordLogMessage :: SomeMessage e w -> RWST r w' s m () Source #

logError :: Origin -> e -> RWST r w' s m () Source #

logError' :: Spanned a => a -> e -> RWST r w' s m () Source #

logWarn :: Origin -> w -> RWST r w' s m () Source #

logWarn' :: Spanned a => a -> w -> RWST r w' s m () Source #

logInfo :: Origin -> Text -> RWST r w' s m () Source #

logInfo' :: Spanned a => a -> Text -> RWST r w' s m () Source #

logInfoNoOrigin :: Text -> RWST r w' s m () Source #

logDebug :: Origin -> Text -> RWST r w' s m () Source #

logDebug' :: Spanned a => a -> Text -> RWST r w' s m () Source #

Message origins

data Origin Source #

A message origin, containing a file and a source span.

Constructors

Origin 

Fields

Instances

Instances details
Eq Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

(==) :: Origin -> Origin -> Bool #

(/=) :: Origin -> Origin -> Bool #

Ord Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Show Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Generic Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Associated Types

type Rep Origin :: Type -> Type #

Methods

from :: Origin -> Rep Origin x #

to :: Rep Origin x -> Origin #

NFData Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

rnf :: Origin -> () #

Describe Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

type Rep Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

type Rep Origin = D1 ('MetaData "Origin" "Camfort.Analysis.Logger" "camfort-1.0.1-inplace" 'False) (C1 ('MetaCons "Origin" 'PrefixI 'True) (S1 ('MetaSel ('Just "_oFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "_oSpan") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan)))

atSpanned :: (MonadLogger e w m, Spanned a) => a -> m Origin Source #

Make an origin at the source span of a piece of Fortran syntax, in the current file.

atSpannedInFile :: Spanned a => FilePath -> a -> Origin Source #

Make an origin at the source span of a piece of Fortran syntax, in the given file.

Log outputs

data LogOutput m Source #

A function to output logs in a particular monad m.

logOutputStd Source #

Arguments

:: MonadIO m 
=> Bool

If True, print more concise output when message origin is repeated.

-> LogOutput m 

Output logs to standard output (i.e. the console).

logOutputNone Source #

Arguments

:: Monad m 
=> Bool

If True, print more concise output when message origin is repeated.

-> LogOutput m 

Output no logs.

Log levels

data LogLevel Source #

A logging level. At each logging level, only produce output at that level or lower.

Constructors

LogError

At level LogError, only error messages are shown.

LogWarn

At level LogWarn, error and warning messages are shown.

LogInfo

At level LogInfo, error, warning and information messages are shown.

LogDebug

At level LogDebug, error, warning, information and debug output is shown.

Instances

Instances details
Eq LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Ord LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Show LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe class

class Describe a where Source #

A type class for efficiently converting values to human-readable output. Can be automatically instantiated for Show types, but this will not be very human-readable for a lot of types.

Minimal complete definition

Nothing

Methods

describe :: a -> Text Source #

Convert the value to a human-readable output as a strict Text value.

describeBuilder :: a -> Builder Source #

Convert the value to human-readable output in a text Builder which can be efficiently concatenated with other Builders.

default describeBuilder :: Show a => a -> Builder Source #

Instances

Instances details
Describe Double Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Float Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Int Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Integer Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe () Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Void Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Text Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe SrcSpan Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

describe :: SrcSpan -> Text Source #

describeBuilder :: SrcSpan -> Builder Source #

Describe Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe ImplicitNoneReport Source # 
Instance details

Defined in Camfort.Analysis.Simple

Describe DerivedDataTypeReport Source # 
Instance details

Defined in Camfort.Specification.DerivedDataType

Describe CheckResult Source # 
Instance details

Defined in Camfort.Specification.Stencils.CheckFrontend

Describe StencilsReport Source # 
Instance details

Defined in Camfort.Specification.Stencils.InferenceFrontend

Describe ConsistencyError Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Consistent

Describe ConsistencyReport Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Consistent

Describe InferenceResult Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Infer

Describe InferenceReport Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Infer

Describe TranslateError Source # 
Instance details

Defined in Language.Fortran.Model.Translate

Describe HoareCheckResult Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckBackend

Describe HoareBackendError Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckBackend

Describe HoareFrontendWarning Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckFrontend

Describe HoareFrontendError Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckFrontend

Describe HoareCheckResults Source # 
Instance details

Defined in Camfort.Specification.Hoare

Describe [Char] Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe a => Describe (LogMessage a) Source # 
Instance details

Defined in Camfort.Analysis.Logger

(Describe e, Describe w) => Describe (SomeMessage e w) Source # 
Instance details

Defined in Camfort.Analysis.Logger

describeShow :: Show a => a -> Text Source #

Convert a Show-able value directly to strict Text. Useful when you have a Show instance but not a Describe instance.

(<>) :: Semigroup a => a -> a -> a infixr 6 #

An associative operation.

>>> [1,2,3] <> [4,5,6]
[1,2,3,4,5,6]

Exit Code of reports

class ExitCodeOfReport a where Source #

Minimal complete definition

Nothing

Methods

exitCodeOf :: a -> Int Source #

Interpret an exit code from report (default 0)

exitCodeOfSet :: [a] -> Int Source #

Interpret an exit code from a set of reports (default: maximises absolute value)

Instances

Instances details
ExitCodeOfReport () Source # 
Instance details

Defined in Camfort.Analysis

Methods

exitCodeOf :: () -> Int Source #

exitCodeOfSet :: [()] -> Int Source #

ExitCodeOfReport Text Source # 
Instance details

Defined in Camfort.Analysis

ExitCodeOfReport ImplicitNoneReport Source # 
Instance details

Defined in Camfort.Analysis.Simple

ExitCodeOfReport DerivedDataTypeReport Source # 
Instance details

Defined in Camfort.Specification.DerivedDataType

ExitCodeOfReport ConsistencyResult Source # 
Instance details

Defined in Camfort.Specification.Stencils.Consistency

ExitCodeOfReport CheckResult Source # 
Instance details

Defined in Camfort.Specification.Stencils.CheckFrontend

ExitCodeOfReport StencilsReport Source # 
Instance details

Defined in Camfort.Specification.Stencils.InferenceFrontend

ExitCodeOfReport ConsistencyReport Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Consistent

ExitCodeOfReport InferenceResult Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Infer

ExitCodeOfReport HoareCheckResult Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckBackend

ExitCodeOfReport HoareCheckResults Source # 
Instance details

Defined in Camfort.Specification.Hoare

ExitCodeOfReport r => ExitCodeOfReport (AnalysisReport e w r) Source # 
Instance details

Defined in Camfort.Analysis