Copyright | (c) 2018-2019 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Provides type class for values that has access to LogAction
.
Synopsis
- class HasLog env msg m where
- getLogAction :: env -> LogAction m msg
- setLogAction :: LogAction m msg -> env -> env
- overLogAction :: (LogAction m msg -> LogAction m msg) -> env -> env
- logActionL :: Lens' env (LogAction m msg)
- type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s
Documentation
class HasLog env msg m where Source #
This types class contains simple pair of getter-setter and related
functions.
It also provides the useful lens logActionL
with the default implementation using type
class methods. The default one could be easily overritten under your instances.
Every instance of the this typeclass should satisfy the following laws:
- Set-Get:
getLogAction
(setLogAction
l env) ≡ l - Get-Set:
setLogAction
(getLogAction
env) env ≡ env - Set-Set:
setLogAction
l2 (setLogAction
l1 env) ≡setLogAction
l2 env - Set-Over:
overLogAction
f env ≡setLogAction
(f $getLogAction
env) env
getLogAction :: env -> LogAction m msg Source #
Extracts LogAction
from the environment.
setLogAction :: LogAction m msg -> env -> env Source #
Sets LogAction
to the given one inside the environment.
overLogAction :: (LogAction m msg -> LogAction m msg) -> env -> env Source #
Applies function to the LogAction
inside the environment.
logActionL :: Lens' env (LogAction m msg) Source #
Lens for LogAction
inside the environment.
Instances
HasLog (LogAction m msg) msg m Source # | |
Defined in Colog.Core.Class getLogAction :: LogAction m msg -> LogAction m msg Source # setLogAction :: LogAction m msg -> LogAction m msg -> LogAction m msg Source # overLogAction :: (LogAction m msg -> LogAction m msg) -> LogAction m msg -> LogAction m msg Source # logActionL :: Lens' (LogAction m msg) (LogAction m msg) Source # |
Lens
To keep co-log-core
a lightweight library it was decided to introduce local
Lens'
type alias as it doesn't harm.