Hoogle Search

Within LTS Haskell 24.5 (ghc-9.10.2)

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

  1. last :: IsNonEmpty f a a "last" => f a -> a

    relude Relude.List.NonEmpty

    O(n). Extracts the last element of a NonEmpty list. Actual type of this function is the following:

    last :: NonEmpty a -> a
    
    but it was given a more complex type to provide friendlier compile time errors.
    >>> last ('a' :| "bcde")
    'e'
    
    >>> last [0..5 :: Int]
    ...
    ... 'last' works with 'NonEmpty', not ordinary lists.
    Possible fix:
    Replace: [Int]
    With:    NonEmpty Int
    ...
    However, you can use 'last' with the ordinary lists.
    Apply 'viaNonEmpty' function from relude:
    viaNonEmpty last (yourList)
    Note, that this will return 'Maybe Int'
    therefore it is a safe function unlike 'last' from the standard Prelude
    ...
    
    >>> last (Just 'a')
    ...
    ... 'last' works with 'NonEmpty Char' lists
    But given: Maybe Char
    ...
    

  2. last :: HasCallStack => [a] -> a

    relude Relude.Unsafe

    Extract the last element of a list, which must be finite and non-empty. WARNING: This function is partial. Consider using unsnoc instead.

    Examples

    >>> last [1, 2, 3]
    3
    
    >>> last [1..]
    * Hangs forever *
    
    >>> last []
    *** Exception: Prelude.last: empty list
    

  3. last :: Monad m => Stream (Of a) m r -> m (Of (Maybe a) r)

    streaming Streaming.Prelude

    No documentation available.

  4. last :: YiString -> Maybe Char

    yi-rope Yi.Rope

    Take the last character of the underlying string if possible.

  5. last :: NonEmpty a -> a

    base-compat-batteries Data.List.NonEmpty.Compat

    Extract the last element of the stream.

  6. last :: forall (v :: Type -> Type) (n :: Natural) a . Vector v a => Vector v (n + 1) a -> a

    vector-sized Data.Vector.Generic.Sized

    O(1) Yield the last element of a non-empty vector.

  7. last :: forall (n :: Natural) a . Prim a => Vector (n + 1) a -> a

    vector-sized Data.Vector.Primitive.Sized

    O(1) Yield the last element of a non-empty vector.

  8. last :: forall (n :: Natural) a . Vector (n + 1) a -> a

    vector-sized Data.Vector.Sized

    O(1) Yield the last element of a non-empty vector.

  9. last :: forall (n :: Natural) a . Storable a => Vector (n + 1) a -> a

    vector-sized Data.Vector.Storable.Sized

    O(1) Yield the last element of a non-empty vector.

  10. last :: forall (n :: Natural) a . Unbox a => Vector (n + 1) a -> a

    vector-sized Data.Vector.Unboxed.Sized

    O(1) Yield the last element of a non-empty vector.

Page 10 of many | Previous | Next