{-# LANGUAGE DeriveAnyClass #-}
module Emanote.Prelude where
import Control.Monad.Logger (MonadLogger, logDebugNS, logErrorNS, logInfoNS, logWarnNS)
import Relude
chainM :: Monad m => (b -> m (a -> a)) -> [b] -> m (a -> a)
chainM :: forall (m :: Type -> Type) b a.
Monad m =>
(b -> m (a -> a)) -> [b] -> m (a -> a)
chainM b -> m (a -> a)
f =
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. [a -> a] -> a -> a
chain forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: Type -> Type) (m :: Type -> Type) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM b -> m (a -> a)
f
where
chain :: [a -> a] -> a -> a
chain :: forall a. [a -> a] -> a -> a
chain = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall a b. (a -> b) -> a -> b
$ forall (f :: Type -> Type) a b.
Foldable f =>
(a -> b -> b) -> b -> f a -> b
flipfoldl' forall a b. (a -> b) -> a -> b
($)
newtype BadInput = BadInput Text
deriving stock (Int -> BadInput -> ShowS
[BadInput] -> ShowS
BadInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BadInput] -> ShowS
$cshowList :: [BadInput] -> ShowS
show :: BadInput -> String
$cshow :: BadInput -> String
showsPrec :: Int -> BadInput -> ShowS
$cshowsPrec :: Int -> BadInput -> ShowS
Show)
deriving anyclass (Show BadInput
Typeable @Type BadInput
SomeException -> Maybe BadInput
BadInput -> String
BadInput -> SomeException
forall e.
Typeable @Type e
-> Show e
-> (e -> SomeException)
-> (SomeException -> Maybe e)
-> (e -> String)
-> Exception e
displayException :: BadInput -> String
$cdisplayException :: BadInput -> String
fromException :: SomeException -> Maybe BadInput
$cfromException :: SomeException -> Maybe BadInput
toException :: BadInput -> SomeException
$ctoException :: BadInput -> SomeException
Exception)
log :: MonadLogger m => Text -> m ()
log :: forall (m :: Type -> Type). MonadLogger m => Text -> m ()
log = forall (m :: Type -> Type). MonadLogger m => Text -> Text -> m ()
logInfoNS Text
"emanote"
logD :: MonadLogger m => Text -> m ()
logD :: forall (m :: Type -> Type). MonadLogger m => Text -> m ()
logD = forall (m :: Type -> Type). MonadLogger m => Text -> Text -> m ()
logDebugNS Text
"emanote"
logE :: MonadLogger m => Text -> m ()
logE :: forall (m :: Type -> Type). MonadLogger m => Text -> m ()
logE = forall (m :: Type -> Type). MonadLogger m => Text -> Text -> m ()
logErrorNS Text
"emanote"
logW :: MonadLogger m => Text -> m ()
logW :: forall (m :: Type -> Type). MonadLogger m => Text -> m ()
logW = forall (m :: Type -> Type). MonadLogger m => Text -> Text -> m ()
logWarnNS Text
"emanote"