rio 0.1.9.2 → 0.1.10.0
raw patch · 43 files changed
+356/−49 lines, 43 filesdep ~typed-process
Dependency ranges changed: typed-process
Files
- ChangeLog.md +13/−0
- rio.cabal +7/−5
- src/RIO.hs +3/−0
- src/RIO/ByteString.hs +5/−1
- src/RIO/ByteString/Lazy.hs +5/−1
- src/RIO/ByteString/Lazy/Partial.hs +3/−2
- src/RIO/ByteString/Partial.hs +3/−2
- src/RIO/Char.hs +3/−0
- src/RIO/Char/Partial.hs +3/−0
- src/RIO/File.hs +15/−14
- src/RIO/HashMap.hs +3/−0
- src/RIO/HashMap/Partial.hs +3/−0
- src/RIO/List.hs +3/−0
- src/RIO/List/Partial.hs +3/−0
- src/RIO/Map.hs +4/−0
- src/RIO/Map/Partial.hs +3/−0
- src/RIO/Map/Unchecked.hs +5/−3
- src/RIO/NonEmpty.hs +83/−0
- src/RIO/NonEmpty/Partial.hs +14/−0
- src/RIO/Partial.hs +2/−1
- src/RIO/Prelude.hs +1/−1
- src/RIO/Prelude/Display.hs +12/−2
- src/RIO/Prelude/Logger.hs +29/−9
- src/RIO/Prelude/Types.hs +4/−0
- src/RIO/Process.hs +53/−3
- src/RIO/Set.hs +4/−0
- src/RIO/Set/Partial.hs +3/−0
- src/RIO/Set/Unchecked.hs +3/−1
- src/RIO/Text/Lazy/Partial.hs +3/−2
- src/RIO/Text/Partial.hs +3/−2
- src/RIO/Vector.hs +4/−0
- src/RIO/Vector/Boxed.hs +4/−0
- src/RIO/Vector/Boxed/Partial.hs +3/−0
- src/RIO/Vector/Boxed/Unsafe.hs +4/−0
- src/RIO/Vector/Partial.hs +3/−0
- src/RIO/Vector/Storable.hs +4/−0
- src/RIO/Vector/Storable/Partial.hs +3/−0
- src/RIO/Vector/Storable/Unsafe.hs +4/−0
- src/RIO/Vector/Unboxed.hs +4/−0
- src/RIO/Vector/Unboxed/Partial.hs +3/−0
- src/RIO/Vector/Unboxed/Unsafe.hs +4/−0
- src/RIO/Vector/Unsafe.hs +4/−0
- test/RIO/LoggerSpec.hs +14/−0
ChangeLog.md view
@@ -1,5 +1,18 @@ # Changelog for rio +## 0.1.10.0++* Relax a bunch of `RIO.File` functions from `MonadUnliftIO` to `MonadIO`+* Custom `Monoid` instance for `Utf8Builder` that matches semantics of the+ derived one, but doesn't break list fusion+* Qualified import recommendations for `*.Partial`, `*.Unchecked`, `*.Unsafe`+* Re-export `Data.Ord.Down` from `RIO.Prelude`+* Addition of `RIO.NonEmpty` module+* Addition of `RIO.NonEmpty.Partial` module+* Export `NonEmpty` type and its constructor `(:|)` from RIO.Prelude.Types+* Fix handling of non-ASCII characters in `logSticky`+* Deprecate `withProcess` and `withProcess_`, add `withProcessWait`, `withProcessWait_`, `withProcessTerm`, and `withProcessTerm_`+ ## 0.1.9.2 * Bring back re-export of `Monad.fail` from `RIO.Prelude`.
rio.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: c33027526ffc54db8cec5929c470c83ccf256752d6502bae18316d3ccd807bf9+-- hash: a9a19c2ab9bf97b6ca7f930086169ac5fd4ae379d215117d19b7d9533058b4a8 name: rio-version: 0.1.9.2+version: 0.1.10.0 synopsis: A standard library for Haskell description: See README and Haddocks at <https://www.stackage.org/package/rio> category: Control@@ -47,6 +47,8 @@ RIO.Map RIO.Map.Partial RIO.Map.Unchecked+ RIO.NonEmpty+ RIO.NonEmpty.Partial RIO.Partial RIO.Prelude RIO.Prelude.Simple@@ -105,7 +107,7 @@ , process , text , time- , typed-process >=0.2.2.0+ , typed-process >=0.2.5.0 , unliftio >=0.2.8.0 , unliftio-core , unordered-containers@@ -154,7 +156,7 @@ , rio , text , time- , typed-process >=0.2.2.0+ , typed-process >=0.2.5.0 , unliftio >=0.2.8.0 , unliftio-core , unordered-containers
src/RIO.hs view
@@ -10,6 +10,9 @@ -- > {-# LANGUAGE NoImplicitPrelude #-} -- > import RIO --+ -- Some functions not exported here can be found in "RIO.Partial":+ -- @fromJust@, @read@, @toEnum@, @pred@, @succ@.+ -- module RIO.Prelude , module RIO.Prelude.Types -- * The @RIO@ Monad
src/RIO/ByteString.hs view
@@ -1,7 +1,11 @@+{-# LANGUAGE NoImplicitPrelude #-}+ -- | Strict @ByteString@. Import as: -- -- > import qualified RIO.ByteString as B-{-# LANGUAGE NoImplicitPrelude #-}+--+-- This module does not export any partial functions. For those, see+-- "RIO.ByteString.Partial" module RIO.ByteString ( module Data.ByteString , module RIO.ByteString
src/RIO/ByteString/Lazy.hs view
@@ -1,7 +1,11 @@+{-# LANGUAGE NoImplicitPrelude #-}+ -- | Lazy @ByteString@. Import as: -- -- > import qualified RIO.ByteString.Lazy as BL-{-# LANGUAGE NoImplicitPrelude #-}+--+-- This module does not export any partial functions. For those, see+-- "RIO.ByteString.Lazy.Partial" module RIO.ByteString.Lazy ( -- * The @ByteString@ type
src/RIO/ByteString/Lazy/Partial.hs view
@@ -1,5 +1,6 @@--- | This module exports all the partial functions from "Data.ByteString.Lazy"-+-- | Lazy @ByteString@ partial functions. Import as:+--+-- > import qualified RIO.ByteString.Lazy.Partial as BL' module RIO.ByteString.Lazy.Partial ( -- * Basic interface
src/RIO/ByteString/Partial.hs view
@@ -1,5 +1,6 @@--- | This module exports all the partial functions from 'Data.ByteString'-+-- | Strict @ByteString@ partial functions. Import as:+--+-- > import qualified RIO.ByteString.Partial as B' module RIO.ByteString.Partial ( -- * Basic interface
src/RIO/Char.hs view
@@ -1,6 +1,9 @@ -- | Unicode @Char@. Import as: -- -- > import qualified RIO.Char as C+--+-- This module does not export any partial functions. For those, see+-- "RIO.Char.Partial" module RIO.Char ( Data.Char.Char
src/RIO/Char/Partial.hs view
@@ -1,3 +1,6 @@+-- | Unicode @Char@ partial functions. Import as:+--+-- > import qualified RIO.Char.Partial as C' module RIO.Char.Partial ( -- * Single digit characters
src/RIO/File.hs view
@@ -229,8 +229,8 @@ -- otherwise async exceptions may leave file descriptors open. -- -- @since 0.1.6-openFileAndDirectory :: MonadUnliftIO m => FilePath -> IOMode -> m (Fd, Handle)-openFileAndDirectory absFp iomode = do+openFileAndDirectory :: MonadIO m => FilePath -> IOMode -> m (Fd, Handle)+openFileAndDirectory absFp iomode = liftIO $ do let dir = takeDirectory absFp fp = takeFileName absFp @@ -257,16 +257,16 @@ fsyncFileDescriptor "closeFileDurable/Directory" cDirFd) (closeDirectory dirFd) -buildTemporaryFilePath :: MonadUnliftIO m => FilePath -> m FilePath-buildTemporaryFilePath filePath = do+buildTemporaryFilePath :: MonadIO m => FilePath -> m FilePath+buildTemporaryFilePath filePath = liftIO $ do let dirFp = takeDirectory filePath fileFp = takeFileName filePath- bracket (liftIO $ openBinaryTempFile dirFp fileFp)+ bracket (openBinaryTempFile dirFp fileFp) (hClose . snd) (return . fst) -toTmpFilePath :: MonadUnliftIO m => FilePath -> m FilePath+toTmpFilePath :: MonadIO m => FilePath -> m FilePath toTmpFilePath filePath = buildTemporaryFilePath (dirPath </> tmpFilename) where@@ -296,7 +296,7 @@ -- -- @since 0.1.6 closeFileDurableAtomic ::- MonadUnliftIO m => FilePath -> FilePath -> Fd -> Handle -> m ()+ MonadIO m => FilePath -> FilePath -> Fd -> Handle -> m () closeFileDurableAtomic tmpFilePath filePath dirFd@(Fd cDirFd) fileHandle = do liftIO $ finally@@ -332,11 +332,12 @@ -- This function is a noop on Windows platforms. -- -- @since 0.1.6-ensureFileDurable :: MonadUnliftIO m => FilePath -> m ()+ensureFileDurable :: MonadIO m => FilePath -> m () ensureFileDurable absFp = #if WINDOWS absFp `seq` return () #else+ liftIO $ bracket (openFileAndDirectory absFp ReadMode) (uncurry closeFileDurable) (const $ return ())@@ -352,12 +353,12 @@ -- This function behaves the same as 'RIO.writeFileBinary' on Windows platforms. -- -- @since 0.1.6-writeBinaryFileDurable :: MonadUnliftIO m => FilePath -> ByteString -> m ()+writeBinaryFileDurable :: MonadIO m => FilePath -> ByteString -> m () writeBinaryFileDurable absFp bytes = #if WINDOWS- writeFileBinary absFp bytes+ liftIO $ writeFileBinary absFp bytes #else- withBinaryFileDurable absFp WriteMode (liftIO . (`hPut` bytes))+ liftIO $ withBinaryFileDurable absFp WriteMode (liftIO . (`hPut` bytes)) #endif -- | Similar to 'writeFileBinary', but it also guarantes that changes executed@@ -370,12 +371,12 @@ -- This function behaves the same as 'RIO.writeFileBinary' on Windows platforms. -- -- @since 0.1.6-writeBinaryFileDurableAtomic :: MonadUnliftIO m => FilePath -> ByteString -> m ()+writeBinaryFileDurableAtomic :: MonadIO m => FilePath -> ByteString -> m () writeBinaryFileDurableAtomic fp bytes = #if WINDOWS- writeFileBinary fp bytes+ liftIO $ writeFileBinary fp bytes #else- withBinaryFileDurableAtomic fp WriteMode (liftIO . (`hPut` bytes))+ liftIO $ withBinaryFileDurableAtomic fp WriteMode (liftIO . (`hPut` bytes)) #endif -- | Opens a file with the following guarantees:
src/RIO/HashMap.hs view
@@ -1,6 +1,9 @@ -- | Strict @Map@ with hashed keys. Import as: -- -- > import qualified RIO.HashMap as HM+--+-- This module does not export any partial functions. For those, see+-- "RIO.HashMap.Partial" module RIO.HashMap ( Data.HashMap.Strict.HashMap
src/RIO/HashMap/Partial.hs view
@@ -1,3 +1,6 @@+-- | Strict @HashMap@ partial functions. Import as:+--+-- > import qualified RIO.HashMap.Partial as HM' module RIO.HashMap.Partial ( -- * Basic interface
src/RIO/List.hs view
@@ -1,6 +1,9 @@ -- | @List@. Import as: -- -- > import qualified RIO.List as L+--+-- This module does not export any partial functions. For those, see+-- "RIO.List.Partial" module RIO.List ( -- * Basic functions
src/RIO/List/Partial.hs view
@@ -1,3 +1,6 @@+-- | @List@ partial functions. Import as:+--+-- > import qualified RIO.List.Partial as L' module RIO.List.Partial ( -- * Basic functions
src/RIO/Map.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-}+ -- | Strict @Map@. Import as: -- -- > import qualified RIO.Map as Map+--+-- This module does not export any partial or unchecked functions. For those,+-- see "RIO.Map.Partial" and "RIO.Map.Unchecked" module RIO.Map ( -- * Map type
src/RIO/Map/Partial.hs view
@@ -1,3 +1,6 @@+-- | Strict @Map@ partial functions. Import as:+--+-- > import qualified RIO.Map.Partial as Map' module RIO.Map.Partial ( -- * Operators
src/RIO/Map/Unchecked.hs view
@@ -1,9 +1,11 @@ {-# LANGUAGE CPP #-}--- | This module contains functions from "Data.Map.strict" that have unchecked++-- | This module contains functions from "Data.Map.Strict" that have unchecked -- preconditions on their input. If these preconditions are not satisfied, -- the data structure may end up in an invalid state and other operations--- may misbehave.-+-- may misbehave. Import as:+--+-- > import qualified RIO.Map.Unchecked as Map' module RIO.Map.Unchecked ( -- * Traversal
+ src/RIO/NonEmpty.hs view
@@ -0,0 +1,83 @@+-- | @NonEmpty@ list. Import as:+--+-- > import qualified RIO.NonEmpty as NE+--+-- This module does not export any partial functions. For those, see+-- "RIO.NonEmpty.Partial"+module RIO.NonEmpty+ (+ -- * The type of non-empty streams+ Data.List.NonEmpty.NonEmpty(..)++ -- * Non-empty stream transformations+ , Data.List.NonEmpty.map+ , Data.List.NonEmpty.intersperse+ , Data.List.NonEmpty.scanl+ , Data.List.NonEmpty.scanr+ , Data.List.NonEmpty.scanl1+ , Data.List.NonEmpty.scanr1+ , Data.List.NonEmpty.transpose+ , Data.List.NonEmpty.sortBy+ , Data.List.NonEmpty.sortWith++ -- * Basic functions+ , Data.List.NonEmpty.length+ , Data.List.NonEmpty.head+ , Data.List.NonEmpty.tail+ , Data.List.NonEmpty.last+ , Data.List.NonEmpty.init+ , (Data.List.NonEmpty.<|)+ , Data.List.NonEmpty.cons+ , Data.List.NonEmpty.uncons+ , Data.List.NonEmpty.unfoldr+ , Data.List.NonEmpty.sort+ , Data.List.NonEmpty.reverse+ , Data.List.NonEmpty.inits+ , Data.List.NonEmpty.tails++ -- * Building streams+ , Data.List.NonEmpty.iterate+ , Data.List.NonEmpty.repeat+ , Data.List.NonEmpty.cycle+ , Data.List.NonEmpty.insert+ , Data.List.NonEmpty.some1++ -- * Extracting sublists+ , Data.List.NonEmpty.take+ , Data.List.NonEmpty.drop+ , Data.List.NonEmpty.splitAt+ , Data.List.NonEmpty.takeWhile+ , Data.List.NonEmpty.dropWhile+ , Data.List.NonEmpty.span+ , Data.List.NonEmpty.break+ , Data.List.NonEmpty.filter+ , Data.List.NonEmpty.partition+ , Data.List.NonEmpty.group+ , Data.List.NonEmpty.groupBy+ , Data.List.NonEmpty.groupWith+ , Data.List.NonEmpty.groupAllWith+ , Data.List.NonEmpty.group1+ , Data.List.NonEmpty.groupBy1+ , Data.List.NonEmpty.groupWith1+ , Data.List.NonEmpty.groupAllWith1++ -- * Sublist predicates+ , Data.List.NonEmpty.isPrefixOf++ -- * Set-like operations+ , Data.List.NonEmpty.nub+ , Data.List.NonEmpty.nubBy++ -- * Zipping and unzipping streams+ , Data.List.NonEmpty.zip+ , Data.List.NonEmpty.zipWith+ , Data.List.NonEmpty.unzip++ -- * Converting to and from a list+ , Data.List.NonEmpty.nonEmpty+ , Data.List.NonEmpty.toList+ , Data.List.NonEmpty.xor++ ) where++import qualified Data.List.NonEmpty
+ src/RIO/NonEmpty/Partial.hs view
@@ -0,0 +1,14 @@+-- | @NonEmpty@ list partial functions. Import as:+--+-- > import qualified RIO.NonEmpty.Partial as NE'+module RIO.NonEmpty.Partial+ (+ -- * Indexing streams+ (Data.List.NonEmpty.!!)++ -- * Converting to and from a list+ , Data.List.NonEmpty.fromList++ ) where++import qualified Data.List.NonEmpty
src/RIO/Partial.hs view
@@ -1,5 +1,6 @@--- | Partial functions.+-- | Partial functions. Import as: --+-- > import qualified RIO.Partial as RIO' module RIO.Partial ( Data.Maybe.fromJust , Prelude.read
src/RIO/Prelude.hs view
@@ -58,6 +58,7 @@ , Data.Ord.min , Data.Ord.compare , Data.Ord.comparing+ , Data.Ord.Down(..) -- * @Enum@ -- | Re-exported from "Prelude":@@ -442,4 +443,3 @@ import qualified Control.Monad.Primitive (primitive) import qualified Control.Monad.ST-
src/RIO/Prelude/Display.hs view
@@ -14,7 +14,7 @@ import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Builder as BB import Data.ByteString.Builder (Builder)-import Data.Semigroup (Semigroup)+import Data.Semigroup (Semigroup(..)) import Data.Text (Text) import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TL@@ -30,7 +30,17 @@ -- -- @since 0.1.0.0 newtype Utf8Builder = Utf8Builder { getUtf8Builder :: Builder }- deriving (Semigroup, Monoid)+ deriving (Semigroup)++-- Custom instance is created instead of deriving, otherwise list fusion breaks+-- for `mconcat`.+instance Monoid Utf8Builder where+ mempty = Utf8Builder mempty+ {-# INLINE mempty #-}+ mappend = (Data.Semigroup.<>)+ {-# INLINE mappend #-}+ mconcat = foldr mappend mempty+ {-# INLINE mconcat #-} -- | @since 0.1.0.0 instance IsString Utf8Builder where
src/RIO/Prelude/Logger.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE BangPatterns #-} module RIO.Prelude.Logger ( -- ** Running with logging withLogFunc@@ -60,6 +61,7 @@ import GHC.Stack (HasCallStack, CallStack, SrcLoc (..), getCallStack, callStack) import Data.Time import qualified Data.Text.IO as TIO+import Data.Bits import Data.ByteString.Builder (toLazyByteString, char7, byteString, hPutBuilder) import Data.ByteString.Builder.Extra (flush) import GHC.IO.Handle.Internals (wantWritableHandle)@@ -359,12 +361,12 @@ newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ()) newLogFunc options = if logTerminal options then do- var <- newMVar mempty+ var <- newMVar (mempty,0) return (LogFunc { unLogFunc = stickyImpl var options (simpleLogFunc options) , lfOptions = Just options }- , do state <- takeMVar var+ , do (state,_) <- takeMVar var unless (B.null state) (liftIO $ logSend options "\n") ) else@@ -579,12 +581,12 @@ length (formatTime defaultTimeLocale "%F %T.000000" (UTCTime (ModifiedJulianDay 0) 0)) stickyImpl- :: MVar ByteString -> LogOptions+ :: MVar (ByteString,Int) -> LogOptions -> (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()-stickyImpl ref lo logFunc loc src level msgOrig = modifyMVar_ ref $ \sticky -> do+stickyImpl ref lo logFunc loc src level msgOrig = modifyMVar_ ref $ \(sticky,stickyLen) -> do let backSpaceChar = '\8'- repeating = mconcat . replicate (B.length sticky) . char7+ repeating = mconcat . replicate stickyLen . char7 clear = logSend lo (repeating backSpaceChar <> repeating ' ' <>@@ -596,19 +598,37 @@ LevelOther "sticky-done" -> do clear logFunc loc src LevelInfo msgOrig- return mempty+ return (mempty,0) LevelOther "sticky" -> do clear let bs = toStrictBytes $ toLazyByteString $ getUtf8Builder msgOrig logSend lo (byteString bs <> flush)- return bs+ return (bs, utf8CharacterCount bs) _ | level >= logLevel -> do clear logFunc loc src level msgOrig unless (B.null sticky) $ logSend lo (byteString sticky <> flush)- return sticky- | otherwise -> return sticky+ return (sticky,stickyLen)+ | otherwise -> return (sticky,stickyLen)++-- | The number of Unicode characters in a UTF-8 encoded byte string,+-- excluding ANSI CSI sequences.+utf8CharacterCount :: ByteString -> Int+utf8CharacterCount = go 0+ where+ go !n bs = case B.uncons bs of+ Nothing -> n+ Just (c,bs)+ | c .&. 0xC0 == 0x80 -> go n bs -- UTF-8 continuation+ | c == 0x1B -> go n $ dropCSI bs -- ANSI escape+ | otherwise -> go (n+1) bs++ dropCSI bs = case B.uncons bs of+ Just (0x5B,bs2) -> B.drop 1 $ B.dropWhile isSequenceByte bs2+ _ -> bs++ isSequenceByte c = c >= 0x20 && c <= 0x3F -- | Is the log func configured to use color output? --
src/RIO/Prelude/Types.hs view
@@ -60,6 +60,9 @@ -- *** @Either@ -- | Re-exported from "Data.Either": , Data.Either.Either(..)+ -- *** @NonEmpty@+ -- | Re-exported from Data.List.NonEmpty+ , Data.List.NonEmpty.NonEmpty(..) -- *** @Proxy@ -- | Re-exported from "Data.Proxy": , Data.Proxy.Proxy(..)@@ -325,6 +328,7 @@ import qualified Data.IntMap.Strict import qualified Data.IntSet import qualified Data.List+import qualified Data.List.NonEmpty import qualified Data.Map.Strict import qualified Data.Maybe import qualified Data.Ord
src/RIO/Process.hs view
@@ -57,6 +57,10 @@ -- * Spawning (run child process) , withProcess , withProcess_+ , withProcessWait+ , withProcessWait_+ , withProcessTerm+ , withProcessTerm_ -- * Exec (replacing current process) , exec , execSpawn@@ -135,7 +139,11 @@ import System.Exit (exitWith) import qualified System.FilePath as FP import qualified System.Process.Typed as P-import System.Process.Typed hiding (withProcess, withProcess_, proc)+import System.Process.Typed hiding+ (withProcess, withProcess_,+ withProcessWait, withProcessWait_,+ withProcessTerm, withProcessTerm_,+ proc) #ifndef WINDOWS import System.Directory (setCurrentDirectory)@@ -431,7 +439,8 @@ => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a-withProcess pc f = withRunInIO $ \run -> P.withProcess pc (run . f)+withProcess pc f = withRunInIO $ \run -> P.withProcessTerm pc (run . f)+{-# DEPRECATED withProcess "Please consider using withProcessWait, or instead use withProcessTerm" #-} -- | Same as 'P.withProcess_', but generalized to 'MonadUnliftIO'. --@@ -441,7 +450,48 @@ => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a-withProcess_ pc f = withRunInIO $ \run -> P.withProcess_ pc (run . f)+withProcess_ pc f = withRunInIO $ \run -> P.withProcessTerm_ pc (run . f)+{-# DEPRECATED withProcess_ "Please consider using withProcessWait, or instead use withProcessTerm" #-}++-- | Same as 'P.withProcessWait', but generalized to 'MonadUnliftIO'.+--+-- @since 0.1.10.0+withProcessWait+ :: MonadUnliftIO m+ => ProcessConfig stdin stdout stderr+ -> (Process stdin stdout stderr -> m a)+ -> m a+withProcessWait pc f = withRunInIO $ \run -> P.withProcessWait pc (run . f)++-- | Same as 'P.withProcessWait_', but generalized to 'MonadUnliftIO'.+--+-- @since 0.1.10.0+withProcessWait_+ :: MonadUnliftIO m+ => ProcessConfig stdin stdout stderr+ -> (Process stdin stdout stderr -> m a)+ -> m a+withProcessWait_ pc f = withRunInIO $ \run -> P.withProcessWait_ pc (run . f)++-- | Same as 'P.withProcessTerm', but generalized to 'MonadUnliftIO'.+--+-- @since 0.1.10.0+withProcessTerm+ :: MonadUnliftIO m+ => ProcessConfig stdin stdout stderr+ -> (Process stdin stdout stderr -> m a)+ -> m a+withProcessTerm pc f = withRunInIO $ \run -> P.withProcessTerm pc (run . f)++-- | Same as 'P.withProcessTerm_', but generalized to 'MonadUnliftIO'.+--+-- @since 0.1.10.0+withProcessTerm_+ :: MonadUnliftIO m+ => ProcessConfig stdin stdout stderr+ -> (Process stdin stdout stderr -> m a)+ -> m a+withProcessTerm_ pc f = withRunInIO $ \run -> P.withProcessTerm_ pc (run . f) -- | A convenience environment combining a 'LogFunc' and a 'ProcessContext' --
src/RIO/Set.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-}+ -- | @Set@. Import as: -- -- > import qualified RIO.Set as Set+--+-- This module does not export any partial or unchecked functions. For those,+-- see "RIO.Set.Partial" and "RIO.Set.Unchecked" module RIO.Set ( -- * Set type
src/RIO/Set/Partial.hs view
@@ -1,3 +1,6 @@+-- | @Set@ partial functions. Import as:+--+-- > import qualified RIO.Set.Partial as Set' module RIO.Set.Partial ( -- * Indexed
src/RIO/Set/Unchecked.hs view
@@ -3,7 +3,9 @@ -- | This module contains functions from "Data.Set" that have unchecked -- preconditions on their input. If these preconditions are not satisfied, -- the data structure may end up in an invalid state and other operations--- may misbehave.+-- may misbehave. Import as:+--+-- > import qualified RIO.Set.Unchecked as Set' module RIO.Set.Unchecked ( -- * Map
src/RIO/Text/Lazy/Partial.hs view
@@ -1,5 +1,6 @@--- | This module exports all the partial functions from "Data.Text.Lazy"-+-- | Lazy @Text@ partial functions. Import as:+--+-- > import qualified RIO.Text.Lazy.Partial as TL' module RIO.Text.Lazy.Partial ( -- * Creation and elimination
src/RIO/Text/Partial.hs view
@@ -1,5 +1,6 @@--- | This module exports all the partial functions from "Data.Text"-+-- | Strict @Text@ partial functions. Import as:+--+-- > import qualified RIO.Text.Partial as T' module RIO.Text.Partial ( -- * Basic interface
src/RIO/Vector.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-}+ -- | Generic @Vector@ interface. Import as: -- -- > import qualified RIO.Vector as V+--+-- This module does not export any partial or unsafe functions. For those, see+-- "RIO.Vector.Partial" and "RIO.Vector.Unsafe" module RIO.Vector ( -- * Immutable vectors
src/RIO/Vector/Boxed.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-}+ -- | Boxed @Vector@. Import as: -- -- > import qualified RIO.Vector.Boxed as VB+--+-- This module does not export any partial or unsafe functions. For those, see+-- "RIO.Vector.Boxed.Partial" and "RIO.Vector.Boxed.Unsafe" module RIO.Vector.Boxed ( -- * Boxed vectors
src/RIO/Vector/Boxed/Partial.hs view
@@ -1,3 +1,6 @@+-- | Boxed @Vector@ partial functions. Import as:+--+-- > import qualified RIO.Vector.Boxed.Partial as VB' module RIO.Vector.Boxed.Partial ( -- * Accessors
src/RIO/Vector/Boxed/Unsafe.hs view
@@ -1,3 +1,7 @@+-- | Boxed @Vector@ unsafe functions. These perform no bounds+-- checking, and may cause segmentation faults etc.! Import as:+--+-- > import qualified RIO.Vector.Boxed.Unsafe as VB' module RIO.Vector.Boxed.Unsafe ( -- * Accessors
src/RIO/Vector/Partial.hs view
@@ -1,3 +1,6 @@+-- | Generic @Vector@ interface partial functions. Import as:+--+-- > import qualified RIO.Vector.Partial as V' module RIO.Vector.Partial ( -- * Accessors
src/RIO/Vector/Storable.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-}+ -- | Storable @Vector@. Import as: -- -- > import qualified RIO.Vector.Storable as VS+--+-- This module does not export any partial or unsafe functions. For those, see+-- "RIO.Vector.Storable.Partial" and "RIO.Vector.Storable.Unsafe" module RIO.Vector.Storable ( -- * Storable vectors
src/RIO/Vector/Storable/Partial.hs view
@@ -1,3 +1,6 @@+-- | Storable @Vector@ partial functions. Import as:+--+-- > import qualified RIO.Vector.Storable.Partial as VS' module RIO.Vector.Storable.Partial ( -- * Accessors
src/RIO/Vector/Storable/Unsafe.hs view
@@ -1,3 +1,7 @@+-- | Storable @Vector@ unsafe functions. These perform no bounds+-- checking, and may cause segmentation faults etc.! Import as:+--+-- > import qualified RIO.Vector.Storable.Unsafe as VS' module RIO.Vector.Storable.Unsafe ( -- * Accessors
src/RIO/Vector/Unboxed.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-}+ -- | Unboxed @Vector@. Import as: -- -- > import qualified RIO.Vector.Unboxed as VU+--+-- This module does not export any partial or unsafe functions. For those, see+-- "RIO.Vector.Unboxed.Partial" and "RIO.Vector.Unboxed.Unsafe" module RIO.Vector.Unboxed ( -- * Unboxed vectors
src/RIO/Vector/Unboxed/Partial.hs view
@@ -1,3 +1,6 @@+-- | Unboxed @Vector@ partial functions. Import as:+--+-- > import qualified RIO.Vector.Unboxed.Partial as VU' module RIO.Vector.Unboxed.Partial ( -- * Accessors
src/RIO/Vector/Unboxed/Unsafe.hs view
@@ -1,3 +1,7 @@+-- | Unoxed @Vector@ unsafe functions. These perform no bounds+-- checking, and may cause segmentation faults etc.! Import as:+--+-- > import qualified RIO.Vector.Unoxed.Unsafe as VU' module RIO.Vector.Unboxed.Unsafe ( -- * Accessors
src/RIO/Vector/Unsafe.hs view
@@ -1,3 +1,7 @@+-- | Generic @Vector@ interface unsafe functions. These perform no bounds+-- checking, and may cause segmentation faults etc.! Import as:+--+-- > import qualified RIO.Vector.Unsafe as V' module RIO.Vector.Unsafe ( -- * Immutable vectors
test/RIO/LoggerSpec.hs view
@@ -24,6 +24,20 @@ logStickyDone "XYZ" builder <- readIORef ref toLazyByteString builder `shouldBe` "ABC\b\b\b \b\b\bshould appear\nABC\b\b\b \b\b\bXYZ\n"+ it "stickyUnicode" $ do+ (ref, options) <- logOptionsMemory+ withLogFunc options $ \lf -> runRIO lf $ do+ logSticky "ö"+ logStickyDone "."+ builder <- readIORef ref+ toLazyByteString builder `shouldBe` "\195\182\b \b.\n"+ it "stickyAnsiEscape" $ do+ (ref, options) <- logOptionsMemory+ withLogFunc options $ \lf -> runRIO lf $ do+ logSticky "\ESC[31mABC\ESC[0m"+ logStickyDone "."+ builder <- readIORef ref+ toLazyByteString builder `shouldBe` "\ESC[31mABC\ESC[0m\b\b\b \b\b\b.\n" it "setLogMinLevelIO" $ do (ref, options) <- logOptionsMemory logLevelRef <- newIORef LevelDebug