camfort-1.2.0: CamFort - Cambridge Fortran infrastructure
Safe HaskellSafe-Inferred
LanguageHaskell2010

Camfort.Analysis.Logger

Description

Provides logging for analyses. MonadLogger is a type class for monads which support logging. LoggerT is a concrete monad transformer instantiating the class.

As a logger runs, it may print out log messages on the fly (depending on the provided LogOutput function). It also collects logs to be inspected at the end of the computation.

A log message must usually include an Origin, which describes where in a Fortran source file the message originated. This is made more convenient via functions such as 'logWarn'', which produces an Origin based on a piece of Fortran syntax, along with a default source file stored in the environment.

Log messages each come with an associated LogLevel:

  • LogError is for hard errors which will often cause the computation to fail.
  • LogWarn is for messages about things that are likely to cause problems.
  • LogInfo is for general information about what the computation is doing.
  • LogDebug is for extra-verbose output that helps with debugging, but which will be uninteresting to most users.
Synopsis

Conversion to text description

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

Defined in Camfort.Analysis.Logger

Describe LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Origin 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 HoareCheckResults Source # 
Instance details

Defined in Camfort.Specification.Hoare

Describe HoareBackendError Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckBackend

Describe HoareCheckResult Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckBackend

Describe HoareFrontendError Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckFrontend

Describe HoareFrontendWarning Source # 
Instance details

Defined in Camfort.Specification.Hoare.CheckFrontend

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

Defined in Camfort.Specification.Units.Analysis.Infer

Describe InferenceResult Source # 
Instance details

Defined in Camfort.Specification.Units.Analysis.Infer

Describe TranslateError Source # 
Instance details

Defined in Language.Fortran.Model.Translate

Describe SrcSpan Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Text 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 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 a => Describe (LogMessage a) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe [Char] Source # 
Instance details

Defined in Camfort.Analysis.Logger

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

Defined in Camfort.Analysis.Logger

tellDescribe :: (MonadWriter Builder m, Describe a) => a -> m () Source #

Write a Describe-able value directly into a writer monad.

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.

builderToStrict :: Builder -> Text Source #

A convenience combinator to directly convert a lazy text Builder to a strict Text value.

data Builder #

A Builder is an efficient way to build lazy Text values. There are several functions for constructing builders, but only one to inspect them: to extract any data, you have to turn them into lazy Text values using toLazyText.

Internally, a builder constructs a lazy Text by filling arrays piece by piece. As each buffer is filled, it is 'popped' off, to become a new chunk of the resulting lazy Text. All this is hidden from the user of the Builder.

Instances

Instances details
IsString Builder

Performs replacement on invalid scalar values:

>>> :set -XOverloadedStrings
>>> "\55555" :: Builder
"\65533"
Instance details

Defined in Data.Text.Internal.Builder

Methods

fromString :: String -> Builder #

Monoid Builder 
Instance details

Defined in Data.Text.Internal.Builder

Semigroup Builder 
Instance details

Defined in Data.Text.Internal.Builder

Show Builder 
Instance details

Defined in Data.Text.Internal.Builder

Eq Builder 
Instance details

Defined in Data.Text.Internal.Builder

Methods

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

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

Ord Builder 
Instance details

Defined in Data.Text.Internal.Builder

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
ExitCodeOfReport Text Source # 
Instance details

Defined in Camfort.Analysis

Describe Text Source # 
Instance details

Defined in Camfort.Analysis.Logger

Hashable Text 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

Ixed Text 
Instance details

Defined in Control.Lens.At

AsEmpty Text 
Instance details

Defined in Control.Lens.Empty

Methods

_Empty :: Prism' Text () #

Reversing Text 
Instance details

Defined in Control.Lens.Internal.Iso

Methods

reversing :: Text -> Text #

Prefixed Text 
Instance details

Defined in Control.Lens.Prism

Methods

prefixed :: Text -> Prism' Text Text #

Suffixed Text 
Instance details

Defined in Control.Lens.Prism

Methods

suffixed :: Text -> Prism' Text Text #

Cons Text Text Char Char 
Instance details

Defined in Control.Lens.Cons

Methods

_Cons :: Prism Text Text (Char, Text) (Char, Text) #

Snoc Text Text Char Char 
Instance details

Defined in Control.Lens.Cons

Methods

_Snoc :: Prism Text Text (Text, Char) (Text, Char) #

(a ~ Char, b ~ Char) => Each Text Text a b
each :: Traversal Text Text Char Char
Instance details

Defined in Control.Lens.Each

Methods

each :: Traversal Text Text a b #

type Item Text 
Instance details

Defined in Data.Text

type Item Text = Char
type Index Text 
Instance details

Defined in Control.Lens.At

type Index Text = Int
type IxValue Text 
Instance details

Defined in Control.Lens.At

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

An associative operation.

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

Messages

data Origin Source #

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

Constructors

Origin 

Fields

Instances

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

Show Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

NFData Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

rnf :: Origin -> () #

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

type Rep Origin Source # 
Instance details

Defined in Camfort.Analysis.Logger

type Rep Origin = D1 ('MetaData "Origin" "Camfort.Analysis.Logger" "camfort-1.2.0-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)))

parseOrigin :: String -> Maybe ParsedOrigin Source #

Extract information about filename and source span from a string.

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
Show LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Describe LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Eq LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

Ord LogLevel Source # 
Instance details

Defined in Camfort.Analysis.Logger

data LogMessage a Source #

A logged message with an origin and a message value.

Constructors

LogMessage 

Fields

Instances

Instances details
Foldable LogMessage Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

fold :: Monoid m => LogMessage m -> m #

foldMap :: Monoid m => (a -> m) -> LogMessage a -> m #

foldMap' :: Monoid m => (a -> m) -> LogMessage a -> m #

foldr :: (a -> b -> b) -> b -> LogMessage a -> b #

foldr' :: (a -> b -> b) -> b -> LogMessage a -> b #

foldl :: (b -> a -> b) -> b -> LogMessage a -> b #

foldl' :: (b -> a -> b) -> b -> LogMessage a -> b #

foldr1 :: (a -> a -> a) -> LogMessage a -> a #

foldl1 :: (a -> a -> a) -> LogMessage a -> a #

toList :: LogMessage a -> [a] #

null :: LogMessage a -> Bool #

length :: LogMessage a -> Int #

elem :: Eq a => a -> LogMessage a -> Bool #

maximum :: Ord a => LogMessage a -> a #

minimum :: Ord a => LogMessage a -> a #

sum :: Num a => LogMessage a -> a #

product :: Num a => LogMessage a -> a #

Traversable LogMessage Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

traverse :: Applicative f => (a -> f b) -> LogMessage a -> f (LogMessage b) #

sequenceA :: Applicative f => LogMessage (f a) -> f (LogMessage a) #

mapM :: Monad m => (a -> m b) -> LogMessage a -> m (LogMessage b) #

sequence :: Monad m => LogMessage (m a) -> m (LogMessage a) #

Functor LogMessage Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

fmap :: (a -> b) -> LogMessage a -> LogMessage b #

(<$) :: a -> LogMessage b -> LogMessage a #

Generic (LogMessage a) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Associated Types

type Rep (LogMessage a) :: Type -> Type #

Methods

from :: LogMessage a -> Rep (LogMessage a) x #

to :: Rep (LogMessage a) x -> LogMessage a #

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

Defined in Camfort.Analysis.Logger

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

Defined in Camfort.Analysis.Logger

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

Defined in Camfort.Analysis.Logger

Methods

rnf :: LogMessage a -> () #

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

Defined in Camfort.Analysis.Logger

Methods

(==) :: LogMessage a -> LogMessage a -> Bool #

(/=) :: LogMessage a -> LogMessage a -> Bool #

type Rep (LogMessage a) Source # 
Instance details

Defined in Camfort.Analysis.Logger

type Rep (LogMessage a) = D1 ('MetaData "LogMessage" "Camfort.Analysis.Logger" "camfort-1.2.0-inplace" 'False) (C1 ('MetaCons "LogMessage" 'PrefixI 'True) (S1 ('MetaSel ('Just "_lmOrigin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Origin)) :*: S1 ('MetaSel ('Just "_lmMsg") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

lmMsg :: forall a a. Lens (LogMessage a) (LogMessage a) a a Source #

data SomeMessage e w Source #

A message at one of the four LogLevels.

Instances

Instances details
Generic (SomeMessage e w) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Associated Types

type Rep (SomeMessage e w) :: Type -> Type #

Methods

from :: SomeMessage e w -> Rep (SomeMessage e w) x #

to :: Rep (SomeMessage e w) x -> SomeMessage e w #

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

Defined in Camfort.Analysis.Logger

Methods

showsPrec :: Int -> SomeMessage e w -> ShowS #

show :: SomeMessage e w -> String #

showList :: [SomeMessage e w] -> ShowS #

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

Defined in Camfort.Analysis.Logger

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

Defined in Camfort.Analysis.Logger

Methods

rnf :: SomeMessage e w -> () #

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

Defined in Camfort.Analysis.Logger

Methods

(==) :: SomeMessage e w -> SomeMessage e w -> Bool #

(/=) :: SomeMessage e w -> SomeMessage e w -> Bool #

type Rep (SomeMessage e w) Source # 
Instance details

Defined in Camfort.Analysis.Logger

_MsgError :: forall e w e. Prism (SomeMessage e w) (SomeMessage e w) (LogMessage e) (LogMessage e) Source #

_MsgWarn :: forall e w w. Prism (SomeMessage e w) (SomeMessage e w) (LogMessage w) (LogMessage w) Source #

Logging monad

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

setDefaultSourceFile :: FilePath -> m () Source #

Set the default source file, i.e. the file in which messages originate by default.

default setDefaultSourceFile :: (MonadTrans t, MonadLogger e w m', m ~ t m') => FilePath -> m () Source #

getDefaultSourceFile :: m FilePath Source #

Get the current default source file, i.e. the file in which messages originate by default.

default getDefaultSourceFile :: (MonadTrans t, MonadLogger e w m', m ~ t m') => m FilePath Source #

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

Record a log message. Output it based on the LogOutput function used and store it in the collected logs.

default recordLogMessage :: (MonadTrans t, MonadLogger e w m', m ~ t m') => SomeMessage e w -> m () Source #

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

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 #

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 (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 #

(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 #

(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 #

(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 #

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.

data LoggerT e w m a Source #

The logging monad transformer, containing errors of type e and warnings of type w.

Instances

Instances details
(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 #

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

This doesn't behave quite as you may think. When a LoggerT is hoisted, the resulting LoggerT cannot output as it goes. It still collects logs to be inspected when it finishes.

Instance details

Defined in Camfort.Analysis.Logger

Methods

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

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

Defined in Camfort.Analysis.Logger

Methods

ask :: LoggerT e w m r #

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

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

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

Defined in Camfort.Analysis.Logger

Methods

get :: LoggerT e w m s #

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

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

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

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

MonadTrans (LoggerT e w) Source # 
Instance details

Defined in Camfort.Analysis.Logger

Methods

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

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

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

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

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

Defined in Camfort.Analysis.Logger

Methods

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

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

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

mapLoggerT :: Functor m => (e -> e') -> (w -> w') -> LoggerT e w m a -> LoggerT e' w' m a Source #

Change the error and warning types in a logger computation. To change the underlying monad use hoist.

Running a logger

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.

runLoggerT Source #

Arguments

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

The initial default source file. This is only used for displaying message origins.

-> LogOutput m

The logging output function. E.g. logOutputStd or logOutputNone.

-> LogLevel

The log level for on-the-fly logging. Doesn't affect which logs are collected at the end.

-> LoggerT e w m a

The logging action to run.

-> m (a, [SomeMessage e w]) 

Run the logging monad transformer. Returns the action's result value and a list of logs which were collected as it ran.