| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Messaging.Util
Synopsis
- class Show e => AnyError e where
- fromSomeException :: SomeException -> e
- (<$?>) :: MonadFail m => (a -> Either String b) -> m a -> m b
- ($>>) :: (Monad m, Monad f, Traversable f) => m (f a) -> m (f b) -> m (f b)
- (<$$) :: (Functor f, Functor g) => b -> f (g a) -> f (g b)
- (<$$>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
- raceAny_ :: MonadUnliftIO m => [m a] -> m ()
- bshow :: Show a => a -> ByteString
- tshow :: Show a => a -> Text
- maybeWord :: (a -> ByteString) -> Maybe a -> ByteString
- liftError :: MonadIO m => (e -> e') -> ExceptT e IO a -> ExceptT e' m a
- liftError' :: MonadIO m => (e -> e') -> IO (Either e a) -> ExceptT e' m a
- liftEitherWith :: MonadIO m => (e -> e') -> Either e a -> ExceptT e' m a
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- whenM :: Monad m => m Bool -> m () -> m ()
- unlessM :: Monad m => m Bool -> m () -> m ()
- anyM :: Monad m => [m Bool] -> m Bool
- ($>>=) :: (Monad m, Monad f, Traversable f) => m (f a) -> (a -> m (f b)) -> m (f b)
- mapME :: (Monad m, Traversable t) => (a -> m (Either e b)) -> t (Either e a) -> m (t (Either e b))
- bindRight :: Monad m => (a -> m (Either e b)) -> Either e a -> m (Either e b)
- forME :: (Monad m, Traversable t) => t (Either e a) -> (a -> m (Either e b)) -> m (t (Either e b))
- mapAccumLM :: (Monad m, Traversable t) => (acc -> x -> m (acc, y)) -> acc -> t x -> m (acc, t y)
- mapAccumLM_List :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])
- mapAccumLM_NonEmpty :: Monad m => (acc -> x -> m (acc, y)) -> acc -> NonEmpty x -> m (acc, NonEmpty y)
- tryWriteTBQueue :: TBQueue a -> a -> STM Bool
- catchAll :: IO a -> (SomeException -> IO a) -> IO a
- catchAll_ :: IO a -> IO a -> IO a
- tryAllErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m (Either e a)
- tryAllErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> m (Either e a)
- catchAllErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a
- catchAllErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> m a) -> m a
- catchThrow :: MonadUnliftIO m => ExceptT e m a -> (SomeException -> e) -> ExceptT e m a
- allFinally :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m b -> ExceptT e m a
- isOwnException :: SomeException -> Bool
- isAsyncCancellation :: SomeException -> Bool
- catchOwn' :: IO a -> (SomeException -> IO a) -> IO a
- catchOwn :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a
- tryAllOwnErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m (Either e a)
- tryAllOwnErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> m (Either e a)
- catchAllOwnErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a
- catchAllOwnErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> m a) -> m a
- eitherToMaybe :: Either a b -> Maybe b
- listToEither :: e -> [a] -> Either e a
- firstRow :: (a -> b) -> e -> IO [a] -> IO (Either e b)
- maybeFirstRow :: Functor f => (a -> b) -> f [a] -> f (Maybe b)
- maybeFirstRow' :: Functor f => b -> (a -> b) -> f [a] -> f b
- firstRow' :: (a -> Either e b) -> e -> IO [a] -> IO (Either e b)
- groupOn :: Eq k => (a -> k) -> [a] -> [[a]]
- groupOn' :: Eq k => (a -> k) -> [a] -> [NonEmpty a]
- eqOn :: Eq k => (a -> k) -> a -> a -> Bool
- groupAllOn :: Ord k => (a -> k) -> [a] -> [[a]]
- toChunks :: Int -> [a] -> [NonEmpty a]
- safeDecodeUtf8 :: ByteString -> Text
- timeoutThrow :: MonadUnliftIO m => e -> Int -> ExceptT e m a -> ExceptT e m a
- threadDelay' :: Int64 -> IO ()
- diffToMicroseconds :: NominalDiffTime -> Int64
- diffToMilliseconds :: NominalDiffTime -> Int64
- labelMyThread :: MonadIO m => String -> m ()
- atomicModifyIORef'_ :: IORef a -> (a -> a) -> IO ()
- encodeJSON :: ToJSON a => a -> Text
- decodeJSON :: FromJSON a => Text -> Maybe a
- traverseWithKey_ :: Monad m => (k -> v -> m ()) -> Map k v -> m ()
Documentation
class Show e => AnyError e where Source #
Methods
fromSomeException :: SomeException -> e Source #
Instances
| AnyError AgentErrorType Source # | |
Defined in Simplex.Messaging.Agent.Protocol Methods fromSomeException :: SomeException -> AgentErrorType Source # | |
| AnyError StoreError Source # | |
Defined in Simplex.Messaging.Agent.Store Methods fromSomeException :: SomeException -> StoreError Source # | |
| AnyError RCErrorType Source # | |
Defined in Simplex.RemoteControl.Types Methods fromSomeException :: SomeException -> RCErrorType Source # | |
liftError' :: MonadIO m => (e -> e') -> IO (Either e a) -> ExceptT e' m a Source #
liftEitherWith :: MonadIO m => (e -> e') -> Either e a -> ExceptT e' m a Source #
($>>=) :: (Monad m, Monad f, Traversable f) => m (f a) -> (a -> m (f b)) -> m (f b) infixl 1 Source #
mapME :: (Monad m, Traversable t) => (a -> m (Either e b)) -> t (Either e a) -> m (t (Either e b)) Source #
forME :: (Monad m, Traversable t) => t (Either e a) -> (a -> m (Either e b)) -> m (t (Either e b)) Source #
Arguments
| :: (Monad m, Traversable t) | |
| => (acc -> x -> m (acc, y)) | combining function |
| -> acc | initial state |
| -> t x | inputs |
| -> m (acc, t y) | final state, outputs |
Monadic version of mapAccumL Copied from ghc-9.6.3 package: https://hackage.haskell.org/package/ghc-9.12.1/docs/GHC-Utils-Monad.html#v:mapAccumLM for backward compatibility with 8.10.7.
mapAccumLM_List :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y]) Source #
mapAccumLM_NonEmpty :: Monad m => (acc -> x -> m (acc, y)) -> acc -> NonEmpty x -> m (acc, NonEmpty y) Source #
tryWriteTBQueue :: TBQueue a -> a -> STM Bool Source #
tryAllErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m (Either e a) Source #
tryAllErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> m (Either e a) Source #
catchAllErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a Source #
catchAllErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> m a) -> m a Source #
catchThrow :: MonadUnliftIO m => ExceptT e m a -> (SomeException -> e) -> ExceptT e m a Source #
allFinally :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m b -> ExceptT e m a Source #
isOwnException :: SomeException -> Bool Source #
isAsyncCancellation :: SomeException -> Bool Source #
tryAllOwnErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> ExceptT e m (Either e a) Source #
tryAllOwnErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> m (Either e a) Source #
catchAllOwnErrors :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a Source #
catchAllOwnErrors' :: (AnyError e, MonadUnliftIO m) => ExceptT e m a -> (e -> m a) -> m a Source #
eitherToMaybe :: Either a b -> Maybe b Source #
listToEither :: e -> [a] -> Either e a Source #
maybeFirstRow :: Functor f => (a -> b) -> f [a] -> f (Maybe b) Source #
maybeFirstRow' :: Functor f => b -> (a -> b) -> f [a] -> f b Source #
groupAllOn :: Ord k => (a -> k) -> [a] -> [[a]] Source #
safeDecodeUtf8 :: ByteString -> Text Source #
timeoutThrow :: MonadUnliftIO m => e -> Int -> ExceptT e m a -> ExceptT e m a Source #
threadDelay' :: Int64 -> IO () Source #
diffToMicroseconds :: NominalDiffTime -> Int64 Source #
diffToMilliseconds :: NominalDiffTime -> Int64 Source #
labelMyThread :: MonadIO m => String -> m () Source #
atomicModifyIORef'_ :: IORef a -> (a -> a) -> IO () Source #
encodeJSON :: ToJSON a => a -> Text Source #
decodeJSON :: FromJSON a => Text -> Maybe a Source #
traverseWithKey_ :: Monad m => (k -> v -> m ()) -> Map k v -> m () Source #