Hoogle Search

Within LTS Haskell 24.35 (ghc-9.10.3)

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

  1. gmapQr :: forall r r' . Data a => (r' -> r -> r) -> r -> (forall d . Data d => d -> r') -> a -> r

    basement Basement.Imports

    A generic query with a right-associative binary operator

  2. gmapT :: Data a => (forall b . Data b => b -> b) -> a -> a

    basement Basement.Imports

    A generic transformation that maps over the immediate subterms The default definition instantiates the type constructor c in the type of gfoldl to an identity datatype constructor, using the isomorphism pair as injection and projection.

  3. charMap :: (Char -> Char) -> String -> String

    basement Basement.String

    Monomorphically map the character in a string and return the transformed one

  4. cmap :: forall a b (m :: Type -> Type) . (a -> b) -> LogAction m b -> LogAction m a

    co-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 LogRecord
    logRecordAction :: LogAction m LogRecord
    
    when you only have action that consumes Text
    logTextAction :: 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.

  5. cmapM :: Monad m => (a -> m b) -> LogAction m b -> LogAction m a

    co-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
    

  6. cmapMaybe :: forall (m :: Type -> Type) a b . Applicative m => (a -> Maybe b) -> LogAction m b -> LogAction m a

    co-log-core Colog.Core.Action

    cmap for convertions that may fail

  7. cmapMaybeM :: Monad m => (a -> m (Maybe b)) -> LogAction m b -> LogAction m a

    co-log-core Colog.Core.Action

    Similar to cmapMaybe but for convertions that may fail inside a monadic context.

  8. concatMapMonoid :: Monoid m => (time -> m) -> (body -> m) -> T time body -> m

    event-list Data.EventList.Absolute.TimeBody

    No documentation available.

  9. concatMapMonoid :: Monoid m => (time -> m) -> (body -> m) -> T time body -> m

    event-list Data.EventList.Absolute.TimeTime

    No documentation available.

  10. concatMapMonoid :: Monoid m => (time -> m) -> (body -> m) -> T time body -> m

    event-list Data.EventList.Relative.BodyBody

    No documentation available.

Page 525 of many | Previous | Next