Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Provides internal utility functions
Synopsis
- throwIfEx :: (MonadIORef m, MonadThrow m) => IORef (Maybe SomeException) -> m ()
- whenM :: Monad m => m Bool -> m () -> m ()
- matchesWildcards :: Text -> Text -> Bool
- stripInfix :: Text -> Text -> Maybe (Text, Text)
- breakEqBS :: ByteString -> (ByteString, ByteString)
- percentEncode :: ByteString -> ByteString
- percentDecode :: ByteString -> ByteString
- mergeAlt :: Alternative f => Lens' s (f a) -> Lens' t (f a) -> s -> t -> f a
- merge :: (a -> a -> a) -> Lens' s a -> Lens' t a -> s -> t -> a
- normalizedFormat :: Bytes B Natural -> Text
- formatBytes :: (BaseFormatter (Unwrapped a) ~ FloatingFormatter, PrintfArg (Unwrapped a), Sized a, Unwrapper a) => a -> Text
- readLogLevel :: MonadFail m => Text -> m (Maybe LogLevel)
- logLevelStrings :: String
- getPathSize :: (HasCallStack, MonadAsync m, MonadCatch m, MonadLoggerNS m, MonadPathReader m, MonadPosixCompat m, MonadTerminal m) => OsPath -> m (Bytes B Natural)
- getPathSizeIgnoreDirSize :: (HasCallStack, MonadAsync m, MonadCatch m, MonadLoggerNS m, MonadPathReader m, MonadPosixCompat m, MonadTerminal m) => OsPath -> m (Bytes B Natural)
- getSymLinkSize :: (HasCallStack, MonadPosixCompat m, MonadThrow m) => OsPath -> m (Bytes B Natural)
- filterSeqM :: forall m a. Monad m => (a -> m Bool) -> Seq a -> m (Seq a)
- renderPretty :: Pretty a => a -> Text
- setRefIfJust :: MonadIORef m => IORef (Maybe a) -> Maybe a -> m ()
- noBuffering :: (HasCallStack, MonadHandleWriter m) => m ()
- getAllFiles :: (HasCallStack, MonadCatch m, MonadLoggerNS m, MonadPathReader m) => OsPath -> m [OsPath]
- localTimeToMillis :: LocalTime -> Integer
- getRandomTmpFile :: (HasCallStack, MonadLoggerNS m, MonadPathReader m, MonadThrow m, MonadTime m) => OsPath -> m OsPath
FAM combinators
throwIfEx :: (MonadIORef m, MonadThrow m) => IORef (Maybe SomeException) -> m () Source #
Throws the exception if it exists in the ref.
Text
matchesWildcards :: Text -> Text -> Bool Source #
matchesWildcards matchStr toMatch
returns true if toMatch
"matches"
the matchStr
, where unescaped asterisks in matchStr
are interpreted
as wildcards.
stripInfix :: Text -> Text -> Maybe (Text, Text) Source #
stripInfix text needle
strips the _first_ occurrence of needle
from the text.
ByteString
breakEqBS :: ByteString -> (ByteString, ByteString) Source #
Breaks a bytestring on the first '='. The '=' is removed from the second element.
Percent encoding
percentEncode :: ByteString -> ByteString Source #
Percent encoded a bytestring.
percentDecode :: ByteString -> ByteString Source #
Percent decodes a bytestring.
Optics
mergeAlt :: Alternative f => Lens' s (f a) -> Lens' t (f a) -> s -> t -> f a Source #
Merge two fields using the Alternative
instance.
merge :: (a -> a -> a) -> Lens' s a -> Lens' t a -> s -> t -> a Source #
Merge two fields using the given function.
Bytes formatting
formatBytes :: (BaseFormatter (Unwrapped a) ~ FloatingFormatter, PrintfArg (Unwrapped a), Sized a, Unwrapper a) => a -> Text Source #
Formats the bytes.
Logs
logLevelStrings :: String Source #
String description of possible log levels parsed by readLogLevel
.
PathSize
getPathSize :: (HasCallStack, MonadAsync m, MonadCatch m, MonadLoggerNS m, MonadPathReader m, MonadPosixCompat m, MonadTerminal m) => OsPath -> m (Bytes B Natural) Source #
getPathSizeIgnoreDirSize :: (HasCallStack, MonadAsync m, MonadCatch m, MonadLoggerNS m, MonadPathReader m, MonadPosixCompat m, MonadTerminal m) => OsPath -> m (Bytes B Natural) Source #
getSymLinkSize :: (HasCallStack, MonadPosixCompat m, MonadThrow m) => OsPath -> m (Bytes B Natural) Source #
Misc
filterSeqM :: forall m a. Monad m => (a -> m Bool) -> Seq a -> m (Seq a) Source #
Filter a sequence monadically.
renderPretty :: Pretty a => a -> Text Source #
Renders via pretty instance.
setRefIfJust :: MonadIORef m => IORef (Maybe a) -> Maybe a -> m () Source #
Sets the ioref if the maybe is non-empty.
noBuffering :: (HasCallStack, MonadHandleWriter m) => m () Source #
Sets NoBuffering.
getAllFiles :: (HasCallStack, MonadCatch m, MonadLoggerNS m, MonadPathReader m) => OsPath -> m [OsPath] Source #
localTimeToMillis :: LocalTime -> Integer Source #
getRandomTmpFile :: (HasCallStack, MonadLoggerNS m, MonadPathReader m, MonadThrow m, MonadTime m) => OsPath -> m OsPath Source #