Hoogle Search

Within LTS Haskell 24.52 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. loggedMessageThreadContext :: LoggedMessage -> KeyMap Value

    Blammo Blammo.Logging.Logger

    No documentation available.

  2. loggedMessageThreadContext :: LoggedMessage -> KeyMap Value

    Blammo Blammo.Logging.Test

    No documentation available.

  3. module Blammo.Logging.ThreadContext

    No documentation available.

  4. myThreadContext :: (MonadIO m, MonadThrow m) => m (KeyMap Value)

    Blammo Blammo.Logging.ThreadContext

    This function lets us retrieve the calling thread's thread context. For more detail, we can consult the docs for withThreadContext. Note that even though the type signature lists MonadThrow as a required constraint, the library guarantees that myThreadContext will never throw.

  5. withThreadContext :: (MonadIO m, MonadMask m) => [Pair] -> m a -> m a

    Blammo Blammo.Logging.ThreadContext

    This function lets us register structured, contextual info for the duration of the provided action. All messages logged within the provided action will automatically include this contextual info. This function is thread-safe, as the contextual info is scoped to the calling thread only. This function is additive: if we nest calls to it, each nested call will add to the existing thread context. In the case of overlapping keys, the nested call's Pair value(s) will win. Whenever the inner action completes, the thread context is rolled back to its value set in the enclosing action. If we wish to include the existing thread context from one thread in another thread, we must register the thread context explicitly on that other thread. myThreadContext can be leveraged in this case. Registering thread context for messages can be useful in many scenarios. One particularly apt scenario is in wai middlewares. We can generate an ID for each incoming request then include it in the thread context. Now all messages subsequently logged from our endpoint handler will automatically include that request ID:

    import Control.Monad.Logger.Aeson ((.=), withThreadContext)
    import Network.Wai (Middleware)
    import qualified Data.UUID.V4 as UUID
    
    addRequestId :: Middleware
    addRequestId app = \request sendResponse -> do
    uuid <- UUID.nextRandom
    withThreadContext ["requestId" .= uuid] do
    app request sendResponse
    
    If we're coming from a Java background, it may be helpful for us to draw parallels between this function and log4j2's ThreadContext (or perhaps log4j's MDC). They all enable the same thing: setting some thread-local info that will be automatically pulled into each logged message.

  6. tryReadChan :: BoundedChan a -> IO (Maybe a)

    BoundedChan Control.Concurrent.BoundedChan

    A variant of readChan which, instead of blocking when the channel is empty, immediately returns Nothing. Otherwise, tryReadChan returns Just a where a is the element read from the channel. Note that this routine can still block while waiting for read access to the channel.

  7. RunZSpread :: Ts -> Map BondName (Date, Rational) -> BondPricingInput

    Hastructure Assumptions

    PV curve as well as bond trading price with a deal used to calc Z - spread

  8. AddSpreadToBonds :: BondName -> ModifyType

    Hastructure Deal.DealMod

    No documentation available.

  9. ScaleBySpread :: AdjStrategy

    Hastructure Deal.DealMod

    No documentation available.

  10. _getSpread :: RateType -> Maybe Spread

    Hastructure InterestRate

    No documentation available.

Page 737 of many | Previous | Next