Hoogle Search

Within LTS Haskell 24.51 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. freezeDeque :: (Vector v a, PrimMonad m) => Deque (Mutable v) (PrimState m) a -> m (v a)

    rio RIO.Deque

    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]
    

  2. getDequeSize :: forall m (v :: Type -> Type -> Type) a . PrimMonad m => Deque v (PrimState m) a -> m Int

    rio RIO.Deque

    O(1) - Get the number of elements that is currently in the Deque

  3. newDeque :: forall (v :: Type -> Type -> Type) a m . (MVector v a, PrimMonad m) => m (Deque v (PrimState m) a)

    rio RIO.Deque

    Create a new, empty Deque

  4. popBackDeque :: forall (v :: Type -> Type -> Type) a m . (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a)

    rio RIO.Deque

    Pop the first value from the end of the Deque

  5. popFrontDeque :: forall (v :: Type -> Type -> Type) a m . (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a)

    rio RIO.Deque

    Pop the first value from the beginning of the Deque

  6. pushBackDeque :: forall (v :: Type -> Type -> Type) a m . (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m ()

    rio RIO.Deque

    Push a new value to the end of the Deque

  7. pushFrontDeque :: forall (v :: Type -> Type -> Type) a m . (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m ()

    rio RIO.Deque

    Push a new value to the beginning of the Deque

  8. isSubsequenceOf :: Eq a => [a] -> [a] -> Bool

    rio RIO.List

    The isSubsequenceOf function takes two lists and returns True if all the elements of the first list occur, in order, in the second. The elements do not have to occur consecutively. isSubsequenceOf x y is equivalent to x `elem` (subsequences y). Note: isSubsequenceOf is often used in infix form.

    Examples

    >>> "GHC" `isSubsequenceOf` "The Glorious Haskell Compiler"
    True
    
    >>> ['a','d'..'z'] `isSubsequenceOf` ['a'..'z']
    True
    
    >>> [1..10] `isSubsequenceOf` [10,9..0]
    False
    
    For the result to be True, the first list must be finite; for the result to be False, the second list must be finite:
    >>> [0,2..10] `isSubsequenceOf` [0..]
    True
    
    >>> [0..] `isSubsequenceOf` [0,2..10]
    False
    
    >>> [0,2..] `isSubsequenceOf` [0..]
    * Hangs forever*
    

  9. subsequences :: [a] -> [[a]]

    rio RIO.List

    The subsequences function returns the list of all subsequences of the argument.

    Laziness

    subsequences does not look ahead unless it must:
    >>> take 1 (subsequences undefined)
    [[]]
    
    >>> take 2 (subsequences ('a' : undefined))
    ["","a"]
    

    Examples

    >>> subsequences "abc"
    ["","a","b","ab","c","ac","bc","abc"]
    
    This function is productive on infinite inputs:
    >>> take 8 $ subsequences ['a'..]
    ["","a","b","ab","c","ac","bc","abc"]
    

  10. bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b)

    rio RIO.Prelude

    Sequences all the actions in a structure, building a new structure with the same shape using the results of the actions. For a version that ignores the results, see bisequence_.

    bisequencebitraverse id id
    

    Examples

    Basic usage:
    >>> bisequence (Just 4, Nothing)
    Nothing
    
    >>> bisequence (Just 4, Just 5)
    Just (4,5)
    
    >>> bisequence ([1, 2, 3], [4, 5])
    [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
    

Page 275 of many | Previous | Next