Hoogle Search
Within LTS Haskell 24.66 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
cmap :: forall a b (m :: Type -> Type) . (a -> b) -> LogAction m b -> LogAction m aco-log-core Colog.Core.Action This combinator is contramap from contravariant functor. It is useful when you have something like
data LogRecord = LR { lrName :: LoggerName , lrMessage :: Text }and you need to provide LogAction which consumes LogRecordlogRecordAction :: LogAction m LogRecord
when you only have action that consumes TextlogTextAction :: LogAction m Text
With cmap you can do the following:logRecordAction :: LogAction m LogRecord logRecordAction = cmap lrMesssage logTextAction
This action will print only lrMessage from LogRecord. But if you have formatting function like this:formatLogRecord :: LogRecord -> Text
you can apply it instead of lrMessage to log formatted LogRecord as Text.cmapM :: Monad m => (a -> m b) -> LogAction m b -> LogAction m aco-log-core Colog.Core.Action cmapM combinator is similar to cmap but allows to call monadic functions (functions that require extra context) to extend consumed value. Consider the following example. You have this logging record:
data LogRecord = LR { lrTime :: UTCTime , lrMessage :: Text }and you also have logging consumer inside IO for such record:logRecordAction :: LogAction IO LogRecord
But you need to return consumer only for Text messages:logTextAction :: LogAction IO Text
If you have function that can extend Text to LogRecord like the function below:withTime :: Text -> IO LogRecord withTime msg = do time <- getCurrentTime pure (LR time msg)
you can achieve desired behavior with cmapM in the following way:logTextAction :: LogAction IO Text logTextAction = cmapM withTime myAction
-
co-log-core Colog.Core.Action cmap for convertions that may fail
cmapMaybeM :: Monad m => (a -> m (Maybe b)) -> LogAction m b -> LogAction m aco-log-core Colog.Core.Action Similar to cmapMaybe but for convertions that may fail inside a monadic context.
type
HasLinearMap (v :: Type -> Type) = (HasBasis v, Traversable v)diagrams-core Diagrams.Core HasLinearMap is a constraint synonym, just to help shorten some of the ridiculously long constraint sets.
newtype
SubMap b (v :: Type -> Type) n mdiagrams-core Diagrams.Core A SubMap is a map associating names to subdiagrams. There can be multiple associations for any given name.
SubMap :: Map Name [Subdiagram b v n m] -> SubMap b (v :: Type -> Type) n mdiagrams-core Diagrams.Core No documentation available.
-
diagrams-core Diagrams.Core Lens onto the SubMap of a QDiagram (i.e. an association from names to subdiagrams).
type
HasLinearMap (v :: Type -> Type) = (HasBasis v, Traversable v)diagrams-core Diagrams.Core.Transform HasLinearMap is a constraint synonym, just to help shorten some of the ridiculously long constraint sets.
newtype
SubMap b (v :: Type -> Type) n mdiagrams-core Diagrams.Core.Types A SubMap is a map associating names to subdiagrams. There can be multiple associations for any given name.