| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Monad.Component.Development
Synopsis
- data ComponentM a
- runComponentDevel :: (ComponentEvent -> IO ()) -> Text -> ComponentM a -> (a -> IO b) -> IO ()
- data ComponentError
- data ComponentBuildError
- = DuplicatedComponentKeyDetected !Description
- | ComponentAllocationFailed !Description !SomeException
- | ComponentErrorThrown !SomeException
- | ComponentIOLiftFailed !SomeException
- data ComponentEvent
- data Build
- buildElapsedTime :: Build -> NominalDiffTime
- buildFailure :: Build -> Maybe SomeException
- data BuildResult
- toBuildList :: BuildResult -> [Build]
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
Arguments
| :: (ComponentEvent -> IO ()) | Callback function to trace |
| -> 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 |
Fields
| |
| ComponentBuildFailed | Failure raised when execution of |
Fields
| |
Instances
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 |
| ComponentIOLiftFailed !SomeException | Failure thrown when calling |
Instances
ComponentM tracing accessors
data ComponentEvent #
An event record used to trace the execution of an application initialization and teardown
Constructors
| ComponentBuilt !BuildResult | |
| ComponentReleased !TeardownResult | |
| ComponentErrorDetected !ComponentError |
Instances
| Pretty ComponentEvent | |
Defined in Control.Monad.Component.Internal.Types | |
| Display ComponentEvent | |
Defined in Control.Monad.Component.Internal.Types | |
Contains metadata about the build of a resource from a ComponentM value
Instances
| Generic Build | |
| Pretty Build | |
Defined in Control.Monad.Component.Internal.Types | |
| Display Build | |
Defined in Control.Monad.Component.Internal.Types | |
| type Rep Build | |
Defined in Control.Monad.Component.Internal.Types type Rep Build = D1 (MetaData "Build" "Control.Monad.Component.Internal.Types" "componentm-0.0.0.2-ATWczXExlLS9uibG4dVTWF" False) (C1 (MetaCons "Build" PrefixI True) ((S1 (MetaSel (Just "componentDesc") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Description) :*: S1 (MetaSel (Just "componentTeardown") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Teardown)) :*: (S1 (MetaSel (Just "buildElapsedTime") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 NominalDiffTime) :*: (S1 (MetaSel (Just "buildFailure") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe SomeException)) :*: S1 (MetaSel (Just "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
Instances
| Pretty BuildResult | |
Defined in Control.Monad.Component.Internal.Types | |
| Display BuildResult | |
Defined in Control.Monad.Component.Internal.Types | |
toBuildList :: BuildResult -> [Build] #