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. head :: Storable a => Vector a -> a

    storablevector Data.StorableVector

    O(1) Extract the first element of a Vector, which must be non-empty. It is a checked error to pass an empty Vector.

  2. head :: NonEmpty a -> a

    Cabal-syntax Distribution.Compat.Prelude

    Extract the first element of the stream.

  3. head :: HasCallStack => OsString -> OsChar

    os-string System.OsString

    O(1) Extract the first element of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString. This is a partial function, consider using uncons instead.

  4. head :: HasCallStack => ShortByteString -> Word8

    os-string System.OsString.Data.ByteString.Short

    O(1) Extract the first element of a ShortByteString, which must be non-empty. An exception will be thrown in the case of an empty ShortByteString. This is a partial function, consider using uncons instead.

  5. head :: HasCallStack => ShortByteString -> Word16

    os-string System.OsString.Data.ByteString.Short.Word16

    O(1) Extract the first element of a ShortByteString, which must be at least one Word16. An exception will be thrown in the case of an empty ShortByteString.

  6. head :: HasCallStack => OsString -> OsChar

    os-string System.OsString.Internal

    O(1) Extract the first element of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString. This is a partial function, consider using uncons instead.

  7. head :: HasCallStack => PosixString -> PosixChar

    os-string System.OsString.Posix

    O(1) Extract the first element of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString. This is a partial function, consider using uncons instead.

  8. head :: HasCallStack => WindowsString -> WindowsChar

    os-string System.OsString.Windows

    O(1) Extract the first element of a OsString, which must be non-empty. An exception will be thrown in the case of an empty OsString. This is a partial function, consider using uncons instead.

  9. head :: IsNonEmpty f a a "head" => f a -> a

    relude Relude.List.NonEmpty

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

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

  10. head :: HasCallStack => [a] -> a

    relude Relude.Unsafe

    Extract the first element of a list, which must be non-empty. To disable the warning about partiality put {-# OPTIONS_GHC -Wno-x-partial -Wno-unrecognised-warning-flags #-} at the top of the file. To disable it throughout a package put the same options into ghc-options section of Cabal file. To disable it in GHCi put :set -Wno-x-partial -Wno-unrecognised-warning-flags into ~/.ghci config file. See also the migration guide.

    Examples
    >>> head [1, 2, 3]
    1
    
    >>> head [1..]
    1
    
    >>> head []
    *** Exception: Prelude.head: empty list
    

Page 6 of many | Previous | Next