componentm-devel-0.0.0.2: Easy REPL driven development using ComponentM

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Component.Development

Contents

Synopsis

Making ComponentM values useful

data ComponentM a :: * -> * #

Represents the construction of a Component in your application, components may be composed using a Monad or Applicative interface.

Instances

Monad ComponentM 

Methods

(>>=) :: ComponentM a -> (a -> ComponentM b) -> ComponentM b #

(>>) :: ComponentM a -> ComponentM b -> ComponentM b #

return :: a -> ComponentM a #

fail :: String -> ComponentM a #

Functor ComponentM 

Methods

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

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

Applicative ComponentM 

Methods

pure :: a -> ComponentM a #

(<*>) :: ComponentM (a -> b) -> ComponentM a -> ComponentM b #

liftA2 :: (a -> b -> c) -> ComponentM a -> ComponentM b -> ComponentM c #

(*>) :: ComponentM a -> ComponentM b -> ComponentM b #

(<*) :: ComponentM a -> ComponentM b -> ComponentM a #

MonadIO ComponentM 

Methods

liftIO :: IO a -> ComponentM a #

MonadThrow ComponentM 

Methods

throwM :: Exception e => e -> ComponentM a #

runComponentDevel Source #

Arguments

:: (ComponentEvent -> IO ())

Callback function to trace ComponentEvent records

-> Text

Name of your application (used for tracing purposes)

-> ComponentM a

Builder of your application environment

-> (a -> IO b)

Function where your main application will live, note this function must block the thread as how the normal main would

-> IO () 

Similar to runComponentM1, when running for the first time, it creates an application in the REPL environment, subsequent invocations will teardown the and build up the application again.

All ComponentM characteristics are driven by this particular use-case given:

  • It will print out the time spent on initialization and teardown
  • It guarantees that teardown operations are as robust as possible
  • It documents your application components to pin-point quickly errors in your reloading logic

Error Records

data ComponentError :: * #

Exception thrown by the runComponentM family of functions

Constructors

ComponentRuntimeFailed

Failure raised when the Application Callback given to a runComponentM function throws an exception

Fields

ComponentBuildFailed

Failure raised when execution of ComponentM throws an exception

Fields

Instances

Show ComponentError 
Generic ComponentError 

Associated Types

type Rep ComponentError :: * -> * #

Exception ComponentError 
Pretty ComponentError 

Methods

pretty :: ComponentError -> Doc ann #

prettyList :: [ComponentError] -> Doc ann #

type Rep ComponentError 
type Rep ComponentError = D1 * (MetaData "ComponentError" "Control.Monad.Component.Internal.Types" "componentm-0.0.0.2-1CiiSkZ0vt8JdQViYKb6rA" False) ((:+:) * (C1 * (MetaCons "ComponentRuntimeFailed" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "componentErrorOriginalException") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * SomeException)) (S1 * (MetaSel (Just Symbol "componentErrorTeardownResult") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * TeardownResult)))) (C1 * (MetaCons "ComponentBuildFailed" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "componentErrorBuildErrors") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * [ComponentBuildError])) (S1 * (MetaSel (Just Symbol "componentErrorTeardownResult") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * TeardownResult)))))

data ComponentBuildError :: * #

Exception raised on the execution of IO sub-routines used when constructing ComponentM values (e.g. buildComponent)

Constructors

DuplicatedComponentKeyDetected !Description

Failure thrown when using the same component key on a Component composition

ComponentAllocationFailed !Description !SomeException

Failure thrown when the allocation sub-routine of a Component fails with an exception

ComponentErrorThrown !SomeException

Failure thrown when calling the throwM when composing ComponentM values

ComponentIOLiftFailed !SomeException

Failure thrown when calling liftIO fails with an exception

Instances

Show ComponentBuildError 
Generic ComponentBuildError 
Exception ComponentBuildError 
Pretty ComponentBuildError 
type Rep ComponentBuildError 
type Rep ComponentBuildError = D1 * (MetaData "ComponentBuildError" "Control.Monad.Component.Internal.Types" "componentm-0.0.0.2-1CiiSkZ0vt8JdQViYKb6rA" False) ((:+:) * ((:+:) * (C1 * (MetaCons "DuplicatedComponentKeyDetected" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Description))) (C1 * (MetaCons "ComponentAllocationFailed" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Description)) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * SomeException))))) ((:+:) * (C1 * (MetaCons "ComponentErrorThrown" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * SomeException))) (C1 * (MetaCons "ComponentIOLiftFailed" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * SomeException)))))

ComponentM tracing accessors

data ComponentEvent :: * #

An event record used to trace the execution of an application initialization and teardown

data Build :: * #

Contains metadata about the build of a resource from a ComponentM value

Instances

Generic Build 

Associated Types

type Rep Build :: * -> * #

Methods

from :: Build -> Rep Build x #

to :: Rep Build x -> Build #

Pretty Build 

Methods

pretty :: Build -> Doc ann #

prettyList :: [Build] -> Doc ann #

Display Build 

Methods

display :: Build -> Utf8Builder #

type Rep Build 
type Rep Build = D1 * (MetaData "Build" "Control.Monad.Component.Internal.Types" "componentm-0.0.0.2-1CiiSkZ0vt8JdQViYKb6rA" False) (C1 * (MetaCons "Build" PrefixI True) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "componentDesc") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Description)) (S1 * (MetaSel (Just Symbol "componentTeardown") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * Teardown))) ((:*:) * (S1 * (MetaSel (Just Symbol "buildElapsedTime") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * NominalDiffTime)) ((:*:) * (S1 * (MetaSel (Just Symbol "buildFailure") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Maybe SomeException))) (S1 * (MetaSel (Just Symbol "buildDependencies") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * (Set Description)))))))

buildElapsedTime :: Build -> NominalDiffTime #

Elasped time in the allocation of a component resource

buildFailure :: Build -> Maybe SomeException #

Error thrown in the allocation of a component resource

data BuildResult :: * #

Wraps a collection of Build records