freec

Safe HaskellNone
LanguageHaskell2010

FreeC.Monad.Application

Contents

Description

This module contains the state monad used by the compiler's command line interface to pass command line options around implicitly.

Synopsis

State Monad

data Application a Source #

A state monad used by the compiler application to pass the command line options implicitly.

The entire application is lifted to the ConverterIO monad.

Instances
Monad Application Source # 
Instance details

Defined in FreeC.Monad.Application

Functor Application Source # 
Instance details

Defined in FreeC.Monad.Application

Methods

fmap :: (a -> b) -> Application a -> Application b Source #

(<$) :: a -> Application b -> Application a Source #

MonadFail Application Source #

Use MonadReporter to lift fail of Reporter to an Application.

Instance details

Defined in FreeC.Monad.Application

Methods

fail :: String -> Application a Source #

Applicative Application Source # 
Instance details

Defined in FreeC.Monad.Application

MonadIO Application Source #

IO actions can be embedded into applications.

Instance details

Defined in FreeC.Monad.Application

Methods

liftIO :: IO a -> Application a Source #

MonadConverter Application Source #

Promotes a Converter to an application that produces the same result and ignores the application's options.

Instance details

Defined in FreeC.Monad.Application

MonadReporter Application Source #

Promotes a reporter to an application that produces the same result and ignores the application's options.

This type class instance allows report and reportFatal to be used directly in do-blocks of the Application monad without explicitly lifting reporters.

Instance details

Defined in FreeC.Monad.Application

MonadState Options Application Source # 
Instance details

Defined in FreeC.Monad.Application

runApp :: Application a -> IO a Source #

Runs the compiler application.

reportApp :: Application a -> Application a Source #

Runs the given application and prints the reported messages.

Accessing and Modifying State

getOpts :: Application Options Source #

Gets the options of the application.

inOpts :: (Options -> a) -> Application a Source #

Gets a specific component of the the application's options using the given function to extract the value from the Options.

putOpts :: Options -> Application () Source #

Sets the options of the application.

modifyOpts :: (Options -> Options) -> Application () Source #

Modifies the options of the application.

modifyOpts' :: (Options -> (a, Options)) -> Application a Source #

Gets a specific component and modifies the options of the application.

Lifting Other Monads

liftReporter :: MonadReporter r => Reporter a -> r a Source #

Promotes a reporter to r.

liftReporterIO :: ReporterIO a -> Application a Source #

Promotes a ReporterIO to an application that produces the same result and ignores the application's options.

liftConverterIO :: ConverterIO a -> Application a Source #

Promotes a ConverterIO to an application that produces the same result and ignores the application's options.