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.
-
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.
(
!! ) :: HasCallStack => [a] -> Int -> acabal-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
(
!! ) :: SymVal a => SList a -> SInteger -> SBV asbv Data.SBV.List Short cut for elemAt
(
!! ) :: SString -> SInteger -> SCharsbv Data.SBV.String Short cut for strToCharAt
(
!! ) :: Monad m => Stream m a -> Int -> m (Maybe a)streamly-core Streamly.Internal.Data.Stream No documentation available.
(
!! ) :: Monad m => StreamK m a -> Int -> m (Maybe a)streamly-core Streamly.Internal.Data.StreamK No documentation available.
(
!! ) :: (HasCallStack, Monad m) => Stream m a -> Int -> m avector-stream Data.Stream.Monadic Element at the given position
(
!! ) :: HasCallStack => [a] -> Int -> aAgda 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.
(
!! ) :: HasCallStack => NonEmpty a -> Int -> aAgda 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.
(
!! ) :: forall (n :: Nat) i a . (KnownNat n, Enum i) => Vec n a -> i -> aclash-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 ...