Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- rep :: Monad m => Int -> (Int -> m ()) -> m ()
- rep1 :: Monad m => Int -> (Int -> m ()) -> m ()
- rev :: Monad m => Int -> (Int -> m ()) -> m ()
- rev1 :: Monad m => Int -> (Int -> m ()) -> m ()
- (..<) :: Monad m => Int -> Int -> Stream m Int
- (>..) :: Monad m => Int -> Int -> Stream m Int
- stride :: Monad m => Int -> Int -> Int -> Stream m Int
- liftMS :: Monad m => Stream Id a -> Stream m a
- asUVector :: Vector a -> Vector a
- asBVector :: Vector a -> Vector a
- lowerBound :: (Ord a, Vector v a) => v a -> a -> Int
- upperBound :: (Ord a, Vector v a) => v a -> a -> Int
- radixSort :: Vector Int -> Vector Int
- runLengthEncode :: (Eq a, Vector v a, Vector v (a, Int)) => v a -> v (a, Int)
- streamRLE :: (Eq a, Monad m) => Stream m a -> Stream m (a, Int)
- forAccum :: (Vector v a, Vector v b) => s -> v a -> (s -> a -> (s, b)) -> v b
- mapAccum :: (Vector v a, Vector v b) => (s -> a -> (s, b)) -> s -> v a -> v b
- forAccumM :: (PrimMonad m, Vector v a, Vector v b) => s -> v a -> (s -> a -> m (s, b)) -> m (v b)
- forAccumM_ :: (Monad m, Vector v b) => a -> v b -> (a -> b -> m a) -> m ()
- mapAccumM :: (PrimMonad m, Vector v a, Vector v b) => (s -> a -> m (s, b)) -> s -> v a -> m (v b)
- forAccumMaybe :: (Vector v a, Vector v b) => s -> v a -> (s -> a -> (s, Maybe b)) -> v b
- mapAccumMaybe :: (Vector v a, Vector v b) => (s -> a -> (s, Maybe b)) -> s -> v a -> v b
- forAccumMaybeM :: (PrimMonad m, Vector v a, Vector v b) => s -> v a -> (s -> a -> m (s, Maybe b)) -> m (v b)
- mapAccumMaybeM :: (PrimMonad m, Vector v a, Vector v b) => (s -> a -> m (s, Maybe b)) -> s -> v a -> m (v b)
- bundleAccumM :: Monad m => (s -> a -> m (s, b)) -> s -> Bundle m v a -> Bundle m v b
- bundleAccumMaybeM :: Monad m => (s -> a -> m (s, Maybe b)) -> s -> Bundle m v a -> Bundle m v b
- streamAccumM :: Monad m => (s -> a -> m (s, b)) -> s -> Stream m a -> Stream m b
- streamAccumMaybeM :: Monad m => (s -> a -> m (s, Maybe b)) -> s -> Stream m a -> Stream m b
- stream :: Vector v a => v a -> Stream Id a
- streamM :: (Vector v a, Monad m) => v a -> Stream m a
- unstream :: Vector v a => Int -> Stream Id a -> v a
- unstreamM :: (PrimMonad m, Vector v a) => Int -> Stream m a -> m (v a)
- shiftRL :: Int -> Int -> Int
- unsafeShiftRL :: Int -> Int -> Int
- (!>>>.) :: Int -> Int -> Int
- uvectorN :: Unbox a => Int -> PrimParser a -> PrimParser (Vector a)
- bvectorN :: Int -> PrimParser a -> PrimParser (Vector a)
- gvectorN :: Vector v a => Int -> PrimParser a -> PrimParser (v a)
- streamN :: Int -> PrimParser a -> PrimParser (Stream Id a)
- uvector :: Unbox a => PrimParser a -> PrimParser (Vector a)
- gvector :: Vector v a => PrimParser a -> PrimParser (v a)
- byteArrayN :: Int -> PrimParser ByteArray
- byteArrayHW :: Int -> Int -> PrimParser ByteArray
- unlinesB :: Vector v a => (a -> Builder) -> v a -> Builder
- unwordsB :: Vector v a => (a -> Builder) -> v a -> Builder
- concatB :: Vector v a => (a -> Builder) -> v a -> Builder
- matrixB :: Vector v a => Int -> Int -> (a -> Builder) -> v a -> Builder
- gridB :: Vector v a => Int -> Int -> (a -> Builder) -> v a -> Builder
- sizedB :: Vector v a => (v a -> Builder) -> v a -> Builder
- yesnoB :: Bool -> Builder
- pairB :: (a -> Builder) -> (b -> Builder) -> (a, b) -> Builder
- showB :: Show a => a -> Builder
- showLnB :: Show a => a -> Builder
- lfB :: Builder
- spB :: Builder
- putBuilder :: MonadIO m => Builder -> m ()
- putBuilderLn :: MonadIO m => Builder -> m ()
- neighbor4 :: Applicative f => Int -> Int -> Int -> (Int -> f ()) -> f ()
- binarySearchM :: Monad m => Int -> Int -> (Int -> m Bool) -> m Int
- binarySearch :: Int -> Int -> (Int -> Bool) -> Int
- encode32x2 :: Int -> Int -> Int
- decode32x2 :: Int -> (Int, Int)
- runSolver :: (a -> IO ()) -> PrimParser a -> IO ()
Stream utils
(..<) :: Monad m => Int -> Int -> Stream m Int infix 4 Source #
>>>
runIdentity $ MS.toList (0..<5)
[0,1,2,3,4]
(>..) :: Monad m => Int -> Int -> Stream m Int infix 4 Source #
>>>
runIdentity $ MS.toList (5>..0)
[4,3,2,1,0]
stride :: Monad m => Int -> Int -> Int -> Stream m Int Source #
>>>
runIdentity $ MS.toList (stride 0 10 3)
[0,3,6,9]
Vector utils
lowerBound :: (Ord a, Vector v a) => v a -> a -> Int Source #
>>>
lowerBound (U.fromList "122333") '2'
1>>>
lowerBound (U.fromList "122333") '0'
0>>>
lowerBound (U.fromList "122333") '9'
6
upperBound :: (Ord a, Vector v a) => v a -> a -> Int Source #
>>>
upperBound (U.fromList "122333") '2'
3>>>
upperBound (U.fromList "122333") '0'
0>>>
upperBound (U.fromList "122333") '9'
6
radixSort :: Vector Int -> Vector Int Source #
>>>
radixSort $ U.fromList [3,1,4,1,5,9]
[1,1,3,4,5,9]>>>
radixSort $ U.fromList [-3,-1,-4,1,5,9]
[1,5,9,-4,-3,-1]
runLengthEncode :: (Eq a, Vector v a, Vector v (a, Int)) => v a -> v (a, Int) Source #
>>>
runLengthEncode $ U.fromList "abbccc"
[('a',1),('b',2),('c',3)]>>>
runLengthEncode $ U.fromList ""
[]
forAccum :: (Vector v a, Vector v b) => s -> v a -> (s -> a -> (s, b)) -> v b Source #
>>>
forAccum (0 :: Int) (U.fromList "abc") $ \acc c -> (acc + 1, (acc, c))
[(0,'a'),(1,'b'),(2,'c')]
forAccumM :: (PrimMonad m, Vector v a, Vector v b) => s -> v a -> (s -> a -> m (s, b)) -> m (v b) Source #
forAccumM_ :: (Monad m, Vector v b) => a -> v b -> (a -> b -> m a) -> m () Source #
mapAccumM :: (PrimMonad m, Vector v a, Vector v b) => (s -> a -> m (s, b)) -> s -> v a -> m (v b) Source #
forAccumMaybe :: (Vector v a, Vector v b) => s -> v a -> (s -> a -> (s, Maybe b)) -> v b Source #
mapAccumMaybe :: (Vector v a, Vector v b) => (s -> a -> (s, Maybe b)) -> s -> v a -> v b Source #
forAccumMaybeM :: (PrimMonad m, Vector v a, Vector v b) => s -> v a -> (s -> a -> m (s, Maybe b)) -> m (v b) Source #
mapAccumMaybeM :: (PrimMonad m, Vector v a, Vector v b) => (s -> a -> m (s, Maybe b)) -> s -> v a -> m (v b) Source #
bundleAccumM :: Monad m => (s -> a -> m (s, b)) -> s -> Bundle m v a -> Bundle m v b Source #
bundleAccumMaybeM :: Monad m => (s -> a -> m (s, Maybe b)) -> s -> Bundle m v a -> Bundle m v b Source #
streamAccumM :: Monad m => (s -> a -> m (s, b)) -> s -> Stream m a -> Stream m b Source #
streamAccumMaybeM :: Monad m => (s -> a -> m (s, Maybe b)) -> s -> Stream m a -> Stream m b Source #
unstream :: Vector v a => Int -> Stream Id a -> v a Source #
>>>
asUVector . unstream 10 . stream $ U.fromList "abc"
"abc"
Bits utils
unsafeShiftRL :: Int -> Int -> Int infixl 8 Source #
>>>
unsafeShiftR (-1) 1
-1>>>
unsafeShiftRL (-1) 1
9223372036854775807
Parser utils
uvectorN :: Unbox a => Int -> PrimParser a -> PrimParser (Vector a) Source #
bvectorN :: Int -> PrimParser a -> PrimParser (Vector a) Source #
gvectorN :: Vector v a => Int -> PrimParser a -> PrimParser (v a) Source #
streamN :: Int -> PrimParser a -> PrimParser (Stream Id a) Source #
uvector :: Unbox a => PrimParser a -> PrimParser (Vector a) Source #
gvector :: Vector v a => PrimParser a -> PrimParser (v a) Source #
byteArrayN :: Int -> PrimParser ByteArray Source #
byteArrayHW :: Int -> Int -> PrimParser ByteArray Source #
Builder utils
matrixB :: Vector v a => Int -> Int -> (a -> Builder) -> v a -> Builder Source #
>>>
matrixB 2 3 B.intDec $ U.fromListN 6 [1, 2, 3, 4, 5, 6]
"1 2 3\n4 5 6\n"
gridB :: Vector v a => Int -> Int -> (a -> Builder) -> v a -> Builder Source #
>>>
gridB 2 3 B.char7 $ U.fromListN 6 ".#.#.#"
".#.\n#.#\n">>>
gridB 2 3 B.intDec $ U.fromListN 6 [1, 2, 3, 4, 5, 6]
"123\n456\n"
pairB :: (a -> Builder) -> (b -> Builder) -> (a, b) -> Builder Source #
>>>
pairB B.intDec B.intDec $ (0, 1)
"0 1">>>
pairB B.intDec (pairB B.intDec B.intDec) $ (0, (1, 2))
"0 1 2"
putBuilder :: MonadIO m => Builder -> m () Source #
putBuilderLn :: MonadIO m => Builder -> m () Source #