rio 0.1.8.0 → 0.1.9.0
raw patch · 23 files changed
+1579/−444 lines, 23 filesdep +QuickCheckdep +unliftio-coredep ~basedep ~unliftioPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: QuickCheck, unliftio-core
Dependency ranges changed: base, unliftio
API changes (from Hackage documentation)
- RIO: ($!!) :: NFData a => (a -> b) -> a -> b
- RIO: ($!) :: () => (a -> b) -> a -> b
- RIO: ($) :: () => (a -> b) -> a -> b
- RIO: ($>) :: Functor f => f a -> b -> f b
- RIO: (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
- RIO: (&&) :: Bool -> Bool -> Bool
- RIO: (&) :: () => a -> (a -> b) -> b
- RIO: (*) :: Num a => a -> a -> a
- RIO: (**) :: Floating a => a -> a -> a
- RIO: (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
- RIO: (*>) :: Applicative f => f a -> f b -> f b
- RIO: (+) :: Num a => a -> a -> a
- RIO: (++) :: () => [a] -> [a] -> [a]
- RIO: (-) :: Num a => a -> a -> a
- RIO: (.) :: () => (b -> c) -> (a -> b) -> a -> c
- RIO: (/) :: Fractional a => a -> a -> a
- RIO: (/=) :: Eq a => a -> a -> Bool
- RIO: (<$!>) :: Monad m => (a -> b) -> m a -> m b
- RIO: (<$) :: Functor f => a -> f b -> f a
- RIO: (<$>) :: Functor f => (a -> b) -> f a -> f b
- RIO: (<&>) :: Functor f => f a -> (a -> b) -> f b
- RIO: (<) :: Ord a => a -> a -> Bool
- RIO: (<*) :: Applicative f => f a -> f b -> f a
- RIO: (<*>) :: Applicative f => f (a -> b) -> f a -> f b
- RIO: (<=) :: Ord a => a -> a -> Bool
- RIO: (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- RIO: (<>) :: Semigroup a => a -> a -> a
- RIO: (<|>) :: Alternative f => f a -> f a -> f a
- RIO: (=<<) :: Monad m => (a -> m b) -> m a -> m b
- RIO: (==) :: Eq a => a -> a -> Bool
- RIO: (>) :: Ord a => a -> a -> Bool
- RIO: (>=) :: Ord a => a -> a -> Bool
- RIO: (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- RIO: (>>) :: Monad m => m a -> m b -> m b
- RIO: (>>=) :: Monad m => m a -> (a -> m b) -> m b
- RIO: (>>>) :: Category cat => cat a b -> cat b c -> cat a c
- RIO: (^) :: (Num a, Integral b) => a -> b -> a
- RIO: (^^) :: (Fractional a, Integral b) => a -> b -> a
- RIO: (||) :: Bool -> Bool -> Bool
- RIO: -- | State token type
- RIO: Const :: a -> Const a
- RIO: DecodeError :: String -> Maybe Word8 -> UnicodeException
- RIO: EQ :: Ordering
- RIO: EncodeError :: String -> Maybe Char -> UnicodeException
- RIO: False :: Bool
- RIO: GT :: Ordering
- RIO: Identity :: a -> Identity a
- RIO: Just :: a -> Maybe a
- RIO: LT :: Ordering
- RIO: Left :: a -> Either a b
- RIO: Nothing :: Maybe a
- RIO: Proxy :: Proxy
- RIO: ReaderT :: (r -> m a) -> ReaderT r
- RIO: Right :: b -> Either a b
- RIO: True :: Bool
- RIO: [getConst] :: Const a -> a
- RIO: [runIdentity] :: Identity a -> a
- RIO: [runReaderT] :: ReaderT r -> r -> m a
- RIO: abs :: Num a => a -> a
- RIO: absurd :: () => Void -> a
- RIO: acos :: Floating a => a -> a
- RIO: acosh :: Floating a => a -> a
- RIO: all :: Foldable t => (a -> Bool) -> t a -> Bool
- RIO: and :: Foldable t => t Bool -> Bool
- RIO: any :: Foldable t => (a -> Bool) -> t a -> Bool
- RIO: asIO :: IO a -> IO a
- RIO: asTypeOf :: () => a -> a -> a
- RIO: asin :: Floating a => a -> a
- RIO: asinh :: Floating a => a -> a
- RIO: ask :: MonadReader r m => m r
- RIO: asks :: MonadReader r m => (r -> a) -> m a
- RIO: asum :: (Foldable t, Alternative f) => t (f a) -> f a
- RIO: atan :: Floating a => a -> a
- RIO: atan2 :: RealFloat a => a -> a -> a
- RIO: atanh :: Floating a => a -> a
- RIO: bool :: () => a -> a -> Bool -> a
- RIO: break :: () => (a -> Bool) -> [a] -> ([a], [a])
- RIO: byteSwap16 :: Word16 -> Word16
- RIO: byteSwap32 :: Word32 -> Word32
- RIO: byteSwap64 :: Word64 -> Word64
- RIO: catMaybes :: () => [Maybe a] -> [a]
- RIO: ceiling :: (RealFrac a, Integral b) => a -> b
- RIO: class Applicative f => Alternative (f :: Type -> Type)
- RIO: class Functor f => Applicative (f :: Type -> Type)
- RIO: class Bounded a
- RIO: class Typeable a => Data a
- RIO: class Enum a
- RIO: class Eq a
- RIO: class Fractional a => Floating a
- RIO: class Foldable (t :: Type -> Type)
- RIO: class Num a => Fractional a
- RIO: class Functor (f :: Type -> Type)
- RIO: class Generic a
- RIO: class Hashable a
- RIO: class (Real a, Enum a) => Integral a
- RIO: class IsString a
- RIO: class Applicative m => Monad (m :: Type -> Type)
- RIO: class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)
- RIO: class Monad m => MonadReader r (m :: Type -> Type) | m -> r
- RIO: class Monad m => MonadThrow (m :: Type -> Type)
- RIO: class MonadTrans (t :: Type -> Type -> Type -> Type)
- RIO: class Semigroup a => Monoid a
- RIO: class NFData a
- RIO: class Num a
- RIO: class Eq a => Ord a
- RIO: class Monad m => PrimMonad (m :: Type -> Type) where {
- RIO: class Read a
- RIO: class (Num a, Ord a) => Real a
- RIO: class (RealFrac a, Floating a) => RealFloat a
- RIO: class (Real a, Fractional a) => RealFrac a
- RIO: class Semigroup a
- RIO: class Show a
- RIO: class Storable a
- RIO: class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
- RIO: class (Vector Vector a, MVector MVector a) => Unbox a
- RIO: compare :: Ord a => a -> a -> Ordering
- RIO: comparing :: Ord a => (b -> a) -> b -> b -> Ordering
- RIO: concat :: Foldable t => t [a] -> [a]
- RIO: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- RIO: const :: () => a -> b -> a
- RIO: cos :: Floating a => a -> a
- RIO: cosh :: Floating a => a -> a
- RIO: curry :: () => ((a, b) -> c) -> a -> b -> c
- RIO: data Bool
- RIO: data Builder
- RIO: data ByteString
- RIO: data Char
- RIO: data Double
- RIO: data Either a b
- RIO: data Float
- RIO: data HashMap k v
- RIO: data HashSet a
- RIO: data IO a
- RIO: data Int
- RIO: data Int16
- RIO: data Int32
- RIO: data Int64
- RIO: data Int8
- RIO: data IntMap a
- RIO: data IntSet
- RIO: data Integer
- RIO: data Map k a
- RIO: data Maybe a
- RIO: data Natural
- RIO: data Ordering
- RIO: data Set a
- RIO: data ShortByteString
- RIO: data Text
- RIO: data UnicodeException
- RIO: data Vector a
- RIO: data Void
- RIO: data Word
- RIO: data Word16
- RIO: data Word32
- RIO: data Word64
- RIO: data Word8
- RIO: data Proxy (t :: k) :: forall k. () => k -> Type
- RIO: dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c a)
- RIO: dataCast2 :: (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)
- RIO: dataTypeOf :: Data a => a -> DataType
- RIO: decodeFloat :: RealFloat a => a -> (Integer, Int)
- RIO: decodeUtf8' :: ByteString -> Either UnicodeException Text
- RIO: decodeUtf8Lenient :: ByteString -> Text
- RIO: decodeUtf8With :: OnDecodeError -> ByteString -> Text
- RIO: div :: Integral a => a -> a -> a
- RIO: divMod :: Integral a => a -> a -> (a, a)
- RIO: drop :: () => Int -> [a] -> [a]
- RIO: dropWhile :: () => (a -> Bool) -> [a] -> [a]
- RIO: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
- RIO: elem :: (Foldable t, Eq a) => a -> t a -> Bool
- RIO: encodeFloat :: RealFloat a => Integer -> Int -> a
- RIO: encodeUtf8 :: Text -> ByteString
- RIO: encodeUtf8Builder :: Text -> Builder
- RIO: error :: HasCallStack => [Char] -> a
- RIO: even :: Integral a => a -> Bool
- RIO: exp :: Floating a => a -> a
- RIO: exponent :: RealFloat a => a -> Int
- RIO: fail :: Monad m => String -> m a
- RIO: filter :: () => (a -> Bool) -> [a] -> [a]
- RIO: filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
- RIO: first :: Arrow a => a b c -> a (b, d) (c, d)
- RIO: fix :: () => (a -> a) -> a
- RIO: flip :: () => (a -> b -> c) -> b -> a -> c
- RIO: floatDigits :: RealFloat a => a -> Int
- RIO: floatRadix :: RealFloat a => a -> Integer
- RIO: floatRange :: RealFloat a => a -> (Int, Int)
- RIO: floor :: (RealFrac a, Integral b) => a -> b
- RIO: fmap :: Functor f => (a -> b) -> f a -> f b
- RIO: fold :: (Foldable t, Monoid m) => t m -> m
- RIO: foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- RIO: foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m ()
- RIO: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- RIO: foldMapM :: (Monad m, Monoid w, Foldable t) => (a -> m w) -> t a -> m w
- RIO: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- RIO: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- RIO: for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
- RIO: forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
- RIO: forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- RIO: forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b]
- RIO: forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b]
- RIO: for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- RIO: force :: NFData a => a -> a
- RIO: forever :: Applicative f => f a -> f b
- RIO: fromEnum :: Enum a => a -> Int
- RIO: fromFirst :: a -> First a -> a
- RIO: fromInteger :: Num a => Integer -> a
- RIO: fromIntegral :: (Integral a, Num b) => a -> b
- RIO: fromMaybe :: () => a -> Maybe a -> a
- RIO: fromRational :: Fractional a => Rational -> a
- RIO: fromShort :: ShortByteString -> ByteString
- RIO: fromStrictBytes :: ByteString -> LByteString
- RIO: fromString :: IsString a => String -> a
- RIO: fst :: () => (a, b) -> a
- RIO: gcd :: Integral a => a -> a -> a
- RIO: gfoldl :: Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. () => g -> c g) -> a -> c a
- RIO: gmapM :: (Data a, Monad m) => (forall d. Data d => d -> m d) -> a -> m a
- RIO: gmapMo :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a
- RIO: gmapMp :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a
- RIO: gmapQ :: Data a => (forall d. Data d => d -> u) -> a -> [u]
- RIO: gmapQi :: Data a => Int -> (forall d. Data d => d -> u) -> a -> u
- RIO: gmapQl :: Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
- RIO: gmapQr :: Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
- RIO: gmapT :: Data a => (forall b. Data b => b -> b) -> a -> a
- RIO: guard :: Alternative f => Bool -> f ()
- RIO: gunfold :: Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. () => r -> c r) -> Constr -> c a
- RIO: id :: () => a -> a
- RIO: infix 4 <=
- RIO: infixl 0 `on`
- RIO: infixl 1 <&>
- RIO: infixl 3 <|>
- RIO: infixl 4 <$>
- RIO: infixl 6 -
- RIO: infixl 7 *
- RIO: infixr 0 $!
- RIO: infixr 1 >=>
- RIO: infixr 2 ||
- RIO: infixr 3 &&
- RIO: infixr 5 ++
- RIO: infixr 6 <>
- RIO: infixr 8 ^^
- RIO: infixr 9 .
- RIO: isDenormalized :: RealFloat a => a -> Bool
- RIO: isIEEE :: RealFloat a => a -> Bool
- RIO: isInfinite :: RealFloat a => a -> Bool
- RIO: isJust :: () => Maybe a -> Bool
- RIO: isLeft :: () => Either a b -> Bool
- RIO: isNaN :: RealFloat a => a -> Bool
- RIO: isNegativeZero :: RealFloat a => a -> Bool
- RIO: isNothing :: () => Maybe a -> Bool
- RIO: isRight :: () => Either a b -> Bool
- RIO: join :: Monad m => m (m a) -> m a
- RIO: lcm :: Integral a => a -> a -> a
- RIO: lefts :: () => [Either a b] -> [a]
- RIO: length :: Foldable t => t a -> Int
- RIO: lenientDecode :: OnDecodeError
- RIO: lift :: (MonadTrans t, Monad m) => m a -> t m a
- RIO: liftA :: Applicative f => (a -> b) -> f a -> f b
- RIO: liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
- RIO: liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
- RIO: liftM :: Monad m => (a1 -> r) -> m a1 -> m r
- RIO: liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
- RIO: lines :: String -> [String]
- RIO: listToMaybe :: () => [a] -> Maybe a
- RIO: local :: MonadReader r m => (r -> r) -> m a -> m a
- RIO: log :: Floating a => a -> a
- RIO: logBase :: Floating a => a -> a -> a
- RIO: lookup :: Eq a => a -> [(a, b)] -> Maybe b
- RIO: many :: Alternative f => f a -> f [a]
- RIO: map :: () => (a -> b) -> [a] -> [b]
- RIO: mapLeft :: (a1 -> a2) -> Either a1 b -> Either a2 b
- RIO: mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- RIO: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- RIO: mapMaybe :: () => (a -> Maybe b) -> [a] -> [b]
- RIO: mapMaybeA :: Applicative f => (a -> f (Maybe b)) -> [a] -> f [b]
- RIO: mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]
- RIO: mappend :: Monoid a => a -> a -> a
- RIO: max :: Ord a => a -> a -> a
- RIO: maxBound :: Bounded a => a
- RIO: maybe :: () => b -> (a -> b) -> Maybe a -> b
- RIO: maybeToList :: () => Maybe a -> [a]
- RIO: mconcat :: Monoid a => [a] -> a
- RIO: mempty :: Monoid a => a
- RIO: min :: Ord a => a -> a -> a
- RIO: minBound :: Bounded a => a
- RIO: mod :: Integral a => a -> a -> a
- RIO: mplus :: MonadPlus m => m a -> m a -> m a
- RIO: msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
- RIO: mzero :: MonadPlus m => m a
- RIO: negate :: Num a => a -> a
- RIO: newtype Identity a
- RIO: newtype Const a (b :: k) :: forall k. () => Type -> k -> Type
- RIO: not :: Bool -> Bool
- RIO: notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- RIO: nubOrd :: Ord a => [a] -> [a]
- RIO: null :: Foldable t => t a -> Bool
- RIO: odd :: Integral a => a -> Bool
- RIO: on :: () => (b -> b -> c) -> (a -> b) -> a -> a -> c
- RIO: optional :: Alternative f => f a -> f (Maybe a)
- RIO: or :: Foldable t => t Bool -> Bool
- RIO: otherwise :: Bool
- RIO: partitionEithers :: () => [Either a b] -> ([a], [b])
- RIO: pi :: Floating a => a
- RIO: primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a
- RIO: product :: (Foldable t, Num a) => t a -> a
- RIO: properFraction :: (RealFrac a, Integral b) => a -> (b, a)
- RIO: pure :: Applicative f => a -> f a
- RIO: quot :: Integral a => a -> a -> a
- RIO: quotRem :: Integral a => a -> a -> (a, a)
- RIO: readMaybe :: Read a => String -> Maybe a
- RIO: realToFrac :: (Real a, Fractional b) => a -> b
- RIO: recip :: Fractional a => a -> a
- RIO: rem :: Integral a => a -> a -> a
- RIO: replicate :: () => Int -> a -> [a]
- RIO: replicateM_ :: Applicative m => Int -> m a -> m ()
- RIO: return :: Monad m => a -> m a
- RIO: reverse :: () => [a] -> [a]
- RIO: rights :: () => [Either a b] -> [b]
- RIO: rnf :: NFData a => a -> ()
- RIO: round :: (RealFrac a, Integral b) => a -> b
- RIO: runReader :: () => Reader r a -> r -> a
- RIO: sappend :: Semigroup s => s -> s -> s
- RIO: scaleFloat :: RealFloat a => Int -> a -> a
- RIO: sconcat :: Semigroup a => NonEmpty a -> a
- RIO: second :: Arrow a => a b c -> a (d, b) (d, c)
- RIO: seq :: () => a -> b -> b
- RIO: sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
- RIO: sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
- RIO: sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
- RIO: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- RIO: show :: Show a => a -> String
- RIO: significand :: RealFloat a => a -> a
- RIO: signum :: Num a => a -> a
- RIO: sin :: Floating a => a -> a
- RIO: sinh :: Floating a => a -> a
- RIO: snd :: () => (a, b) -> b
- RIO: some :: Alternative f => f a -> f [a]
- RIO: span :: () => (a -> Bool) -> [a] -> ([a], [a])
- RIO: sqrt :: Floating a => a -> a
- RIO: stimes :: (Semigroup a, Integral b) => b -> a -> a
- RIO: subtract :: Num a => a -> a -> a
- RIO: sum :: (Foldable t, Num a) => t a -> a
- RIO: take :: () => Int -> [a] -> [a]
- RIO: takeWhile :: () => (a -> Bool) -> [a] -> [a]
- RIO: tan :: Floating a => a -> a
- RIO: tanh :: Floating a => a -> a
- RIO: toConstr :: Data a => a -> Constr
- RIO: toInteger :: Integral a => a -> Integer
- RIO: toList :: Foldable t => t a -> [a]
- RIO: toRational :: Real a => a -> Rational
- RIO: toShort :: ByteString -> ShortByteString
- RIO: toStrictBytes :: LByteString -> ByteString
- RIO: traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
- RIO: traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- RIO: truncate :: (RealFrac a, Integral b) => a -> b
- RIO: tshow :: Show a => a -> Text
- RIO: type FilePath = String
- RIO: type GVector = Vector
- RIO: type HasCallStack = ?callStack :: CallStack
- RIO: type LByteString = ByteString
- RIO: type LText = Text
- RIO: type Rational = Ratio Integer
- RIO: type Reader r = ReaderT r Identity
- RIO: type SVector = Vector
- RIO: type String = [Char]
- RIO: type UVector = Vector
- RIO: type family PrimState (m :: Type -> Type) :: Type;
- RIO: uncurry :: () => (a -> b -> c) -> (a, b) -> c
- RIO: undefined :: HasCallStack => a
- RIO: unless :: Applicative f => Bool -> f () -> f ()
- RIO: unlessM :: Monad m => m Bool -> m () -> m ()
- RIO: unlines :: [String] -> String
- RIO: unwords :: [String] -> String
- RIO: void :: Functor f => f a -> f ()
- RIO: when :: Applicative f => Bool -> f () -> f ()
- RIO: whenM :: Monad m => m Bool -> m () -> m ()
- RIO: words :: String -> [String]
- RIO: zip :: () => [a] -> [b] -> [(a, b)]
- RIO: zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]
- RIO: zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m ()
- RIO: }
+ RIO: exitFailure :: MonadIO m => m a
+ RIO: exitSuccess :: MonadIO m => m a
+ RIO: exitWith :: MonadIO m => ExitCode -> m a
+ RIO.Deque: asBDeque :: BDeque s a -> BDeque s a
+ RIO.Deque: asSDeque :: SDeque s a -> SDeque s a
+ RIO.Deque: asUDeque :: UDeque s a -> UDeque s a
+ RIO.Deque: data Deque v s a
+ RIO.Deque: dequeToList :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m [a]
+ RIO.Deque: dequeToVector :: (Vector v' a, MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (v' a)
+ RIO.Deque: foldlDeque :: (MVector v a, PrimMonad m) => (acc -> a -> m acc) -> acc -> Deque v (PrimState m) a -> m acc
+ RIO.Deque: foldrDeque :: (MVector v a, PrimMonad m) => (a -> acc -> m acc) -> acc -> Deque v (PrimState m) a -> m acc
+ RIO.Deque: freezeDeque :: (Vector v a, PrimMonad m) => Deque (Mutable v) (PrimState m) a -> m (v a)
+ RIO.Deque: getDequeSize :: PrimMonad m => Deque v (PrimState m) a -> m Int
+ RIO.Deque: newDeque :: (MVector v a, PrimMonad m) => m (Deque v (PrimState m) a)
+ RIO.Deque: popBackDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a)
+ RIO.Deque: popFrontDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a)
+ RIO.Deque: pushBackDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m ()
+ RIO.Deque: pushFrontDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m ()
+ RIO.Deque: type BDeque = Deque MVector
+ RIO.Deque: type SDeque = Deque MVector
+ RIO.Deque: type UDeque = Deque MVector
+ RIO.Map: toAscList :: () => Map k a -> [(k, a)]
+ RIO.Map: toDescList :: () => Map k a -> [(k, a)]
+ RIO.Partial: pred :: Enum a => a -> a
+ RIO.Partial: succ :: Enum a => a -> a
+ RIO.Prelude: ($!!) :: NFData a => (a -> b) -> a -> b
+ RIO.Prelude: ($!) :: () => (a -> b) -> a -> b
+ RIO.Prelude: ($) :: () => (a -> b) -> a -> b
+ RIO.Prelude: ($>) :: Functor f => f a -> b -> f b
+ RIO.Prelude: (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
+ RIO.Prelude: (&&) :: Bool -> Bool -> Bool
+ RIO.Prelude: (&) :: () => a -> (a -> b) -> b
+ RIO.Prelude: (*) :: Num a => a -> a -> a
+ RIO.Prelude: (**) :: Floating a => a -> a -> a
+ RIO.Prelude: (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
+ RIO.Prelude: (*>) :: Applicative f => f a -> f b -> f b
+ RIO.Prelude: (+) :: Num a => a -> a -> a
+ RIO.Prelude: (++) :: () => [a] -> [a] -> [a]
+ RIO.Prelude: (-) :: Num a => a -> a -> a
+ RIO.Prelude: (.) :: () => (b -> c) -> (a -> b) -> a -> c
+ RIO.Prelude: (/) :: Fractional a => a -> a -> a
+ RIO.Prelude: (/=) :: Eq a => a -> a -> Bool
+ RIO.Prelude: (<$!>) :: Monad m => (a -> b) -> m a -> m b
+ RIO.Prelude: (<$) :: Functor f => a -> f b -> f a
+ RIO.Prelude: (<$>) :: Functor f => (a -> b) -> f a -> f b
+ RIO.Prelude: (<&>) :: Functor f => f a -> (a -> b) -> f b
+ RIO.Prelude: (<) :: Ord a => a -> a -> Bool
+ RIO.Prelude: (<*) :: Applicative f => f a -> f b -> f a
+ RIO.Prelude: (<*>) :: Applicative f => f (a -> b) -> f a -> f b
+ RIO.Prelude: (<=) :: Ord a => a -> a -> Bool
+ RIO.Prelude: (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
+ RIO.Prelude: (<>) :: Semigroup a => a -> a -> a
+ RIO.Prelude: (<|>) :: Alternative f => f a -> f a -> f a
+ RIO.Prelude: (=<<) :: Monad m => (a -> m b) -> m a -> m b
+ RIO.Prelude: (==) :: Eq a => a -> a -> Bool
+ RIO.Prelude: (>) :: Ord a => a -> a -> Bool
+ RIO.Prelude: (>=) :: Ord a => a -> a -> Bool
+ RIO.Prelude: (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
+ RIO.Prelude: (>>) :: Monad m => m a -> m b -> m b
+ RIO.Prelude: (>>=) :: Monad m => m a -> (a -> m b) -> m b
+ RIO.Prelude: (>>>) :: Category cat => cat a b -> cat b c -> cat a c
+ RIO.Prelude: (^) :: (Num a, Integral b) => a -> b -> a
+ RIO.Prelude: (^^) :: (Fractional a, Integral b) => a -> b -> a
+ RIO.Prelude: (||) :: Bool -> Bool -> Bool
+ RIO.Prelude: abs :: Num a => a -> a
+ RIO.Prelude: absurd :: () => Void -> a
+ RIO.Prelude: acos :: Floating a => a -> a
+ RIO.Prelude: acosh :: Floating a => a -> a
+ RIO.Prelude: all :: Foldable t => (a -> Bool) -> t a -> Bool
+ RIO.Prelude: and :: Foldable t => t Bool -> Bool
+ RIO.Prelude: any :: Foldable t => (a -> Bool) -> t a -> Bool
+ RIO.Prelude: asIO :: IO a -> IO a
+ RIO.Prelude: asTypeOf :: () => a -> a -> a
+ RIO.Prelude: asin :: Floating a => a -> a
+ RIO.Prelude: asinh :: Floating a => a -> a
+ RIO.Prelude: ask :: MonadReader r m => m r
+ RIO.Prelude: asks :: MonadReader r m => (r -> a) -> m a
+ RIO.Prelude: asum :: (Foldable t, Alternative f) => t (f a) -> f a
+ RIO.Prelude: atan :: Floating a => a -> a
+ RIO.Prelude: atan2 :: RealFloat a => a -> a -> a
+ RIO.Prelude: atanh :: Floating a => a -> a
+ RIO.Prelude: bool :: () => a -> a -> Bool -> a
+ RIO.Prelude: break :: () => (a -> Bool) -> [a] -> ([a], [a])
+ RIO.Prelude: byteSwap16 :: Word16 -> Word16
+ RIO.Prelude: byteSwap32 :: Word32 -> Word32
+ RIO.Prelude: byteSwap64 :: Word64 -> Word64
+ RIO.Prelude: catMaybes :: () => [Maybe a] -> [a]
+ RIO.Prelude: ceiling :: (RealFrac a, Integral b) => a -> b
+ RIO.Prelude: compare :: Ord a => a -> a -> Ordering
+ RIO.Prelude: comparing :: Ord a => (b -> a) -> b -> b -> Ordering
+ RIO.Prelude: concat :: Foldable t => t [a] -> [a]
+ RIO.Prelude: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
+ RIO.Prelude: const :: () => a -> b -> a
+ RIO.Prelude: cos :: Floating a => a -> a
+ RIO.Prelude: cosh :: Floating a => a -> a
+ RIO.Prelude: curry :: () => ((a, b) -> c) -> a -> b -> c
+ RIO.Prelude: decodeFloat :: RealFloat a => a -> (Integer, Int)
+ RIO.Prelude: decodeUtf8' :: ByteString -> Either UnicodeException Text
+ RIO.Prelude: decodeUtf8Lenient :: ByteString -> Text
+ RIO.Prelude: decodeUtf8With :: OnDecodeError -> ByteString -> Text
+ RIO.Prelude: deepseq :: NFData a => a -> b -> b
+ RIO.Prelude: div :: Integral a => a -> a -> a
+ RIO.Prelude: divMod :: Integral a => a -> a -> (a, a)
+ RIO.Prelude: drop :: () => Int -> [a] -> [a]
+ RIO.Prelude: dropWhile :: () => (a -> Bool) -> [a] -> [a]
+ RIO.Prelude: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
+ RIO.Prelude: elem :: (Foldable t, Eq a) => a -> t a -> Bool
+ RIO.Prelude: empty :: Alternative f => f a
+ RIO.Prelude: encodeFloat :: RealFloat a => Integer -> Int -> a
+ RIO.Prelude: encodeUtf8 :: Text -> ByteString
+ RIO.Prelude: encodeUtf8Builder :: Text -> Builder
+ RIO.Prelude: error :: HasCallStack => [Char] -> a
+ RIO.Prelude: even :: Integral a => a -> Bool
+ RIO.Prelude: exp :: Floating a => a -> a
+ RIO.Prelude: exponent :: RealFloat a => a -> Int
+ RIO.Prelude: fail :: MonadFail m => String -> m a
+ RIO.Prelude: filter :: () => (a -> Bool) -> [a] -> [a]
+ RIO.Prelude: filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
+ RIO.Prelude: first :: Arrow a => a b c -> a (b, d) (c, d)
+ RIO.Prelude: fix :: () => (a -> a) -> a
+ RIO.Prelude: flip :: () => (a -> b -> c) -> b -> a -> c
+ RIO.Prelude: floatDigits :: RealFloat a => a -> Int
+ RIO.Prelude: floatRadix :: RealFloat a => a -> Integer
+ RIO.Prelude: floatRange :: RealFloat a => a -> (Int, Int)
+ RIO.Prelude: floor :: (RealFrac a, Integral b) => a -> b
+ RIO.Prelude: fmap :: Functor f => (a -> b) -> f a -> f b
+ RIO.Prelude: fold :: (Foldable t, Monoid m) => t m -> m
+ RIO.Prelude: foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
+ RIO.Prelude: foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m ()
+ RIO.Prelude: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
+ RIO.Prelude: foldMapM :: (Monad m, Monoid w, Foldable t) => (a -> m w) -> t a -> m w
+ RIO.Prelude: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
+ RIO.Prelude: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ RIO.Prelude: for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
+ RIO.Prelude: forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
+ RIO.Prelude: forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
+ RIO.Prelude: forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b]
+ RIO.Prelude: forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b]
+ RIO.Prelude: for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
+ RIO.Prelude: force :: NFData a => a -> a
+ RIO.Prelude: forever :: Applicative f => f a -> f b
+ RIO.Prelude: fromEnum :: Enum a => a -> Int
+ RIO.Prelude: fromFirst :: a -> First a -> a
+ RIO.Prelude: fromInteger :: Num a => Integer -> a
+ RIO.Prelude: fromIntegral :: (Integral a, Num b) => a -> b
+ RIO.Prelude: fromMaybe :: () => a -> Maybe a -> a
+ RIO.Prelude: fromRational :: Fractional a => Rational -> a
+ RIO.Prelude: fromShort :: ShortByteString -> ByteString
+ RIO.Prelude: fromStrictBytes :: ByteString -> LByteString
+ RIO.Prelude: fromString :: IsString a => String -> a
+ RIO.Prelude: fst :: () => (a, b) -> a
+ RIO.Prelude: gcd :: Integral a => a -> a -> a
+ RIO.Prelude: guard :: Alternative f => Bool -> f ()
+ RIO.Prelude: id :: () => a -> a
+ RIO.Prelude: infix 4 `notElem`
+ RIO.Prelude: infixl 0 `on`
+ RIO.Prelude: infixl 1 &
+ RIO.Prelude: infixl 3 <|>
+ RIO.Prelude: infixl 4 <$!>
+ RIO.Prelude: infixl 6 -
+ RIO.Prelude: infixl 7 /
+ RIO.Prelude: infixr 0 $!!
+ RIO.Prelude: infixr 1 >>>
+ RIO.Prelude: infixr 2 ||
+ RIO.Prelude: infixr 3 ***
+ RIO.Prelude: infixr 5 ++
+ RIO.Prelude: infixr 6 <>
+ RIO.Prelude: infixr 8 **
+ RIO.Prelude: infixr 9 .
+ RIO.Prelude: isDenormalized :: RealFloat a => a -> Bool
+ RIO.Prelude: isIEEE :: RealFloat a => a -> Bool
+ RIO.Prelude: isInfinite :: RealFloat a => a -> Bool
+ RIO.Prelude: isJust :: () => Maybe a -> Bool
+ RIO.Prelude: isLeft :: () => Either a b -> Bool
+ RIO.Prelude: isNaN :: RealFloat a => a -> Bool
+ RIO.Prelude: isNegativeZero :: RealFloat a => a -> Bool
+ RIO.Prelude: isNothing :: () => Maybe a -> Bool
+ RIO.Prelude: isRight :: () => Either a b -> Bool
+ RIO.Prelude: join :: Monad m => m (m a) -> m a
+ RIO.Prelude: lcm :: Integral a => a -> a -> a
+ RIO.Prelude: lefts :: () => [Either a b] -> [a]
+ RIO.Prelude: length :: Foldable t => t a -> Int
+ RIO.Prelude: lenientDecode :: OnDecodeError
+ RIO.Prelude: lift :: (MonadTrans t, Monad m) => m a -> t m a
+ RIO.Prelude: liftA :: Applicative f => (a -> b) -> f a -> f b
+ RIO.Prelude: liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
+ RIO.Prelude: liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
+ RIO.Prelude: liftM :: Monad m => (a1 -> r) -> m a1 -> m r
+ RIO.Prelude: liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
+ RIO.Prelude: lines :: String -> [String]
+ RIO.Prelude: listToMaybe :: () => [a] -> Maybe a
+ RIO.Prelude: local :: MonadReader r m => (r -> r) -> m a -> m a
+ RIO.Prelude: log :: Floating a => a -> a
+ RIO.Prelude: logBase :: Floating a => a -> a -> a
+ RIO.Prelude: lookup :: Eq a => a -> [(a, b)] -> Maybe b
+ RIO.Prelude: many :: Alternative f => f a -> f [a]
+ RIO.Prelude: map :: () => (a -> b) -> [a] -> [b]
+ RIO.Prelude: mapLeft :: (a1 -> a2) -> Either a1 b -> Either a2 b
+ RIO.Prelude: mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
+ RIO.Prelude: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
+ RIO.Prelude: mapMaybe :: () => (a -> Maybe b) -> [a] -> [b]
+ RIO.Prelude: mapMaybeA :: Applicative f => (a -> f (Maybe b)) -> [a] -> f [b]
+ RIO.Prelude: mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]
+ RIO.Prelude: mappend :: Monoid a => a -> a -> a
+ RIO.Prelude: max :: Ord a => a -> a -> a
+ RIO.Prelude: maxBound :: Bounded a => a
+ RIO.Prelude: maybe :: () => b -> (a -> b) -> Maybe a -> b
+ RIO.Prelude: maybeToList :: () => Maybe a -> [a]
+ RIO.Prelude: mconcat :: Monoid a => [a] -> a
+ RIO.Prelude: mempty :: Monoid a => a
+ RIO.Prelude: mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a
+ RIO.Prelude: min :: Ord a => a -> a -> a
+ RIO.Prelude: minBound :: Bounded a => a
+ RIO.Prelude: mod :: Integral a => a -> a -> a
+ RIO.Prelude: mplus :: MonadPlus m => m a -> m a -> m a
+ RIO.Prelude: msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
+ RIO.Prelude: mzero :: MonadPlus m => m a
+ RIO.Prelude: negate :: Num a => a -> a
+ RIO.Prelude: not :: Bool -> Bool
+ RIO.Prelude: notElem :: (Foldable t, Eq a) => a -> t a -> Bool
+ RIO.Prelude: nubOrd :: Ord a => [a] -> [a]
+ RIO.Prelude: null :: Foldable t => t a -> Bool
+ RIO.Prelude: odd :: Integral a => a -> Bool
+ RIO.Prelude: on :: () => (b -> b -> c) -> (a -> b) -> a -> a -> c
+ RIO.Prelude: optional :: Alternative f => f a -> f (Maybe a)
+ RIO.Prelude: or :: Foldable t => t Bool -> Bool
+ RIO.Prelude: otherwise :: Bool
+ RIO.Prelude: partitionEithers :: () => [Either a b] -> ([a], [b])
+ RIO.Prelude: pi :: Floating a => a
+ RIO.Prelude: primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a
+ RIO.Prelude: product :: (Foldable t, Num a) => t a -> a
+ RIO.Prelude: properFraction :: (RealFrac a, Integral b) => a -> (b, a)
+ RIO.Prelude: pure :: Applicative f => a -> f a
+ RIO.Prelude: quot :: Integral a => a -> a -> a
+ RIO.Prelude: quotRem :: Integral a => a -> a -> (a, a)
+ RIO.Prelude: readMaybe :: Read a => String -> Maybe a
+ RIO.Prelude: realToFrac :: (Real a, Fractional b) => a -> b
+ RIO.Prelude: recip :: Fractional a => a -> a
+ RIO.Prelude: rem :: Integral a => a -> a -> a
+ RIO.Prelude: replicate :: () => Int -> a -> [a]
+ RIO.Prelude: replicateM_ :: Applicative m => Int -> m a -> m ()
+ RIO.Prelude: return :: Monad m => a -> m a
+ RIO.Prelude: reverse :: () => [a] -> [a]
+ RIO.Prelude: rights :: () => [Either a b] -> [b]
+ RIO.Prelude: rnf :: NFData a => a -> ()
+ RIO.Prelude: round :: (RealFrac a, Integral b) => a -> b
+ RIO.Prelude: runReader :: () => Reader r a -> r -> a
+ RIO.Prelude: runReaderT :: ReaderT r m a -> r -> m a
+ RIO.Prelude: runST :: () => (forall s. () => ST s a) -> a
+ RIO.Prelude: sappend :: Semigroup s => s -> s -> s
+ RIO.Prelude: scaleFloat :: RealFloat a => Int -> a -> a
+ RIO.Prelude: second :: Arrow a => a b c -> a (d, b) (d, c)
+ RIO.Prelude: seq :: () => a -> b -> b
+ RIO.Prelude: sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
+ RIO.Prelude: sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
+ RIO.Prelude: sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
+ RIO.Prelude: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
+ RIO.Prelude: show :: Show a => a -> String
+ RIO.Prelude: significand :: RealFloat a => a -> a
+ RIO.Prelude: signum :: Num a => a -> a
+ RIO.Prelude: sin :: Floating a => a -> a
+ RIO.Prelude: sinh :: Floating a => a -> a
+ RIO.Prelude: snd :: () => (a, b) -> b
+ RIO.Prelude: some :: Alternative f => f a -> f [a]
+ RIO.Prelude: span :: () => (a -> Bool) -> [a] -> ([a], [a])
+ RIO.Prelude: sqrt :: Floating a => a -> a
+ RIO.Prelude: subtract :: Num a => a -> a -> a
+ RIO.Prelude: sum :: (Foldable t, Num a) => t a -> a
+ RIO.Prelude: take :: () => Int -> [a] -> [a]
+ RIO.Prelude: takeWhile :: () => (a -> Bool) -> [a] -> [a]
+ RIO.Prelude: tan :: Floating a => a -> a
+ RIO.Prelude: tanh :: Floating a => a -> a
+ RIO.Prelude: toInteger :: Integral a => a -> Integer
+ RIO.Prelude: toList :: Foldable t => t a -> [a]
+ RIO.Prelude: toRational :: Real a => a -> Rational
+ RIO.Prelude: toShort :: ByteString -> ShortByteString
+ RIO.Prelude: toStrictBytes :: LByteString -> ByteString
+ RIO.Prelude: traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
+ RIO.Prelude: traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
+ RIO.Prelude: truncate :: (RealFrac a, Integral b) => a -> b
+ RIO.Prelude: tshow :: Show a => a -> Text
+ RIO.Prelude: uncurry :: () => (a -> b -> c) -> (a, b) -> c
+ RIO.Prelude: undefined :: HasCallStack => a
+ RIO.Prelude: unless :: Applicative f => Bool -> f () -> f ()
+ RIO.Prelude: unlessM :: Monad m => m Bool -> m () -> m ()
+ RIO.Prelude: unlines :: [String] -> String
+ RIO.Prelude: unwords :: [String] -> String
+ RIO.Prelude: void :: Functor f => f a -> f ()
+ RIO.Prelude: when :: Applicative f => Bool -> f () -> f ()
+ RIO.Prelude: whenM :: Monad m => m Bool -> m () -> m ()
+ RIO.Prelude: words :: String -> [String]
+ RIO.Prelude: zip :: () => [a] -> [b] -> [(a, b)]
+ RIO.Prelude: zipWith :: () => (a -> b -> c) -> [a] -> [b] -> [c]
+ RIO.Prelude: zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]
+ RIO.Prelude: zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m ()
+ RIO.Prelude.Types: -- | State token type
+ RIO.Prelude.Types: Const :: a -> Const a
+ RIO.Prelude.Types: DecodeError :: String -> Maybe Word8 -> UnicodeException
+ RIO.Prelude.Types: EQ :: Ordering
+ RIO.Prelude.Types: EncodeError :: String -> Maybe Char -> UnicodeException
+ RIO.Prelude.Types: False :: Bool
+ RIO.Prelude.Types: GT :: Ordering
+ RIO.Prelude.Types: Identity :: a -> Identity a
+ RIO.Prelude.Types: Just :: a -> Maybe a
+ RIO.Prelude.Types: LT :: Ordering
+ RIO.Prelude.Types: Left :: a -> Either a b
+ RIO.Prelude.Types: Nothing :: Maybe a
+ RIO.Prelude.Types: Proxy :: Proxy
+ RIO.Prelude.Types: ReaderT :: (r -> m a) -> ReaderT r
+ RIO.Prelude.Types: Right :: b -> Either a b
+ RIO.Prelude.Types: True :: Bool
+ RIO.Prelude.Types: [getConst] :: Const a -> a
+ RIO.Prelude.Types: [runIdentity] :: Identity a -> a
+ RIO.Prelude.Types: class Applicative f => Alternative (f :: Type -> Type)
+ RIO.Prelude.Types: class Functor f => Applicative (f :: Type -> Type)
+ RIO.Prelude.Types: class Category a => Arrow (a :: Type -> Type -> Type)
+ RIO.Prelude.Types: class Bounded a
+ RIO.Prelude.Types: class Category (cat :: k -> k -> Type)
+ RIO.Prelude.Types: class Typeable a => Data a
+ RIO.Prelude.Types: class Enum a
+ RIO.Prelude.Types: class Eq a
+ RIO.Prelude.Types: class (Typeable e, Show e) => Exception e
+ RIO.Prelude.Types: class Fractional a => Floating a
+ RIO.Prelude.Types: class Foldable (t :: Type -> Type)
+ RIO.Prelude.Types: class Num a => Fractional a
+ RIO.Prelude.Types: class Functor (f :: Type -> Type)
+ RIO.Prelude.Types: class Generic a
+ RIO.Prelude.Types: class Hashable a
+ RIO.Prelude.Types: class (Real a, Enum a) => Integral a
+ RIO.Prelude.Types: class IsString a
+ RIO.Prelude.Types: class Applicative m => Monad (m :: Type -> Type)
+ RIO.Prelude.Types: class Monad m => MonadFail (m :: Type -> Type)
+ RIO.Prelude.Types: class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)
+ RIO.Prelude.Types: class Monad m => MonadReader r (m :: Type -> Type) | m -> r
+ RIO.Prelude.Types: class Monad m => MonadThrow (m :: Type -> Type)
+ RIO.Prelude.Types: class MonadTrans (t :: Type -> Type -> Type -> Type)
+ RIO.Prelude.Types: class Semigroup a => Monoid a
+ RIO.Prelude.Types: class NFData a
+ RIO.Prelude.Types: class Num a
+ RIO.Prelude.Types: class Eq a => Ord a
+ RIO.Prelude.Types: class Monad m => PrimMonad (m :: Type -> Type) where {
+ RIO.Prelude.Types: class Read a
+ RIO.Prelude.Types: class (Num a, Ord a) => Real a
+ RIO.Prelude.Types: class (RealFrac a, Floating a) => RealFloat a
+ RIO.Prelude.Types: class (Real a, Fractional a) => RealFrac a
+ RIO.Prelude.Types: class Semigroup a
+ RIO.Prelude.Types: class Show a
+ RIO.Prelude.Types: class Storable a
+ RIO.Prelude.Types: class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
+ RIO.Prelude.Types: class Typeable (a :: k)
+ RIO.Prelude.Types: class (Vector Vector a, MVector MVector a) => Unbox a
+ RIO.Prelude.Types: data Bool
+ RIO.Prelude.Types: data Builder
+ RIO.Prelude.Types: data ByteString
+ RIO.Prelude.Types: data Char
+ RIO.Prelude.Types: data Double
+ RIO.Prelude.Types: data Either a b
+ RIO.Prelude.Types: data Float
+ RIO.Prelude.Types: data HashMap k v
+ RIO.Prelude.Types: data HashSet a
+ RIO.Prelude.Types: data IO a
+ RIO.Prelude.Types: data Int
+ RIO.Prelude.Types: data Int16
+ RIO.Prelude.Types: data Int32
+ RIO.Prelude.Types: data Int64
+ RIO.Prelude.Types: data Int8
+ RIO.Prelude.Types: data IntMap a
+ RIO.Prelude.Types: data IntSet
+ RIO.Prelude.Types: data Integer
+ RIO.Prelude.Types: data Map k a
+ RIO.Prelude.Types: data Maybe a
+ RIO.Prelude.Types: data Natural
+ RIO.Prelude.Types: data Ordering
+ RIO.Prelude.Types: data ST s a
+ RIO.Prelude.Types: data Seq a
+ RIO.Prelude.Types: data Set a
+ RIO.Prelude.Types: data ShortByteString
+ RIO.Prelude.Types: data Text
+ RIO.Prelude.Types: data UnicodeException
+ RIO.Prelude.Types: data Vector a
+ RIO.Prelude.Types: data Void
+ RIO.Prelude.Types: data Word
+ RIO.Prelude.Types: data Word16
+ RIO.Prelude.Types: data Word32
+ RIO.Prelude.Types: data Word64
+ RIO.Prelude.Types: data Word8
+ RIO.Prelude.Types: data Proxy (t :: k) :: forall k. () => k -> Type
+ RIO.Prelude.Types: newtype Identity a
+ RIO.Prelude.Types: newtype ReaderT r (m :: k -> Type) (a :: k) :: forall k. () => Type -> k -> Type -> k -> Type
+ RIO.Prelude.Types: type FilePath = String
+ RIO.Prelude.Types: type GVector = Vector
+ RIO.Prelude.Types: type HasCallStack = ?callStack :: CallStack
+ RIO.Prelude.Types: type LByteString = ByteString
+ RIO.Prelude.Types: type LText = Text
+ RIO.Prelude.Types: type Rational = Ratio Integer
+ RIO.Prelude.Types: type Reader r = ReaderT r Identity
+ RIO.Prelude.Types: type SVector = Vector
+ RIO.Prelude.Types: type String = [Char]
+ RIO.Prelude.Types: type UVector = Vector
+ RIO.Prelude.Types: type family PrimState (m :: Type -> Type) :: Type;
+ RIO.Prelude.Types: }
+ RIO.Seq: pattern (:|>) :: forall a. () => () => Seq a -> a -> Seq a
+ RIO.Seq: pattern (:<|) :: forall a. () => () => a -> Seq a -> Seq a
+ RIO.State: StateT :: (s -> m (a, s)) -> StateT s a
+ RIO.State: [runStateT] :: StateT s a -> s -> m (a, s)
+ RIO.State: evalState :: () => State s a -> s -> a
+ RIO.State: evalStateT :: Monad m => StateT s m a -> s -> m a
+ RIO.State: execState :: () => State s a -> s -> s
+ RIO.State: execStateT :: Monad m => StateT s m a -> s -> m s
+ RIO.State: mapState :: () => ((a, s) -> (b, s)) -> State s a -> State s b
+ RIO.State: mapStateT :: () => (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
+ RIO.State: newtype StateT s (m :: Type -> Type) a
+ RIO.State: runState :: () => State s a -> s -> (a, s)
+ RIO.State: type State s = StateT s Identity
+ RIO.State: withState :: () => (s -> s) -> State s a -> State s a
+ RIO.State: withStateT :: () => (s -> s) -> StateT s m a -> StateT s m a
+ RIO.Writer: WriterT :: m (a, w) -> WriterT w a
+ RIO.Writer: [runWriterT] :: WriterT w a -> m (a, w)
+ RIO.Writer: censor :: MonadWriter w m => (w -> w) -> m a -> m a
+ RIO.Writer: execWriter :: () => Writer w a -> w
+ RIO.Writer: execWriterT :: Monad m => WriterT w m a -> m w
+ RIO.Writer: listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b)
+ RIO.Writer: mapWriter :: () => ((a, w) -> (b, w')) -> Writer w a -> Writer w' b
+ RIO.Writer: mapWriterT :: () => (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b
+ RIO.Writer: newtype WriterT w (m :: Type -> Type) a
+ RIO.Writer: runWriter :: () => Writer w a -> (a, w)
+ RIO.Writer: type Writer w = WriterT w Identity
- RIO.Process: readProcessStderr :: MonadIO m => ProcessConfig stdin stderrIgnored stderr -> m (ExitCode, ByteString)
+ RIO.Process: readProcessStderr :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m (ExitCode, ByteString)
- RIO.Process: readProcessStderr_ :: MonadIO m => ProcessConfig stdin stderrIgnored stderr -> m ByteString
+ RIO.Process: readProcessStderr_ :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m ByteString
Files
- ChangeLog.md +17/−0
- README.md +35/−48
- rio.cabal +14/−6
- src/RIO.hs +100/−13
- src/RIO/Deque.hs +340/−0
- src/RIO/Map.hs +6/−0
- src/RIO/Map/Unchecked.hs +2/−2
- src/RIO/Partial.hs +2/−0
- src/RIO/Prelude.hs +450/−0
- src/RIO/Prelude/Exit.hs +31/−0
- src/RIO/Prelude/Extra.hs +16/−7
- src/RIO/Prelude/Logger.hs +22/−22
- src/RIO/Prelude/RIO.hs +15/−3
- src/RIO/Prelude/Reexports.hs +8/−325
- src/RIO/Prelude/Renames.hs +12/−4
- src/RIO/Prelude/Text.hs +3/−4
- src/RIO/Prelude/Trace.hs +4/−3
- src/RIO/Prelude/Types.hs +350/−0
- src/RIO/Prelude/URef.hs +1/−3
- src/RIO/State.hs +11/−0
- src/RIO/Writer.hs +9/−0
- test/RIO/DequeSpec.hs +127/−0
- test/RIO/Prelude/RIOSpec.hs +4/−4
ChangeLog.md view
@@ -1,5 +1,22 @@ # Changelog for rio +## 0.1.9.0++* Add `Prelude.Exit` to export lifted versions of the exit functions from `System.Exit`.+* Re-export the `Control.Monad.State.State` and `Control.Monad.State.StateT` types and related computation functions in `RIO.State`.+* Re-export the `Control.Monad.Writer.Writer` and `Control.Monad.Writer.WriterT` types and related computation functions in `RIO.Writer`.+* Re-export `pred`, `succ` in `RIO.Partial`.+* Add `Semigroup` and `Monoid` instances for `RIO`+* Add the `Deque` double-ended queue data type+* Re-export `Data.Map.Strict.toAscList` and `Data.Map.Strict.toDescList` from `RIO.Map`.+* Re-export `Data.Sequence.Seq` from `RIO`.+* Addition of `RIO.Prelude` module+* Addition of `RIO.Prelude.Types` module+* Re-export `zipWith` and `runST` from `RIO.Prelude`+* Re-export `Exception`, `MonadFail`, `Typeable` and `ST` from `RIO.Prelude.Types`+* Switch to `MonadFail.fail` from `Monad.fail` and re-exported it from `RIO.Prelude`++ ## 0.1.8.0 * Re-export `Control.Monad.State.modify`, `Control.Monad.State.modify'` and `Control.Monad.State.gets` in `RIO.State`
README.md view
@@ -4,18 +4,7 @@  -[](https://travis-ci.org/commercialhaskell/rio) [](https://ci.appveyor.com/project/snoyberg/rio-21tpl)--__NOTE__ This code is currently in prerelease status, and has been-released as a tech preview. A number of us are actively working on-improving the project and getting it to a useful first release. For-more information, see the-[description of goals](https://github.com/snoyberg/codename-karka#readme)-and the-[issue tracker for discussions](https://github.com/commercialhaskell/rio/issues). If-you're reading this file anywhere but Github, you should probably-[read the Github version instead](https://github.com/commercialhaskell/rio#readme),-which will be more up to date.+[](https://dev.azure.com/snoyberg/rio/_build/latest?definitionId=6&branchName=master) The goal of the `rio` library is to make it easier to adopt Haskell for writing production software. It is intended as a cross between:@@ -24,9 +13,11 @@ * Useful `Prelude` replacement * A set of best practices for writing production quality Haskell code -You're free to use any subset of functionality desired in your-project. This README will guide you through using `rio` to its fullest-extent.+This repository contains the `rio` library and other related+libraries, such as `rio-orphans`. There is a [tutorial on how to use+`rio`](https://haskell.fpcomplete.com/library/rio) available on FP+Complete's Haskell site. This README discusses project goals and+collects other reference information. ## Standard library @@ -112,9 +103,8 @@ regardless of qualification. For instance, if you are importing both `RIO.Map.\\` and `RIO.List.\\` do not import either one unqualified. -__TODO__ In the future, we may have editor integration or external-tooling to help with import management. Also, see project template-comments below.+In the future, we may have editor integration or external tooling to+help with import management. ### Language extensions @@ -182,9 +172,10 @@ * `MonadFailDesugaring` helps prevent partial pattern matches in your code, see [#85](https://github.com/commercialhaskell/rio/issues/85) -__TODO__ Do we recommend setting in `package.yaml` or in the source-files themselves? Need to discuss and come to a conclusion on this-point https://github.com/commercialhaskell/rio/issues/9+Due to concerns about tooling usage (see [issue+#9](https://github.com/commercialhaskell/rio/issues/9)), we recommend+adding these extensions on-demand in your individual source modules+instead of including them in your `package.yaml` or `.cabal` files. There are other language extensions which are perfectly fine to use as well, but are not recommended to be turned on by default:@@ -206,28 +197,34 @@ ### GHC Options -We recommend using these GHC complier warning flags on all projects, to catch +We recommend using these GHC complier warning flags on all projects, to catch problems that might otherwise go overlooked: * `-Wall` * `-Wcompat`+* `-Widentities` * `-Wincomplete-record-updates` * `-Wincomplete-uni-patterns`+* `-Wpartial-fields` * `-Wredundant-constraints` -You may add them per file, or to your package.yaml, or pass them on the command -line when running ghc. We plan to add these to the package.yaml of our project -template, once its ready.+You may add them per file, or to your package.yaml, or pass them on+the command line when running ghc. We include these in the project+template's `package.yaml` file. -For code targeting production use, you should also use the flag that turns all -warnings into errors, to force you to resolve the warnings before you ship your +For code targeting production use, you should also use the flag that turns all+warnings into errors, to force you to resolve the warnings before you ship your code: * `-Werror` -Further reading: Alexis King explains why these are a good idea in [her blog -post](https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/) +Further reading:++* Alexis King explains why these are a good idea in [her blog+post](https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/) which was the original inspiration for this section.+* Max Tagher gives an in-depth overview of these flags, and more,+[in his blog post](https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3). ### Monads @@ -302,9 +299,6 @@ envL = lens seEnv (\x y -> x { seEnv = y }) ``` - __TODO__ Open question: how do we decide when we use a `Lens'`- versus just a `SimpleGetter` in these `Has` typeclasses?- * If you're writing code that you want to be usable outside of `RIO` for some reason, you should stick to the good mtl-style typeclasses: `MonadReader`, `MonadIO`, `MonadUnliftIO`, `MonadThrow`, and@@ -317,14 +311,14 @@ ### Exceptions -For in-depth discussion, see-[exceptions best practices](https://www.fpcomplete.com/blog/2016/11/exceptions-best-practices-haskell). The+For in-depth discussion, see [safe exception+handling](https://haskell.fpcomplete.com/tutorial/exceptions). The basic idea is: * If something can fail, and you want people to deal with that failure every time (e.g., `lookup`), then return a `Maybe` or `Either` value.-* If the use will sometimes not want to deal with it, then use+* If the user will usually not want to deal with it, then use exceptions. In the case of pure code, use a `MonadThrow` constraint. In the case of `IO` code: use runtime exceptions via `throwIO` (works in the `RIO` monad too).@@ -361,19 +355,19 @@ ### Project template -__TODO__ In the future, we'll add a new Stack template for using this-library. We'll use hpack, not cabal files, and rely on automatic-exposed-module discovery.+We provide a project template which sets up lots of things for you out+of the box. You can use it by running: +```+$ stack new projectname rio+```+ ### Safety first This library intentionally puts safety first, and therefore avoids promoting partial functions and lazy I/O. If you think you need lazy I/O: you need a streaming data library like conduit instead. -__TODO__ Decide if we include a streaming data solution out of the-box. https://github.com/commercialhaskell/rio/issues/1- ### When to generalize A common question in Haskell code is when should you generalize. Here@@ -389,13 +383,6 @@ doing so as long as possible. And _if_ you define a typeclass: make sure its usage can't lead to accidental bugs by allowing you to swap in types you didn't expect.--__TODO__ Expand, clarify, examples.--### Coding style--__TODO__ Point to coding style guidelines, and discuss-[hindent](https://github.com/commercialhaskell/hindent). ### Module hierarchy
rio.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 03c9a11fb87d70a75dd9c78b679c652518ced81d54220e49b2e41637a463958b+-- hash: 6f5dc93d0508056a442e310600368aef689150506da77c8be79554052108f60a name: rio-version: 0.1.8.0+version: 0.1.9.0 synopsis: A standard library for Haskell description: See README and Haddocks at <https://www.stackage.org/package/rio> category: Control@@ -35,6 +35,7 @@ RIO.ByteString.Partial RIO.Char RIO.Char.Partial+ RIO.Deque RIO.Directory RIO.File RIO.FilePath@@ -47,7 +48,9 @@ RIO.Map.Partial RIO.Map.Unchecked RIO.Partial+ RIO.Prelude RIO.Prelude.Simple+ RIO.Prelude.Types RIO.Process RIO.Seq RIO.Set@@ -74,6 +77,7 @@ RIO.Writer other-modules: RIO.Prelude.Display+ RIO.Prelude.Exit RIO.Prelude.Extra RIO.Prelude.IO RIO.Prelude.Lens@@ -87,7 +91,7 @@ hs-source-dirs: src/ build-depends:- base >=4.9 && <10+ base >=4.10 && <10 , bytestring , containers , deepseq@@ -102,7 +106,8 @@ , text , time , typed-process >=0.2.2.0- , unliftio >=0.2.6.0+ , unliftio >=0.2.8.0+ , unliftio-core , unordered-containers , vector if os(windows)@@ -118,6 +123,7 @@ type: exitcode-stdio-1.0 main-is: Spec.hs other-modules:+ RIO.DequeSpec RIO.FileSpec RIO.ListSpec RIO.LoggerSpec@@ -131,7 +137,8 @@ hs-source-dirs: test build-depends:- base >=4.9 && <10+ QuickCheck+ , base >=4.10 && <10 , bytestring , containers , deepseq@@ -148,7 +155,8 @@ , text , time , typed-process >=0.2.2.0- , unliftio >=0.2.6.0+ , unliftio >=0.2.8.0+ , unliftio-core , unordered-containers , vector if os(windows)
src/RIO.hs view
@@ -1,27 +1,114 @@ module RIO- ( module RIO.Prelude.Display- , module RIO.Prelude.Extra- , module RIO.Prelude.IO- , module RIO.Prelude.Lens+ (+ -- * Custom @Prelude@++ -- | One of the core features of @rio@ is that it can be used as a @Prelude@+ -- replacement. Therefore it is best to disable the default `Prelude` with:+ -- [NoImplicitPrelude](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#extension-NoImplicitPrelude)+ -- pragma:+ --+ -- > {-# LANGUAGE NoImplicitPrelude #-}+ -- > import RIO+ --+ module RIO.Prelude+ , module RIO.Prelude.Types+ -- * The @RIO@ Monad++ , module MonadRIO+ -- ** @SimpleApp@+ -- | If all you need is just some default environment that does basic logging and allows+ -- spawning processes, then you can use `SimpleApp`:+ --+ -- > {-# LANGUAGE OverloadedStrings #-}+ -- > module Main where+ -- >+ -- > main :: IO ()+ -- > main =+ -- > runSimpleApp $ do+ -- > logInfo "Hello World!"+ --+ -- Note the+ -- [OverloadedStrings](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#extension-OverloadedStrings)+ -- extension, which is enabled to simplify logging.+ , module RIO.Prelude.Simple+ -- * @MonadIO@ and @MonadUnliftIO@+ , module Control.Monad.IO.Unlift+ -- * Logger , module RIO.Prelude.Logger- , module RIO.Prelude.RIO- , module RIO.Prelude.Reexports- , module RIO.Prelude.Renames- , module RIO.Prelude.Text- , module RIO.Prelude.Trace+ -- * Display+ , module RIO.Prelude.Display+ -- * Lens+ , module RIO.Prelude.Lens+ -- * Concurrency+ , UnliftIO.Concurrent.ThreadId+ , UnliftIO.Concurrent.myThreadId+ , UnliftIO.Concurrent.isCurrentThreadBound+ , UnliftIO.Concurrent.threadWaitRead+ , UnliftIO.Concurrent.threadWaitWrite+ , UnliftIO.Concurrent.threadDelay+ , RIO.Prelude.Renames.yieldThread+ -- ** Async+ , module UnliftIO.Async+ -- ** STM+ , module UnliftIO.STM+ -- ** Chan+ , module UnliftIO.Chan+ -- ** Timeout+ , module UnliftIO.Timeout+ -- * Exceptions+ , module UnliftIO.Exception+ -- | Re-exported from "Control.Monad.Catch":+ , Control.Monad.Catch.throwM+ -- * Files and handles+ , module UnliftIO.IO+ , module UnliftIO.Temporary+ , module RIO.Prelude.IO+ -- * Exit+ , module RIO.Prelude.Exit+ -- * Mutable Variables+ -- ** SomeRef+ , module SomeRef+ -- ** URef , module RIO.Prelude.URef- , module RIO.Prelude.Simple+ -- ** IORef+ , module UnliftIO.IORef+ -- ** MVar+ , module UnliftIO.MVar+ -- ** Memoize+ , module UnliftIO.Memoize+ -- ** Deque+ , module RIO.Deque++ -- * Debugging+ , module RIO.Prelude.Trace ) where +import qualified Control.Monad.Catch (MonadThrow(..))+import RIO.Deque+import RIO.Prelude import RIO.Prelude.Display+import RIO.Prelude.Exit import RIO.Prelude.Extra import RIO.Prelude.IO import RIO.Prelude.Lens import RIO.Prelude.Logger-import RIO.Prelude.RIO-import RIO.Prelude.Reexports import RIO.Prelude.Renames+import RIO.Prelude.RIO as MonadRIO (RIO(..), liftRIO, runRIO)+import RIO.Prelude.RIO as SomeRef hiding (RIO(..), liftRIO, runRIO)+import RIO.Prelude.Simple import RIO.Prelude.Text import RIO.Prelude.Trace+import RIO.Prelude.Types import RIO.Prelude.URef-import RIO.Prelude.Simple+import Control.Monad.IO.Unlift+import UnliftIO.Async+import UnliftIO.Chan+import UnliftIO.Exception+import UnliftIO.IO+import UnliftIO.IORef+import UnliftIO.Memoize+import UnliftIO.MVar+import UnliftIO.STM+import UnliftIO.Temporary+import UnliftIO.Timeout+import UnliftIO.Concurrent
+ src/RIO/Deque.hs view
@@ -0,0 +1,340 @@+{-# LANGUAGE NoImplicitPrelude #-}+module RIO.Deque+ ( -- * Types+ Deque+ , UDeque+ , SDeque+ , BDeque+ -- * Operations+ , newDeque+ , getDequeSize+ , popFrontDeque+ , popBackDeque+ , pushFrontDeque+ , pushBackDeque+ , foldlDeque+ , foldrDeque+ , dequeToList+ , dequeToVector+ , freezeDeque+ -- * Inference helpers+ , asUDeque+ , asSDeque+ , asBDeque+ ) where++import RIO.Prelude.Reexports+import Control.Exception (assert)+import Control.Monad (liftM)+import qualified Data.Vector.Generic as VG+import qualified Data.Vector.Generic.Mutable as V+import qualified Data.Vector.Mutable as B+import qualified Data.Vector.Storable.Mutable as S+import qualified Data.Vector.Unboxed.Mutable as U+import Data.Primitive.MutVar++data DequeState v s a = DequeState+ !(v s a)+ {-# UNPACK #-} !Int -- start+ {-# UNPACK #-} !Int -- size++-- | A double-ended queue supporting any underlying vector type and any monad.+--+-- This implements a circular double-ended queue with exponential growth.+--+-- @since 0.1.9.0+newtype Deque v s a = Deque (MutVar s (DequeState v s a))++-- | A 'Deque' specialized to unboxed vectors.+--+-- @since 0.1.9.0+type UDeque = Deque U.MVector++-- | A 'Deque' specialized to storable vectors.+--+-- @since 0.1.9.0+type SDeque = Deque S.MVector++-- | A 'Deque' specialized to boxed vectors.+--+-- @since 0.1.9.0+type BDeque = Deque B.MVector++-- | Helper function to assist with type inference, forcing usage of+-- an unboxed vector.+--+-- @since 0.1.9.0+asUDeque :: UDeque s a -> UDeque s a+asUDeque = id++-- | Helper function to assist with type inference, forcing usage of a+-- storable vector.+--+-- @since 0.1.9.0+asSDeque :: SDeque s a -> SDeque s a+asSDeque = id++-- | Helper function to assist with type inference, forcing usage of a+-- boxed vector.+--+-- @since 0.1.9.0+asBDeque :: BDeque s a -> BDeque s a+asBDeque = id++-- | Create a new, empty 'Deque'+--+-- @since 0.1.9.0+newDeque+ :: (V.MVector v a, PrimMonad m)+ => m (Deque v (PrimState m) a)+newDeque = do+ v <- V.new baseSize+ liftM Deque $ newMutVar (DequeState v 0 0)+ where+ baseSize = 32+{-# INLINE newDeque #-}+++-- | /O(1)/ - Get the number of elements that is currently in the `Deque`+--+-- @since 0.1.9.0+getDequeSize :: PrimMonad m => Deque v (PrimState m) a -> m Int+getDequeSize (Deque var) = do+ DequeState _ _ size <- readMutVar var+ pure size+{-# INLINE getDequeSize #-}+++-- | Pop the first value from the beginning of the 'Deque'+--+-- @since 0.1.9.0+popFrontDeque+ :: (V.MVector v a, PrimMonad m)+ => Deque v (PrimState m) a+ -> m (Maybe a)+popFrontDeque (Deque var) = do+ DequeState v start size <- readMutVar var+ if size == 0+ then return Nothing+ else do+ x <- V.unsafeRead v start+ let start' = start + 1+ start''+ | start' >= V.length v = 0+ | otherwise = start'+ writeMutVar var $! DequeState v start'' (size - 1)+ return $! Just x+{-# INLINE popFrontDeque #-}++-- | Pop the first value from the end of the 'Deque'+--+-- @since 0.1.9.0+popBackDeque+ :: (V.MVector v a, PrimMonad m)+ => Deque v (PrimState m) a+ -> m (Maybe a)+popBackDeque (Deque var) = do+ DequeState v start size <- readMutVar var+ if size == 0+ then return Nothing+ else do+ let size' = size - 1+ end = start + size'+ end'+ | end >= V.length v = end - V.length v+ | otherwise = end+ x <- V.unsafeRead v end'+ writeMutVar var $! DequeState v start size'+ return $! Just x+{-# INLINE popBackDeque #-}++-- | Push a new value to the beginning of the 'Deque'+--+-- @since 0.1.9.0+pushFrontDeque+ :: (V.MVector v a, PrimMonad m)+ => Deque v (PrimState m) a+ -> a+ -> m ()+pushFrontDeque (Deque var) x = do+ DequeState v start size <- readMutVar var+ inner v start size+ where+ inner v start size = do+ if size >= V.length v+ then newVector v start size inner+ else do+ let size' = size + 1+ start' = (start - 1) `rem` V.length v+ start''+ | start' < 0 = V.length v + start'+ | otherwise = start'+ V.unsafeWrite v start'' x+ writeMutVar var $! DequeState v start'' size'+{-# INLINE pushFrontDeque #-}++-- | Push a new value to the end of the 'Deque'+--+-- @since 0.1.9.0+pushBackDeque+ :: (V.MVector v a, PrimMonad m)+ => Deque v (PrimState m) a+ -> a+ -> m ()+pushBackDeque (Deque var) x = do+ DequeState v start size <- readMutVar var+ inner v start size+ where+ inner v start size = do+ if size >= V.length v+ then newVector v start size inner+ else do+ let end = start + size+ end'+ | end >= V.length v = end - V.length v+ | otherwise = end+ V.unsafeWrite v end' x+ writeMutVar var $! DequeState v start (size + 1)+{-# INLINE pushBackDeque #-}++-- | Fold over a 'Deque', starting at the beginning. Does not modify the 'Deque'.+--+-- @since 0.1.9.0+foldlDeque+ :: (V.MVector v a, PrimMonad m)+ => (acc -> a -> m acc)+ -> acc+ -> Deque v (PrimState m) a+ -> m acc+foldlDeque f acc0 (Deque var) = do+ DequeState v start size <- readMutVar var+ let loop idx acc+ | idx >= size = pure acc+ | otherwise = do+ let idxPlusStart = idx + start+ idx'+ | idxPlusStart >= V.length v = idxPlusStart - V.length v+ | otherwise = idxPlusStart+ a <- V.unsafeRead v idx'+ acc' <- f acc a+ loop (idx + 1) $! acc'+ loop 0 acc0+++-- | Fold over a 'Deque', starting at the end. Does not modify the 'Deque'.+--+-- @since 0.1.9.0+foldrDeque+ :: (V.MVector v a, PrimMonad m)+ => (a -> acc -> m acc)+ -> acc+ -> Deque v (PrimState m) a+ -> m acc+foldrDeque f acc0 (Deque var) = do+ DequeState v start size <- readMutVar var+ let loop idx acc+ | idx < 0 = pure acc+ | otherwise = do+ let idxPlusStart = idx + start+ idx'+ | idxPlusStart >= V.length v = idxPlusStart - V.length v+ | otherwise = idxPlusStart+ a <- V.unsafeRead v idx'+ acc' <- f a acc+ loop (idx - 1) $! acc'+ loop (size - 1) acc0++-- | Convert a 'Deque' into a list. Does not modify the 'Deque'.+--+-- @since 0.1.9.0+dequeToList+ :: (V.MVector v a, PrimMonad m)+ => Deque v (PrimState m) a+ -> m [a]+dequeToList = foldrDeque (\a rest -> pure $ a : rest) []+{-# INLINE dequeToList #-}+++-- | Convert to an immutable vector of any type. If resulting pure vector corresponds to the mutable+-- one used by the `Deque`, it will be more efficient to use `freezeDeque` instead.+--+-- ==== __Example__+--+-- >>> :set -XTypeApplications+-- >>> import qualified RIO.Vector.Unboxed as U+-- >>> import qualified RIO.Vector.Storable as S+-- >>> d <- newDeque @U.MVector @Int+-- >>> mapM_ (pushFrontDeque d) [0..10]+-- >>> dequeToVector @S.Vector d+-- [10,9,8,7,6,5,4,3,2,1,0]+--+-- @since 0.1.9.0+dequeToVector :: (VG.Vector v' a, V.MVector v a, PrimMonad m)+ => Deque v (PrimState m) a -> m (v' a)+dequeToVector dq = do+ size <- getDequeSize dq+ mv <- V.unsafeNew size+ foldlDeque (\i e -> V.unsafeWrite mv i e >> pure (i+1)) 0 dq+ VG.unsafeFreeze mv+++newVector :: (PrimMonad m, V.MVector v a)+ => v (PrimState m) a+ -> Int+ -> Int+ -> (v (PrimState m) a -> Int -> Int -> m b)+ -> m b+newVector v size2 sizeOrig f = assert (sizeOrig == V.length v) $ do+ v' <- V.unsafeNew (V.length v * 2)+ let size1 = V.length v - size2+ V.unsafeCopy+ (V.unsafeTake size1 v')+ (V.unsafeSlice size2 size1 v)+ V.unsafeCopy+ (V.unsafeSlice size1 size2 v')+ (V.unsafeTake size2 v)+ f v' 0 sizeOrig+{-# INLINE newVector #-}+++-- | Yield an immutable copy of the underlying mutable vector. The difference from `dequeToVector`+-- is that the the copy will be performed with a more efficient @memcpy@, rather than element by+-- element. The downside is that the resulting vector type must be the one that corresponds to the+-- mutable one that is used in the `Deque`.+--+-- ==== __Example__+--+-- >>> :set -XTypeApplications+-- >>> import qualified RIO.Vector.Unboxed as U+-- >>> d <- newDeque @U.MVector @Int+-- >>> mapM_ (pushFrontDeque d) [0..10]+-- >>> freezeDeque @U.Vector d+-- [10,9,8,7,6,5,4,3,2,1,0]+--+-- @since 0.1.9.0+freezeDeque ::+ (VG.Vector v a, PrimMonad m)+ => Deque (VG.Mutable v) (PrimState m) a+ -> m (v a)+freezeDeque (Deque var) = do+ state@(DequeState v _ size) <- readMutVar var+ v' <- V.unsafeNew size+ makeCopy v' state+ VG.unsafeFreeze v'+++makeCopy ::+ (V.MVector v a, PrimMonad m)+ => v (PrimState m) a+ -> DequeState v (PrimState m) a+ -> m ()+makeCopy v' (DequeState v start size) = do+ let size1 = min size (V.length v - start)+ size2 = size - size1+ V.unsafeCopy+ (V.unsafeTake size1 v')+ (V.unsafeSlice start size1 v)+ when (size > size1) $ V.unsafeCopy+ (V.unsafeSlice size1 size2 v')+ (V.unsafeTake size2 v)+{-# INLINE makeCopy #-}
src/RIO/Map.hs view
@@ -113,6 +113,12 @@ , Data.Map.Strict.fromListWith , Data.Map.Strict.fromListWithKey + -- ** Ordered lists+ , Data.Map.Strict.toAscList+#if MIN_VERSION_containers(0,5,8)+ , Data.Map.Strict.toDescList+#endif+ -- * Filter , Data.Map.Strict.filter , Data.Map.Strict.filterWithKey
src/RIO/Map/Unchecked.hs view
@@ -12,13 +12,13 @@ -- * Conversion -- ** Ordered lists- , Data.Map.Strict.toAscList+ , Data.Map.Strict.toAscList -- FIXME: remove in the next major version (0.2.0.0) , Data.Map.Strict.fromAscList , Data.Map.Strict.fromAscListWith , Data.Map.Strict.fromAscListWithKey , Data.Map.Strict.fromDistinctAscList #if MIN_VERSION_containers(0,5,8)- , Data.Map.Strict.toDescList+ , Data.Map.Strict.toDescList -- FIXME: remove in the next major version (0.2.0.0) , Data.Map.Strict.fromDescList , Data.Map.Strict.fromDescListWith , Data.Map.Strict.fromDescListWithKey
src/RIO/Partial.hs view
@@ -4,6 +4,8 @@ ( Data.Maybe.fromJust , Prelude.read , Prelude.toEnum+ , Prelude.pred+ , Prelude.succ ) where import qualified Data.Maybe
+ src/RIO/Prelude.hs view
@@ -0,0 +1,450 @@+module RIO.Prelude+ (+ module RIO.Prelude.Types+ -- * @Bool@+ -- | Re-exported from "Data.Bool":+ , (Data.Bool.||)+ , (Data.Bool.&&)+ , Data.Bool.not+ , Data.Bool.otherwise+ , Data.Bool.bool++ -- * @Maybe@+ -- | Re-exported from "Data.Maybe":+ , Data.Maybe.maybe+ , Data.Maybe.fromMaybe+ , RIO.Prelude.Extra.fromFirst+ , Data.Maybe.isJust+ , Data.Maybe.isNothing+ , Data.Maybe.listToMaybe+ , Data.Maybe.maybeToList+ , Data.Maybe.catMaybes+ , Data.Maybe.mapMaybe+ , RIO.Prelude.Extra.mapMaybeA+ , RIO.Prelude.Extra.mapMaybeM+ , RIO.Prelude.Extra.forMaybeA+ , RIO.Prelude.Extra.forMaybeM++ -- * @Either@+ -- | Re-exported from "Data.Either":+ , Data.Either.either+ , Data.Either.isLeft+ , Data.Either.isRight+ , RIO.Prelude.Extra.mapLeft+ , Data.Either.lefts+ , Data.Either.partitionEithers+ , Data.Either.rights++ -- * Tuples+ -- | Re-exported from "Data.Tuple":+ , Data.Tuple.fst+ , Data.Tuple.snd+ , Data.Tuple.curry+ , Data.Tuple.uncurry+ -- , Data.Tuple.swap -- TODO: export?++ -- * @Eq@+ -- | Re-exported from "Data.Eq":+ , (Data.Eq.==)+ , (Data.Eq./=)++ -- * @Ord@+ -- | Re-exported from "Data.Ord":+ , (Data.Ord.<)+ , (Data.Ord.<=)+ , (Data.Ord.>)+ , (Data.Ord.>=)+ , Data.Ord.max+ , Data.Ord.min+ , Data.Ord.compare+ , Data.Ord.comparing++ -- * @Enum@+ -- | Re-exported from "Prelude":+ , Prelude.fromEnum++ -- * @Bounded@+ -- | Re-exported from "Prelude":+ , Prelude.minBound+ , Prelude.maxBound++ -- * @Num@+ -- | Re-exported from "Prelude":+ , (Prelude.+)+ , (Prelude.-)+ , (*) -- HSE can't parse qualified export, which results in hlint error.+ , (Prelude.^)+ , Prelude.negate+ , Prelude.abs+ , Prelude.signum+ , Prelude.fromInteger+ , Prelude.subtract++ -- * @Real@+ -- | Re-exported from "Prelude":+ , Prelude.toRational++ -- * @Integral@+ -- | Re-exported from "Prelude":+ , Prelude.quot+ , Prelude.rem+ , Prelude.div+ , Prelude.mod+ , Prelude.quotRem+ , Prelude.divMod+ , Prelude.toInteger+ , Prelude.even+ , Prelude.odd+ , Prelude.gcd+ , Prelude.lcm+ , Prelude.fromIntegral++ -- * @Fractional@+ -- | Re-exported from "Prelude":+ , (Prelude./)+ , (Prelude.^^)+ , Prelude.recip+ , Prelude.fromRational+ , Prelude.realToFrac++ -- * @Floating@+ -- | Re-exported from "Prelude":+ , Prelude.pi+ , Prelude.exp+ , Prelude.log+ , Prelude.sqrt+ , (Prelude.**)+ , Prelude.logBase+ , Prelude.sin+ , Prelude.cos+ , Prelude.tan+ , Prelude.asin+ , Prelude.acos+ , Prelude.atan+ , Prelude.sinh+ , Prelude.cosh+ , Prelude.tanh+ , Prelude.asinh+ , Prelude.acosh+ , Prelude.atanh++ -- * @RealFrac@+ -- | Re-exported from "Prelude":+ , Prelude.properFraction+ , Prelude.truncate+ , Prelude.round+ , Prelude.ceiling+ , Prelude.floor++ -- * @RealFloat@+ -- | Re-exported from "Prelude":+ , Prelude.floatRadix+ , Prelude.floatDigits+ , Prelude.floatRange+ , Prelude.decodeFloat+ , Prelude.encodeFloat+ , Prelude.exponent+ , Prelude.significand+ , Prelude.scaleFloat+ , Prelude.isNaN+ , Prelude.isInfinite+ , Prelude.isDenormalized+ , Prelude.isNegativeZero+ , Prelude.isIEEE+ , Prelude.atan2++ -- * @Word@+ -- | Re-exported from "Data.Word":+ , Data.Word.byteSwap16+ , Data.Word.byteSwap32+ , Data.Word.byteSwap64++ -- * @Semigroup@+ -- | Re-exported from "Data.Semigroup":+ , (Data.Semigroup.<>)+ , RIO.Prelude.Renames.sappend++ -- * @Monoid@+ -- | Re-exported from "Data.Monoid":+ , Data.Monoid.mempty+ , Data.Monoid.mappend+ , Data.Monoid.mconcat++ -- * @Functor@+ -- | Re-exported from "Data.Functor":+ , Data.Functor.fmap+ , (Data.Functor.<$>)+ , (Data.Functor.<$)+ , (Data.Functor.$>)+ , Data.Functor.void+ , (RIO.Prelude.Extra.<&>)++ -- * @Applicative@+ -- | Re-exported from "Control.Applicative":+ , Control.Applicative.pure+ , (Control.Applicative.<*>)+ , (Control.Applicative.<*)+ , (Control.Applicative.*>)+ , Control.Applicative.liftA+ , Control.Applicative.liftA2+ , Control.Applicative.liftA3+ , Control.Monad.forever+ , Data.Foldable.traverse_+ , Data.Foldable.for_+ , Data.Foldable.sequenceA_+ , Control.Monad.filterM+ , Control.Monad.replicateM_+ , Control.Monad.zipWithM+ , Control.Monad.zipWithM_++ -- * @Monad@+ -- | Re-exported from "Control.Monad":+ , Control.Monad.return+ , Control.Monad.join+ , (Control.Monad.>>=)+ , (Control.Monad.>>)+ , (Control.Monad.=<<)+ , (Control.Monad.>=>)+ , (Control.Monad.<=<)+ , (Control.Monad.<$!>)+ , Control.Monad.liftM+ , Control.Monad.liftM2+ , RIO.Prelude.Extra.whenM+ , RIO.Prelude.Extra.unlessM+ , Data.Foldable.mapM_+ , Data.Foldable.forM_+ , Data.Foldable.sequence_++ , Control.Monad.foldM+ , Control.Monad.foldM_+ -- TODO: Export these as well perhaps?+ -- , Data.Foldable.foldlM+ -- , Data.Foldable.foldrM++ -- ** @MonadFail@+ -- | Re-exported from "Control.Monad.Fail":+ , Control.Monad.Fail.fail++ -- * @Foldable@+ -- | Re-exported from "Data.Foldable":+ , Data.Foldable.foldr+ , Data.Foldable.foldl'+ , Data.Foldable.fold+ , Data.Foldable.foldMap+ , RIO.Prelude.Extra.foldMapM+ , Data.Foldable.elem+ , Data.Foldable.notElem+ , Data.Foldable.null+ , Data.Foldable.length+ , Data.Foldable.sum+ , Data.Foldable.product+ , Data.Foldable.all+ , Data.Foldable.any+ , Data.Foldable.and+ , Data.Foldable.or+ , Data.Foldable.toList+ , Data.Foldable.concat+ , Data.Foldable.concatMap++ -- * @Traversable@+ -- | Re-exported from "Data.Traversable":+ , Data.Traversable.traverse+ , Data.Traversable.for+ , Data.Traversable.sequenceA+ , Data.Traversable.mapM+ , Data.Traversable.forM+ , Data.Traversable.sequence++ -- * @Alternative@+ -- | Re-exported from "Control.Applicative":+ , Control.Applicative.empty+ , (Control.Applicative.<|>)+ , Control.Applicative.some+ , Control.Applicative.many+ , Control.Applicative.optional+ , Data.Foldable.asum+ , Control.Monad.guard+ , Control.Monad.when+ , Control.Monad.unless++ -- * @MonadPlus@+ -- | Re-exported from "Control.Monad":+ , Control.Monad.mzero+ , Control.Monad.mplus+ , Control.Monad.msum+ , Control.Monad.mfilter++ -- * @Arrow@+ -- | Re-exported from "Control.Arrow" and "Control.Category":+ , Control.Arrow.first+ , Control.Arrow.second+ , (Control.Arrow.&&&)+ , (Control.Arrow.***)+ , (Control.Category.>>>)++ -- * @Function@+ -- | Re-exported from "Data.Function":+ , Data.Function.id+ , Data.Function.const+ , (Data.Function..)+ , (Data.Function.$)+ , (Data.Function.&)+ , Data.Function.flip+ , Data.Function.fix+ , Data.Function.on++ -- * Miscellaneous functions+ , (Prelude.$!)+ , Prelude.seq+ , Prelude.error+ , Prelude.undefined+ , Prelude.asTypeOf+ , RIO.Prelude.Extra.asIO++ -- * List+ -- | Re-exported from "Data.List":+ , (Data.List.++)+ , Data.List.break+ , Data.List.drop+ , Data.List.dropWhile+ , Data.List.filter+ , Data.List.lookup+ , Data.List.map+ , Data.List.replicate+ , Data.List.reverse+ , Data.List.span+ , Data.List.take+ , Data.List.takeWhile+ , Data.List.zip+ , Data.List.zipWith+ , RIO.Prelude.Extra.nubOrd+++ -- * @String@+ -- | Re-exported from "Data.String":+ , Data.String.fromString+ , Data.String.lines+ , Data.String.unlines+ , Data.String.unwords+ , Data.String.words++ -- ** @Show@+ -- | Re-exported from "Text.Show":+ , Text.Show.show+ -- ** @Read@+ -- | Re-exported from "Text.Read":+ , Text.Read.readMaybe++ -- * @NFData@++ -- | Re-exported from "Control.DeepSeq":+ , (Control.DeepSeq.$!!)+ , Control.DeepSeq.rnf+ , Control.DeepSeq.deepseq+ , Control.DeepSeq.force++ -- * @Void@+ -- | Re-exported from "Data.Void":+ , Data.Void.absurd++ -- * @Reader@+ -- | Re-exported from "Control.Monad.Reader":+ , Control.Monad.Reader.lift+ , Control.Monad.Reader.ask+ , Control.Monad.Reader.asks+ , Control.Monad.Reader.local+ , Control.Monad.Reader.runReader+ , Control.Monad.Reader.runReaderT++ -- * @ByteString@+ -- | Helper synonyms for converting bewteen lazy and strict @ByteString@s+ , RIO.Prelude.Renames.toStrictBytes+ , RIO.Prelude.Renames.fromStrictBytes++ -- * @ShortByteString@+ -- | Re-exported from "Data.ByteString.Short":+ , Data.ByteString.Short.toShort+ , Data.ByteString.Short.fromShort++ -- * @Text@+ , RIO.Prelude.Text.tshow+ , RIO.Prelude.Text.decodeUtf8Lenient+ -- | Re-exported from "Data.Text.Encoding":+ , Data.Text.Encoding.decodeUtf8'+ , Data.Text.Encoding.decodeUtf8With+ , Data.Text.Encoding.encodeUtf8+ , Data.Text.Encoding.encodeUtf8Builder+ , Data.Text.Encoding.Error.lenientDecode++ -- * @PrimMonad@+ -- | Re-exported from "Control.Monad.Primitive":+ , Control.Monad.Primitive.primitive+ -- | Re-exported from "Control.Monad.ST":+ , Control.Monad.ST.runST+ ) where++import qualified RIO.Prelude.Extra+import qualified RIO.Prelude.Renames+import qualified RIO.Prelude.Text+import qualified RIO.Prelude.Types++import Prelude ((*))+import qualified Prelude++import qualified Data.Bool++import qualified Data.Maybe++import qualified Data.Either++import qualified Data.Tuple++import qualified Data.Eq++import qualified Data.Ord++import qualified Data.Word++import qualified Data.Semigroup++import qualified Data.Monoid++import qualified Data.Functor++import qualified Control.Applicative++import qualified Control.Monad+import qualified Control.Monad.Fail++import qualified Data.Foldable++import qualified Data.Traversable++import qualified Control.Arrow+import qualified Control.Category++import qualified Data.Function++import qualified Data.List++import qualified Data.String++import qualified Text.Show++import qualified Text.Read++import qualified Control.DeepSeq++import qualified Data.Void++import qualified Control.Monad.Reader++import qualified Data.ByteString.Short++import qualified Data.Text.Encoding (decodeUtf8', decodeUtf8With, encodeUtf8,+ encodeUtf8Builder)+import qualified Data.Text.Encoding.Error (lenientDecode)++import qualified Control.Monad.Primitive (primitive)+import qualified Control.Monad.ST+
+ src/RIO/Prelude/Exit.hs view
@@ -0,0 +1,31 @@+module RIO.Prelude.Exit+ ( exitFailure+ , exitSuccess+ , exitWith+ , System.Exit.ExitCode(..)+ ) where++import Control.Monad.IO.Class+import qualified System.Exit ( ExitCode (..)+ , exitFailure+ , exitSuccess+ , exitWith+ )++-- | Lifted version of "System.Exit.exitFailure".+--+-- @since 0.1.9.0.+exitFailure :: MonadIO m => m a+exitFailure = liftIO System.Exit.exitFailure++-- | Lifted version of "System.Exit.exitSuccess".+--+-- @since 0.1.9.0.+exitSuccess :: MonadIO m => m a+exitSuccess = liftIO System.Exit.exitSuccess++-- | Lifted version of "System.Exit.exitWith".+--+-- @since 0.1.9.0.+exitWith :: MonadIO m => System.Exit.ExitCode -> m a+exitWith code = liftIO $ System.Exit.exitWith code
src/RIO/Prelude/Extra.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} module RIO.Prelude.Extra ( mapLeft@@ -10,13 +11,17 @@ , nubOrd , whenM , unlessM+ , (<&>) , asIO ) where +import Prelude import qualified Data.Set as Set import Data.Monoid (First (..)) import Data.Foldable (foldlM)-import RIO.Prelude.Reexports+import Data.Functor+import Data.Maybe+import Control.Monad -- | Apply a function to a 'Left' constructor mapLeft :: (a1 -> a2) -> Either a1 b -> Either a2 b@@ -75,15 +80,19 @@ -- | Run the second value if the first value returns 'True' whenM :: Monad m => m Bool -> m () -> m ()-whenM boolM action = do- x <- boolM- if x then action else return ()+whenM boolM action = boolM >>= (`when` action) -- | Run the second value if the first value returns 'False' unlessM :: Monad m => m Bool -> m () -> m ()-unlessM boolM action = do- x <- boolM- if x then return () else action+unlessM boolM action = boolM >>= (`unless` action)++#if !MIN_VERSION_base(4, 11, 0)+(<&>) :: Functor f => f a -> (a -> b) -> f b+as <&> f = f <$> as++infixl 1 <&>+#endif+ -- | Helper function to force an action to run in 'IO'. Especially -- useful for overly general contexts, like hspec tests.
src/RIO/Prelude/Logger.hs view
@@ -2,19 +2,13 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-} module RIO.Prelude.Logger- ( -- * Standard logging functions- logDebug- , logInfo- , logWarn- , logError- , logOther- -- * Running with logging- , withLogFunc+ ( -- ** Running with logging+ withLogFunc , newLogFunc , LogFunc , HasLogFunc (..) , logOptionsHandle- -- ** Log options+ -- *** Log options , LogOptions , setLogMinLevel , setLogMinLevelIO@@ -24,29 +18,35 @@ , setLogUseTime , setLogUseColor , setLogUseLoc- -- * Advanced logging functions- -- ** Sticky logging+ -- ** Standard logging functions+ , logDebug+ , logInfo+ , logWarn+ , logError+ , logOther+ -- ** Advanced logging functions+ -- *** Sticky logging , logSticky , logStickyDone- -- ** With source+ -- *** With source , logDebugS , logInfoS , logWarnS , logErrorS , logOtherS- -- ** Generic log function+ -- *** Generic log function , logGeneric- -- * Advanced running functions+ -- ** Advanced running functions , mkLogFunc , logOptionsMemory- -- * Data types+ -- ** Data types , LogLevel (..) , LogSource , CallStack- -- * Convenience functions+ -- ** Convenience functions , displayCallStack , noLogging- -- * Accessors+ -- ** Accessors , logFuncUseColorL ) where @@ -355,7 +355,7 @@ -- Intended for use if you want to deal with the teardown of 'LogFunc' yourself, -- otherwise prefer the 'withLogFunc' function instead. ----- @since 0.1.3.0+-- @since 0.1.3.0 newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ()) newLogFunc options = if logTerminal options then do@@ -383,7 +383,7 @@ -- let isVerbose = False -- get from the command line instead -- logOptions' <- logOptionsHandle stderr isVerbose -- let logOptions = setLogUseTime True logOptions'--- withLogFunc logOptions $ \lf -> do+-- withLogFunc logOptions $ \\lf -> do -- let app = App -- application specific environment -- { appLogFunc = lf -- , appOtherStuff = ...@@ -474,7 +474,7 @@ -- | Include the time when printing log messages. ----- Default: true in debug mode, false otherwise.+-- Default: `True` in debug mode, `False` otherwise. -- -- @since 0.0.0.0 setLogUseTime :: Bool -> LogOptions -> LogOptions@@ -482,7 +482,7 @@ -- | Use ANSI color codes in the log output. ----- Default: true if in verbose mode /and/ the 'Handle' is a terminal device.+-- Default: `True` if in verbose mode /and/ the 'Handle' is a terminal device. -- -- @since 0.0.0.0 setLogUseColor :: Bool -> LogOptions -> LogOptions@@ -490,7 +490,7 @@ -- | Use code location in the log output. ----- Default: true if in verbose mode, false otherwise.+-- Default: `True` if in verbose mode, `False` otherwise. -- -- @since 0.1.2.0 setLogUseLoc :: Bool -> LogOptions -> LogOptions
src/RIO/Prelude/RIO.hs view
@@ -8,7 +8,7 @@ ( RIO (..) , runRIO , liftRIO- -- * SomeRef for Writer/State interfaces+ -- SomeRef for Writer/State interfaces , SomeRef , HasStateRef (..) , HasWriteRef (..)@@ -38,9 +38,21 @@ newtype RIO env a = RIO { unRIO :: ReaderT env IO a } deriving (Functor,Applicative,Monad,MonadIO,MonadReader env,MonadThrow) +instance Semigroup a => Semigroup (RIO env a) where+ (<>) = liftA2 (<>)+instance Monoid a => Monoid (RIO env a) where+ mempty = pure mempty+ mappend = liftA2 mappend++-- | Using the environment run in IO the action that requires that environment.+--+-- @since 0.0.1.0 runRIO :: MonadIO m => env -> RIO env a -> m a runRIO env (RIO (ReaderT f)) = liftIO (f env) +-- | Abstract `RIO` to an arbitrary `MonadReader` instance, which can handle IO.+--+-- @since 0.0.1.0 liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a liftRIO rio = do env <- ask@@ -82,12 +94,12 @@ liftIO $ (f <$> read') >>= write ioRefToSomeRef :: IORef a -> SomeRef a-ioRefToSomeRef ref = do+ioRefToSomeRef ref = SomeRef (readIORef ref) (\val -> modifyIORef' ref (\_ -> val)) uRefToSomeRef :: Unbox a => URef RealWorld a -> SomeRef a-uRefToSomeRef ref = do+uRefToSomeRef ref = SomeRef (readURef ref) (writeURef ref) -- | Environment values with stateful capabilities to SomeRef
src/RIO/Prelude/Reexports.hs view
@@ -1,328 +1,11 @@-{-# LANGUAGE CPP #-} module RIO.Prelude.Reexports- ( module UnliftIO- -- List imports from UnliftIO?- , UnliftIO.Concurrent.ThreadId- , UnliftIO.Concurrent.myThreadId- , UnliftIO.Concurrent.isCurrentThreadBound- , UnliftIO.Concurrent.threadWaitRead- , UnliftIO.Concurrent.threadWaitWrite- , UnliftIO.Concurrent.threadDelay- , yieldThread- , Control.Applicative.Alternative- , Control.Applicative.Applicative (..)- , Control.Applicative.liftA-#if !MIN_VERSION_base(4, 10, 0)- , Control.Applicative.liftA2-#endif- , Control.Applicative.liftA3- , Control.Applicative.many- , Control.Applicative.optional- , Control.Applicative.some- , (Control.Applicative.<|>)- , Control.Arrow.first- , Control.Arrow.second- , (Control.Arrow.&&&)- , (Control.Arrow.***)- , (Control.Category.>>>)- , Control.DeepSeq.NFData(..)- , Control.DeepSeq.force- , (Control.DeepSeq.$!!)- , Control.Monad.Monad(..)- , Control.Monad.MonadPlus(..)- , Control.Monad.filterM- , Control.Monad.foldM- , Control.Monad.foldM_- , Control.Monad.forever- , Control.Monad.guard- , Control.Monad.join- , Control.Monad.liftM- , Control.Monad.liftM2- , Control.Monad.replicateM_- , Control.Monad.unless- , Control.Monad.when- , Control.Monad.zipWithM- , Control.Monad.zipWithM_- , (Control.Monad.<$!>)- , (Control.Monad.<=<)- , (Control.Monad.=<<)- , (Control.Monad.>=>)- , Control.Monad.Catch.MonadThrow(..)- , Control.Monad.Reader.MonadReader- , Control.Monad.Reader.MonadTrans(..)- , Control.Monad.Reader.Reader- , Control.Monad.Reader.ReaderT(..)- , Control.Monad.Reader.ask- , Control.Monad.Reader.asks- , Control.Monad.Reader.local- , Control.Monad.Reader.runReader- , Data.Bool.Bool(..)- , Data.Bool.bool- , Data.Bool.not- , Data.Bool.otherwise- , (Data.Bool.&&)- , (Data.Bool.||)- , Data.ByteString.ByteString- , Data.ByteString.Builder.Builder- , Data.ByteString.Short.ShortByteString- , Data.ByteString.Short.toShort- , Data.ByteString.Short.fromShort- , Data.Char.Char- , Data.Data.Data(..)- , Data.Either.Either(..)- , Data.Either.either- , Data.Either.isLeft- , Data.Either.isRight- , Data.Either.lefts- , Data.Either.partitionEithers- , Data.Either.rights- , Data.Eq.Eq(..)- , Data.Foldable.Foldable- , Data.Foldable.all- , Data.Foldable.and- , Data.Foldable.any- , Data.Foldable.asum- , Data.Foldable.concat- , Data.Foldable.concatMap- , Data.Foldable.elem- , Data.Foldable.fold- , Data.Foldable.foldMap- , Data.Foldable.foldl'- , Data.Foldable.foldr- , Data.Foldable.forM_- , Data.Foldable.for_- , Data.Foldable.length- , Data.Foldable.mapM_- , Data.Foldable.msum- , Data.Foldable.notElem- , Data.Foldable.null- , Data.Foldable.or- , Data.Foldable.product- , Data.Foldable.sequenceA_- , Data.Foldable.sequence_- , Data.Foldable.sum- , Data.Foldable.toList- , Data.Foldable.traverse_- , Data.Function.const- , Data.Function.fix- , Data.Function.flip- , Data.Function.id- , Data.Function.on- , (Data.Function.$)- , (Data.Function.&)- , (Data.Function..)- , Data.Functor.Functor(..)- , Data.Functor.void- , (Data.Functor.$>)- , (Data.Functor.<$>)-#if MIN_VERSION_base(4, 11, 0)- , (Data.Functor.<&>)-#else- , (<&>)-#endif- , Data.Functor.Const.Const(..)- , Data.Functor.Identity.Identity(..)- , Data.Hashable.Hashable- , Data.HashMap.Strict.HashMap- , Data.HashSet.HashSet- , Data.Int.Int- , Data.Int.Int8- , Data.Int.Int16- , Data.Int.Int32- , Data.Int.Int64- , Data.IntMap.Strict.IntMap- , Data.IntSet.IntSet- , Data.List.break- , Data.List.drop- , Data.List.dropWhile- , Data.List.filter- , Data.List.lines- , Data.List.lookup- , Data.List.map- , Data.List.replicate- , Data.List.reverse- , Data.List.span- , Data.List.take- , Data.List.takeWhile- , Data.List.unlines- , Data.List.unwords- , Data.List.words- , Data.List.zip- , (Data.List.++)- , Data.Map.Strict.Map- , Data.Maybe.Maybe(..)- , Data.Maybe.catMaybes- , Data.Maybe.fromMaybe- , Data.Maybe.isJust- , Data.Maybe.isNothing- , Data.Maybe.listToMaybe- , Data.Maybe.mapMaybe- , Data.Maybe.maybe- , Data.Maybe.maybeToList- , Data.Monoid.Monoid (..)- , Data.Ord.Ord(..)- , Data.Ord.Ordering(..)- , Data.Ord.comparing- , Data.Proxy.Proxy(..)- , Data.Semigroup.Semigroup (..)- , Data.Set.Set- , Data.String.IsString(..)- , Data.Text.Text- , Data.Text.Encoding.decodeUtf8'- , Data.Text.Encoding.decodeUtf8With- , Data.Text.Encoding.encodeUtf8- , Data.Text.Encoding.encodeUtf8Builder- , Data.Text.Encoding.Error.UnicodeException(..)- , Data.Text.Encoding.Error.lenientDecode- , Data.Traversable.Traversable(..)- , Data.Traversable.for- , Data.Traversable.forM- , Data.Vector.Vector- , Data.Void.Void- , Data.Void.absurd- , Data.Word.Word- , Data.Word.Word8- , Data.Word.Word16- , Data.Word.Word32- , Data.Word.Word64- , Data.Word.byteSwap16- , Data.Word.byteSwap32- , Data.Word.byteSwap64- , Foreign.Storable.Storable- , GHC.Generics.Generic- , GHC.Stack.HasCallStack- , Numeric.Natural.Natural- , Prelude.Bounded (..)- , Prelude.Double- , Prelude.Enum- , Prelude.FilePath- , Prelude.Float- , Prelude.Floating (..)- , Prelude.Fractional (..)- , Prelude.IO- , Prelude.Integer- , Prelude.Integral (..)- , Prelude.Num (..)- , Prelude.Rational- , Prelude.Real (..)- , Prelude.RealFloat (..)- , Prelude.RealFrac (..)- , Prelude.Show- , Prelude.String- , Prelude.asTypeOf- , Prelude.curry- , Prelude.error- , Prelude.even- , Prelude.fromEnum- , Prelude.fromIntegral- , Prelude.fst- , Prelude.gcd- , Prelude.lcm- , Prelude.odd- , Prelude.realToFrac- , Prelude.seq- , Prelude.show- , Prelude.snd- , Prelude.subtract- , Prelude.uncurry- , Prelude.undefined- , (Prelude.$!)- , (Prelude.^)- , (Prelude.^^)- , System.Exit.ExitCode(..)- , Text.Read.Read- , Text.Read.readMaybe- -- * Primitive- , PrimMonad (..)- -- * Unbox- , Unbox+ ( module RIO.Prelude+ , module RIO.Prelude.Types+ , module UnliftIO+ , module UnliftIO.Concurrent ) where -import Control.Applicative (Applicative)-import Control.Monad (Monad (..), liftM, (<=<))-import Control.Monad.Catch (MonadThrow)-import Control.Monad.Primitive (PrimMonad (..))-import Control.Monad.Reader (MonadReader, ReaderT (..), ask, asks)-import Control.Monad.State (MonadState(..))-import Control.Monad.Writer (MonadWriter (..))-import Data.Bool (otherwise)-import Data.ByteString (ByteString)-import Data.ByteString.Builder (Builder)-import Data.Either (Either (..))-import Data.Foldable (foldMap)-import Data.Function (flip, ($), (.))-import Data.Functor (Functor (..))-import Data.Int (Int)-import Data.Maybe (Maybe, catMaybes, fromMaybe)-import Data.Monoid (Monoid (..))-import Data.Ord (Ord)-import Data.Semigroup (Semigroup (..))-import Data.String (IsString (..))-import Data.Text (Text)-import Data.Text.Encoding (decodeUtf8', decodeUtf8With,- encodeUtf8, encodeUtf8Builder)-import Data.Text.Encoding.Error (UnicodeException, lenientDecode)-import Data.Traversable (Traversable (..))-import Prelude (FilePath, IO, Show (..))-import UnliftIO-import qualified UnliftIO.Concurrent--import Data.Vector.Unboxed.Mutable (Unbox)------- Reexports-import qualified Control.Applicative-import qualified Control.Arrow-import qualified Control.Category-import qualified Control.DeepSeq-import qualified Control.Monad-import qualified Control.Monad.Catch-import qualified Control.Monad.Reader-import qualified Data.Bool-import qualified Data.ByteString.Short-import qualified Data.Char-import qualified Data.Data-import qualified Data.Either-import qualified Data.Eq-import qualified Data.Foldable-import qualified Data.Function-import qualified Data.Functor-import qualified Data.Functor.Const-import qualified Data.Functor.Identity-import qualified Data.Hashable-import qualified Data.HashMap.Strict-import qualified Data.HashSet-import qualified Data.Int-import qualified Data.IntMap.Strict-import qualified Data.IntSet-import qualified Data.List-import qualified Data.Map.Strict-import qualified Data.Maybe-import qualified Data.Ord-import qualified Data.Proxy-import qualified Data.Set-import qualified Data.Text.Encoding.Error-import qualified Data.Traversable-import qualified Data.Vector-import qualified Data.Void-import qualified Data.Word-import qualified Foreign.Storable-import qualified GHC.Generics-import qualified GHC.Stack-import qualified Numeric.Natural-import qualified Prelude-import qualified System.Exit-import qualified Text.Read--yieldThread :: MonadIO m => m ()-yieldThread = UnliftIO.Concurrent.yield-{-# INLINE yieldThread #-}--#if !MIN_VERSION_base(4, 11, 0)-(<&>) :: Functor f => f a -> (a -> b) -> f b-as <&> f = f Data.Functor.<$> as--infixl 1 <&>-#endif+import RIO.Prelude+import RIO.Prelude.Types+import UnliftIO+import UnliftIO.Concurrent
src/RIO/Prelude/Renames.hs view
@@ -8,17 +8,21 @@ , GVector , toStrictBytes , fromStrictBytes+ , yieldThread ) where -import RIO.Prelude.Reexports+import Prelude+import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified Data.Vector.Generic as GVector import qualified Data.Vector.Storable as SVector import qualified Data.Vector.Unboxed as UVector import qualified Data.Text.Lazy as TL import qualified Data.Semigroup+import UnliftIO (MonadIO)+import qualified UnliftIO.Concurrent (yield) -sappend :: Semigroup s => s -> s -> s+sappend :: Data.Semigroup.Semigroup s => s -> s -> s sappend = (Data.Semigroup.<>) type UVector = UVector.Vector@@ -28,8 +32,12 @@ type LByteString = BL.ByteString type LText = TL.Text -toStrictBytes :: LByteString -> ByteString+toStrictBytes :: LByteString -> B.ByteString toStrictBytes = BL.toStrict -fromStrictBytes :: ByteString -> LByteString+fromStrictBytes :: B.ByteString -> LByteString fromStrictBytes = BL.fromStrict++yieldThread :: MonadIO m => m ()+yieldThread = UnliftIO.Concurrent.yield+{-# INLINE yieldThread #-}
src/RIO/Prelude/Text.hs view
@@ -1,16 +1,15 @@-{-# LANGUAGE OverloadedStrings #-} module RIO.Prelude.Text ( decodeUtf8Lenient , tshow ) where +import Data.ByteString (ByteString) import qualified Data.Text as T import Data.Text.Encoding (decodeUtf8With)-import RIO.Prelude.Reexports import Data.Text.Encoding.Error (lenientDecode) -tshow :: Show a => a -> Text+tshow :: Show a => a -> T.Text tshow = T.pack . show -decodeUtf8Lenient :: ByteString -> Text+decodeUtf8Lenient :: ByteString -> T.Text decodeUtf8Lenient = decodeUtf8With lenientDecode
src/RIO/Prelude/Trace.hs view
@@ -1,5 +1,6 @@ module RIO.Prelude.Trace- ( -- * Text+ ( -- ** Trace+ -- *** Text trace , traceId , traceIO@@ -9,7 +10,7 @@ , traceMarker , traceMarkerIO , traceStack- -- * Show+ -- *** Show , traceShow , traceShowId , traceShowIO@@ -19,7 +20,7 @@ , traceShowMarker , traceShowMarkerIO , traceShowStack- -- * Display+ -- *** Display , traceDisplay , traceDisplayId , traceDisplayIO
+ src/RIO/Prelude/Types.hs view
@@ -0,0 +1,350 @@+module RIO.Prelude.Types+ (+ -- * @base@+ -- ** Types+ -- *** @Bool@+ -- | Re-exported from "Data.Bool":+ Data.Bool.Bool(..)+ -- *** @Char@ (@String@)+ -- | Re-exported from "Data.Char":+ , Data.Char.Char+ -- | Re-exported from "Data.String":+ , Data.String.String+ -- | Re-exported from "System.IO":+ , System.IO.FilePath+ -- *** @Ordering@+ -- | Re-exported from "Data.Ord":+ , Data.Ord.Ordering(..)+ -- *** Numbers+ -- **** @Int@+ -- | Re-exported from "Data.Int":+ , Data.Int.Int+ -- ***** @Int8@+ , Data.Int.Int8+ -- ***** @Int16@+ , Data.Int.Int16+ -- ***** @Int32@+ , Data.Int.Int32+ -- ***** @Int64@+ , Data.Int.Int64+ -- **** @Word@+ -- | Re-exported from "Data.Word":+ , Data.Word.Word+ -- ***** @Word8@+ , Data.Word.Word8+ -- ***** @Word16@+ , Data.Word.Word16+ -- ***** @Word32@+ , Data.Word.Word32+ -- ***** @Word64@+ , Data.Word.Word64+ -- **** @Integer@+ -- | Re-exported from "Prelude.Integer":+ , Prelude.Integer+ -- **** @Natural@+ -- | Re-exported from "Numeric.Natural":+ , Numeric.Natural.Natural+ -- **** @Rational@+ -- | Re-exported from "Data.Ratio":+ , Data.Ratio.Rational+ -- **** @Float@+ -- | Re-exported from "Prelude":+ , Prelude.Float+ -- **** @Double@+ -- | Re-exported from "Prelude":+ , Prelude.Double++ -- *** @Maybe@+ -- | Re-exported from "Data.Maybe":+ , Data.Maybe.Maybe(..)+ -- *** @Either@+ -- | Re-exported from "Data.Either":+ , Data.Either.Either(..)+ -- *** @Proxy@+ -- | Re-exported from "Data.Proxy":+ , Data.Proxy.Proxy(..)+ -- *** @Void@+ -- | Re-exported from "Data.Void":+ , Data.Void.Void+ -- *** @Const@+ -- | Re-exported from "Data.Functor.Const":+ , Data.Functor.Const.Const(..)+ -- *** @Identity@+ -- | Re-exported from "Data.Functor.Identity":+ , Data.Functor.Identity.Identity(..)+ -- *** @IO@+ -- | Re-exported from "System.IO":+ , System.IO.IO+ -- *** @ST@+ -- | Re-exported from "Control.Monad.ST":+ , Control.Monad.ST.ST++ -- ** Type Classes++ -- *** @Eq@+ -- | Re-exported from "Data.Eq":+ , Data.Eq.Eq++ -- *** @Ord@+ -- | Re-exported from "Data.Ord":+ , Data.Ord.Ord++ -- *** @Bounded@+ -- | Re-exported from "Prelude":+ , Prelude.Bounded++ -- *** @Enum@+ -- | Re-exported from "Prelude":+ , Prelude.Enum++ -- *** Strings+ -- **** @Show@+ -- | Re-exported from "Text.Show":+ , Text.Show.Show+ -- **** @Read@+ -- | Re-exported from "Text.Read":+ , Text.Read.Read+ -- **** @IsString@+ -- | Re-exported from "Data.String":+ , Data.String.IsString++ -- *** Numeric+ -- | All numeric classes are re-exported from "Prelude":++ -- **** @Num@+ , Prelude.Num+ -- **** @Fractional@+ , Prelude.Fractional+ -- **** @Floating@+ , Prelude.Floating+ -- **** @Real@+ , Prelude.Real+ -- **** @Integral@+ , Prelude.Integral+ -- **** @RealFrac@+ , Prelude.RealFrac+ -- **** @RealFloat@+ , Prelude.RealFloat++ -- *** Categories+ -- **** @Functor@+ -- | Re-exported from "Data.Functor":+ , Data.Functor.Functor+ -- **** @Foldable@+ -- | Re-exported from "Data.Foldable":+ , Data.Foldable.Foldable+ -- **** @Semigroup@+ -- | Re-exported from "Data.Semigroup":+ , Data.Semigroup.Semigroup+ -- **** @Monoid@+ -- | Re-exported from "Data.Monoid":+ , Data.Monoid.Monoid+ -- **** @Applicative@+ -- | Re-exported from "Control.Applicative":+ , Control.Applicative.Applicative+ -- **** @Alternative@+ -- | Re-exported from "Control.Applicative":+ , Control.Applicative.Alternative+ -- **** @Traversable@+ -- | Re-exported from "Data.Traversable":+ , Data.Traversable.Traversable+ -- **** @Monad@+ -- | Re-exported from "Control.Monad":+ , Control.Monad.Monad+ -- **** @MonadPlus@+ -- | Re-exported from "Control.Monad":+ , Control.Monad.MonadPlus+ -- **** @Category@+ -- | Re-exported from "Control.Category":+ , Control.Category.Category+ -- **** @Arrow@+ -- | Re-exported from "Control.Arrow":+ , Control.Arrow.Arrow+ -- **** @MonadFail@+ -- | Re-exported from "Control.Monad.Fail":+ , Control.Monad.Fail.MonadFail++ -- *** Data+ -- **** @Typeable@+ -- | Re-exported from "Control.Monad":+ , Data.Typeable.Typeable+ -- **** @Data@+ -- | Re-exported from "Data.Data":+ , Data.Data.Data+ -- **** @Generic@+ -- | Re-exported from "GHC.Generics":+ , GHC.Generics.Generic+ -- **** @Storable@+ -- | Re-exported from "Foreign.Storable":+ , Foreign.Storable.Storable++ -- *** Exceptions+ -- *** @Exception@+ -- | Re-exported from "Control.Exception.Base":+ , Control.Exception.Base.Exception+ -- **** @HasCallStack@+ -- | Re-exported from "GHC.Stack":+ , GHC.Stack.HasCallStack+++ -- * @deepseq@+ -- ** @NFData@+ -- | Re-exported from "Control.DeepSeq":+ , Control.DeepSeq.NFData++ -- * @mtl@+ -- ** @MonadTrans@+ -- | Re-exported from "Control.Monad.Reader":+ , Control.Monad.Reader.MonadTrans+ -- ** @MonadReader@+ , Control.Monad.Reader.MonadReader+ -- ** @ReaderT@ (@Reader@)+ -- | Re-exported from "Control.Monad.Reader":+ , Control.Monad.Reader.Reader+ , Control.Monad.Reader.ReaderT(ReaderT)++ -- * @exceptions@+ -- ** @MonadThrow@+ -- | Re-exported from "Control.Monad.Catch":+ , Control.Monad.Catch.MonadThrow++ -- * @bytestring@+ -- ** @ByteString@+ -- | Re-exported from "Data.ByteString":+ , Data.ByteString.ByteString+ -- ** @LByteString@+ -- | A synonym for lazy `Data.ByteString.Lazy.ByteString` re-exported from "Data.ByteString.Lazy":+ , RIO.Prelude.Renames.LByteString+ -- ** @Builder@+ -- | Re-exported from "Data.ByteString.Builder":+ , Data.ByteString.Builder.Builder+ -- ** @ShortByteString@+ -- | Re-exported from "Data.ByteString.Short":+ , Data.ByteString.Short.ShortByteString++ -- * @text@+ -- ** @Text@+ -- | Re-exported from "Data.Text":+ , Data.Text.Text+ -- ** @LText@+ -- | A synonym for lazy `Data.Text.Lazy.Text` re-exported from "Data.Text.Lazy":+ , RIO.Prelude.Renames.LText+ -- ** @UncodeException@+ -- | Re-exported from "Data.Text.Encoding.Error":+ , Data.Text.Encoding.Error.UnicodeException(..)++ -- * @vector@+ -- ** @Vector@+ -- | Boxed vector re-exported from "Data.Vector":+ , Data.Vector.Vector+ -- ** @UVector@+ -- | A synonym for unboxed `Data.Vector.Unboxed.Vector` re-exported from "Data.Vector.Unboxed":+ , RIO.Prelude.Renames.UVector+ -- *** @Unbox@+ , Data.Vector.Unboxed.Unbox+ -- ** @SVector@+ -- | A synonym for storable `Data.Vector.Storable.Vector` re-exported from "Data.Vector.Storable":+ , RIO.Prelude.Renames.SVector+ -- ** @GVector@+ -- | A synonym for generic `Data.Vector.Generic.Vector` re-exported from "Data.Vector.Generic":+ , RIO.Prelude.Renames.GVector++ -- * @containers@+ -- ** @IntMap@+ -- | Re-exported from "Data.IntMap.Strict":+ , Data.IntMap.Strict.IntMap+ -- ** @Map@+ -- | Re-exported from "Data.Map.Strict":+ , Data.Map.Strict.Map+ -- ** @IntSet@+ -- | Re-exported from "Data.IntSet":+ , Data.IntSet.IntSet+ -- ** @Set@+ -- | Re-exported from "Data.Set":+ , Data.Set.Set+ -- ** @Seq@+ -- | Re-exported from "Data.Seq":+ , Data.Sequence.Seq++ -- * @hashable@+ -- ** @Hashable@+ , Data.Hashable.Hashable++ -- * @unordered-containers@+ -- ** @HashMap@+ -- | Re-exported from "Data.HashMap.Strict":+ , Data.HashMap.Strict.HashMap+ -- ** @HashSet@+ -- | Re-exported from "Data.HashSet":+ , Data.HashSet.HashSet++ -- * @primitive@+ -- ** @PrimMonad@+ -- | Re-exported from "Control.Monad.Primitive":+ , Control.Monad.Primitive.PrimMonad (PrimState)+ ) where++import qualified Control.Monad.Primitive (PrimMonad(..))+import qualified Data.ByteString (ByteString)+import qualified Data.ByteString.Builder (Builder)+import qualified Data.Monoid (Monoid)+import qualified Data.Semigroup (Semigroup)+import qualified Data.String (IsString, String)+import qualified Data.Text (Text)+import qualified Data.Typeable+import qualified System.IO++import qualified Data.Vector.Unboxed (Unbox)+import qualified RIO.Prelude.Renames++import qualified Control.Applicative+import qualified Control.Arrow+import qualified Control.Category+import qualified Control.DeepSeq+import qualified Control.Exception.Base+import qualified Control.Monad+import qualified Control.Monad.Catch+import qualified Control.Monad.Fail+import qualified Control.Monad.Reader+import qualified Control.Monad.ST+import qualified Data.Bool+import qualified Data.ByteString.Short+import qualified Data.Char+import qualified Data.Data+import qualified Data.Either+import qualified Data.Eq+import qualified Data.Foldable+import qualified Data.Function+import qualified Data.Functor+import qualified Data.Functor.Const+import qualified Data.Functor.Identity+import qualified Data.Hashable+import qualified Data.HashMap.Strict+import qualified Data.HashSet+import qualified Data.Int+import qualified Data.IntMap.Strict+import qualified Data.IntSet+import qualified Data.List+import qualified Data.Map.Strict+import qualified Data.Maybe+import qualified Data.Ord+import qualified Data.Proxy+import qualified Data.Ratio+import qualified Data.Sequence+import qualified Data.Set+import qualified Data.Text.Encoding.Error+import qualified Data.Traversable+import qualified Data.Vector+import qualified Data.Void+import qualified Data.Word+import qualified Foreign.Storable+import qualified GHC.Generics+import qualified GHC.Stack+import qualified Numeric.Natural+import qualified Prelude+import qualified System.Exit+import qualified Text.Read+import qualified Text.Show++-- Bring instances for some of the unliftio types in scope, so they can be documented here.+import UnliftIO ()
src/RIO/Prelude/URef.hs view
@@ -1,7 +1,5 @@ module RIO.Prelude.URef- ( -- * Unboxed references- Unbox- , URef+ ( URef , IOURef , newURef , readURef
src/RIO/State.hs view
@@ -7,6 +7,17 @@ , Control.Monad.State.gets , Control.Monad.State.modify , Control.Monad.State.modify'+ , Control.Monad.State.State+ , Control.Monad.State.runState+ , Control.Monad.State.evalState+ , Control.Monad.State.execState+ , Control.Monad.State.mapState+ , Control.Monad.State.withState+ , Control.Monad.State.StateT (..)+ , Control.Monad.State.evalStateT+ , Control.Monad.State.execStateT+ , Control.Monad.State.mapStateT+ , Control.Monad.State.withStateT ) where import qualified Control.Monad.State
src/RIO/Writer.hs view
@@ -4,6 +4,15 @@ module RIO.Writer ( Control.Monad.Writer.MonadWriter (..)+ , Control.Monad.Writer.listens+ , Control.Monad.Writer.censor+ , Control.Monad.Writer.Writer+ , Control.Monad.Writer.runWriter+ , Control.Monad.Writer.execWriter+ , Control.Monad.Writer.mapWriter+ , Control.Monad.Writer.WriterT (..)+ , Control.Monad.Writer.execWriterT+ , Control.Monad.Writer.mapWriterT ) where import qualified Control.Monad.Writer
+ test/RIO/DequeSpec.hs view
@@ -0,0 +1,127 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ScopedTypeVariables #-}+module RIO.DequeSpec (spec) where++import RIO+import Test.Hspec+import Test.Hspec.QuickCheck+import Test.QuickCheck.Arbitrary+import Test.QuickCheck.Gen+import qualified Data.Vector as VB+import qualified Data.Vector.Generic as VG+import qualified Data.Vector.Unboxed as VU+import qualified Data.Vector.Storable as VS+import qualified Data.Vector.Generic.Mutable as V++data DequeAction+ = PushFront Int+ | PushBack Int+ | PopFront+ | PopBack+ deriving Show+instance Arbitrary DequeAction where+ arbitrary = oneof $ concat+ [ replicate 25 $ fmap PushFront arbitrary+ , replicate 25 $ fmap PushBack arbitrary+ , [return PopFront, return PopBack]+ ]++manyPushes :: [DequeAction]+manyPushes = concat+ [ replicate 50 $ PushBack 0+ , replicate 50 PopFront+ , replicate 50 $ PushFront 0+ , replicate 50 PopBack+ ]++specialCase :: [DequeAction]+specialCase =+ [PushBack 9, PushBack 5,PushBack 11,PushBack 2,PushBack 13,PushBack 10,PushBack 4,PushBack 13,PushBack 7,PushBack 8,PushBack 6,PushBack 4,PushBack 7,PushBack 9,PushBack 10,PushBack 3,PushBack 2,PushBack 12,PushBack 12 ,PushBack 6,PushBack 3,PushBack 5,PushBack 14,PushBack 14,PushBack 11,PushBack 8,PopFront,PopFront,PopFront,PushBack 11,PushBack 3,PopFront,PopFront,PushBack 13,PushBack 12,PopFront,PushBack 10,PushBack 7,PopFront,PopFront,PushBack 13,PushBack 9,PopFront,PushBack 7,PushBack 2,PopFront,PopFront,PushBack 6,PushBack 4,PopFront,PopFront,PopFront,PushBack 9,PushBack 3,PopFront,PushBack 10,PushBack 6,PopFront,PopFront,PopFront,PushBack 12,PushBack 5,PopFront,PushBack 12,PushBack 5,PopFront,PushBack 6,PushBack 4,PopFront,PopFront,PopFront,PushBack 14,PushBack 10,PopFront,PushBack 14,PushBack 10,PopFront,PushBack 11,PushBack 8,PopFront,PushBack 8,PushBack 2,PopFront,PopFront,PopFront,PushBack 13,PushBack 7,PopFront,PushBack 12,PushBack 5,PopFront,PushBack 10,PushBack 8, PopFront,PushBack 7,PushBack 2,PopFront,PopFront,PushBack 9,PushBack 4,PopFront,PopFront,PopFront,PopFront,PopFront,PopFront,PopFront,PopFront,PushBack 4,PushBack 9,PushBack 3,PushBack 10,PushBack 6,PushBack 4,PushBack 13,PushBack 7,PushBack 9,PushBack 3,PopFront]++spec :: Spec+spec = do+ let runActions+ :: forall v . (VG.Vector v Int, Show (v Int), Eq (v Int))+ => Proxy v+ -> [DequeAction]+ -> IO ()+ runActions proxy actions = do+ base <- newIORef [] :: IO (IORef [Int])+ tested <- newDeque :: IO (Deque (VG.Mutable v) (PrimState IO) Int)+ for_ (PopFront : PopBack : actions) $ \action -> do+ case action of+ PushFront i -> do+ pushFrontRef base i+ pushFrontDeque tested i+ same proxy base tested+ PushBack i -> do+ pushBackRef base i+ pushBackDeque tested i+ same proxy base tested+ PopFront -> do+ expected <- popFrontRef base+ actual <- popFrontDeque tested+ actual `shouldBe` expected+ same proxy base tested+ PopBack -> do+ expected <- popBackRef base+ actual <- popBackDeque tested+ actual `shouldBe` expected+ same proxy base tested+ let drain = do+ expected <- popBackRef base+ actual <- popBackDeque tested+ actual `shouldBe` expected+ case actual of+ Just _ -> drain+ Nothing -> return $! ()+ drain+ test name proxy = describe name $ do+ prop "arbitrary actions" $ runActions proxy+ it "many pushes" $ runActions proxy manyPushes+ it "special case" $ runActions proxy specialCase++ test "UDeque" (Proxy :: Proxy VU.Vector)+ test "SDeque" (Proxy :: Proxy VS.Vector)+ test "BDeque" (Proxy :: Proxy VB.Vector)++pushFrontRef :: IORef [Int] -> Int -> IO ()+pushFrontRef ref i = modifyIORef ref (i:)++pushBackRef :: IORef [Int] -> Int -> IO ()+pushBackRef ref i = modifyIORef ref (++ [i])++popFrontRef :: IORef [Int] -> IO (Maybe Int)+popFrontRef ref = do+ is <- readIORef ref+ case is of+ i:is' -> do+ writeIORef ref is'+ pure $ Just i+ [] -> pure Nothing++popBackRef :: IORef [Int] -> IO (Maybe Int)+popBackRef ref = do+ is <- readIORef ref+ case reverse is of+ i:is' -> do+ writeIORef ref $ reverse is'+ pure $ Just i+ [] -> pure Nothing++same ::+ forall v. (Show (v Int), Eq (v Int), VG.Vector v Int)+ => Proxy v+ -> IORef [Int]+ -> Deque (VG.Mutable v) (PrimState IO) Int+ -> IO ()+same proxy ref deque = do+ fromRef <- readIORef ref+ fromRight <- foldrDeque (\i rest -> pure $ i : rest) [] deque+ fromRight `shouldBe` fromRef+ fromLeft <- foldlDeque (\rest i -> pure $ i : rest) [] deque+ fromLeft `shouldBe` reverse fromRef+ dequeToList deque `shouldReturn` fromRef+ dequeToVector deque `shouldReturn` (VU.fromList fromRef :: VU.Vector Int)+ uv :: v Int <- freezeDeque deque+ uv `shouldBe` VG.fromList fromRef
test/RIO/Prelude/RIOSpec.hs view
@@ -7,8 +7,8 @@ import RIO.State import RIO.Writer import Test.Hspec-import Test.Hspec.QuickCheck +spec :: Spec spec = do describe "RIO writer instance" $ do it "tell works" $ do@@ -30,7 +30,7 @@ it "pass works" $ do ref <- newSomeRef (mempty :: Text)- result <- runRIO ref $ pass $ do+ () <- runRIO ref $ pass $ do tell "hello\n" tell "world\n" return ((), \a -> a <> "!")@@ -48,7 +48,7 @@ it "state works" $ do ref <- newSomeRef (mempty :: Text)- newRef <- newSomeRef ("Hello World!" :: Text)- result <- runRIO ref $ state (\ref -> ((), "Hello World!"))+ _newRef <- newSomeRef ("Hello World!" :: Text)+ () <- runRIO ref $ state (\_ -> ((), "Hello World!")) contents <- readSomeRef ref contents `shouldBe` "Hello World!"