Hoogle Search

Within LTS Haskell 24.3 (ghc-9.10.2)

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

  1. (!!) :: Stream a -> Int -> a

    Stream Data.Stream

    xs !! n returns the element of the stream xs at index n. Note that the head of the stream has index 0. Beware: passing a negative integer as the first argument will cause an error.

  2. (!!) :: HasCallStack => [a] -> Int -> a

    cabal-install-solver Distribution.Solver.Compat.Prelude

    List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type. WARNING: This function is partial, and should only be used if you are sure that the indexing will not fail. Otherwise, use !?. WARNING: This function takes linear time in the index.

    Examples

    >>> ['a', 'b', 'c'] !! 0
    'a'
    
    >>> ['a', 'b', 'c'] !! 2
    'c'
    
    >>> ['a', 'b', 'c'] !! 3
    *** Exception: Prelude.!!: index too large
    
    >>> ['a', 'b', 'c'] !! (-1)
    *** Exception: Prelude.!!: negative index
    

  3. (!!) :: SymVal a => SList a -> SInteger -> SBV a

    sbv Data.SBV.List

    Short cut for elemAt

  4. (!!) :: SString -> SInteger -> SChar

    sbv Data.SBV.String

    Short cut for strToCharAt

  5. (!!) :: Monad m => Stream m a -> Int -> m (Maybe a)

    streamly-core Streamly.Internal.Data.Stream

    No documentation available.

  6. (!!) :: Monad m => StreamK m a -> Int -> m (Maybe a)

    streamly-core Streamly.Internal.Data.StreamK

    No documentation available.

  7. (!!) :: (HasCallStack, Monad m) => Stream m a -> Int -> m a

    vector-stream Data.Stream.Monadic

    Element at the given position

  8. (!!) :: HasCallStack => [a] -> Int -> a

    Agda Agda.Utils.List

    A variant of !! that might provide more informative error messages if the index is out of bounds. Precondition: The index should not be out of bounds.

  9. (!!) :: HasCallStack => NonEmpty a -> Int -> a

    Agda Agda.Utils.List1

    xs !! n returns the element of the stream xs at index n. Note that the head of the stream has index 0. Beware: a negative or out-of-bounds index will cause an error.

  10. (!!) :: forall (n :: Nat) i a . (KnownNat n, Enum i) => Vec n a -> i -> a

    clash-prelude Clash.Explicit.Prelude

    "xs !! n" returns the n'th element of xs. NB: Vector elements have an ASCENDING subscript starting from 0 and ending at length - 1.

    >>> (1:>2:>3:>4:>5:>Nil) !! 4
    5
    
    >>> (1:>2:>3:>4:>5:>Nil) !! (length (1:>2:>3:>4:>5:>Nil) - 1)
    5
    
    >>> (1:>2:>3:>4:>5:>Nil) !! 1
    2
    
    >>> (1:>2:>3:>4:>5:>Nil) !! 14
    *** Exception: Clash.Sized.Vector.(!!): index 14 is larger than maximum index 4
    ...
    

Page 5 of many | Previous | Next