take -base

take :: Int -> ByteString -> ByteString
bytestring Data.ByteString, bytestring Data.ByteString.Char8
O(1) take n, applied to a ByteString xs, returns the prefix of xs of length n, or xs itself if n > length xs.
take :: Int -> Seq a -> Seq a
containers Data.Sequence
O(log(min(i,n-i))). The first i elements of a sequence. If i is negative, take i s yields the empty sequence. If the sequence contains fewer than i elements, the whole sequence is returned.
take :: Int -> Text -> Text
text Data.Text
O(n) take n, applied to a Text, returns the prefix of the Text of length n, or the Text itself if n is greater than the length of the Text. Subject to fusion.
take :: Int64 -> ByteString -> ByteString
bytestring Data.ByteString.Lazy, bytestring Data.ByteString.Lazy.Char8
O(n\c)/ take n, applied to a ByteString xs, returns the prefix of xs of length n, or xs itself if n > length xs.
take :: Int64 -> Text -> Text
text Data.Text.Lazy
O(n) take n, applied to a Text, returns the prefix of the Text of length n, or the Text itself if n is greater than the length of the Text. Subject to fusion.
takeBaseName :: FilePath -> String
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the base name, without an extension or path. > takeBaseName "file/test.txt" == "test" > takeBaseName "dave.ext" == "dave" > takeBaseName "" == "" > takeBaseName "test" == "test" > takeBaseName (addTrailingPathSeparator x) == "" > takeBaseName "file/file.tar.gz" == "file.tar"
takeDirectory :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the directory name, move up one level. > takeDirectory x `isPrefixOf` x || takeDirectory x == "." > takeDirectory "foo" == "." > takeDirectory "/foo/bar/baz" == "/foo/bar" > takeDirectory "/foo/bar/baz/" == "/foo/bar/baz" > takeDirectory "foo/bar/baz" == "foo/bar" > Windows: takeDirectory "foo\\bar" == "foo" > Windows: takeDirectory "foo\\bar\\\\" == "foo\\bar" > Windows: takeDirectory "C:\\" == "C:\\"
takeDrive :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the drive from a filepath. > takeDrive x == fst (splitDrive x)
takeExtension :: FilePath -> String
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the extension of a file, returns "" for no extension, .ext otherwise. > takeExtension x == snd (splitExtension x) > Valid x => takeExtension (addExtension x "ext") == ".ext" > Valid x => takeExtension (replaceExtension x "ext") == ".ext"
takeExtensions :: FilePath -> String
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get all extensions > takeExtensions "file.tar.gz" == ".tar.gz"
takeFileName :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the file name. > takeFileName "test/" == "" > takeFileName x `isSuffixOf` x > takeFileName x == snd (splitFileName x) > Valid x => takeFileName (replaceFileName x "fred") == "fred" > Valid x => takeFileName (x </> "fred") == "fred" > Valid x => isRelative (takeFileName x)
takeInput :: [(String, String)] -> ByteString -> ByteString
cgi Network.CGI.Protocol
Takes the right number of bytes from the input.
takeTMVar :: TMVar a -> STM a
stm Control.Concurrent.STM.TMVar
Return the contents of the TMVar. If the TMVar is currently empty, the transaction will retry. After a takeTMVar, the TMVar is left empty.
takeWhile :: (Char -> Bool) -> ByteString -> ByteString
bytestring Data.ByteString.Char8, bytestring Data.ByteString.Lazy.Char8
takeWhile, applied to a predicate p and a ByteString xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p.
takeWhile :: (Char -> Bool) -> Text -> Text
text Data.Text, text Data.Text.Lazy
O(n) takeWhile, applied to a predicate p and a Text, returns the longest prefix (possibly empty) of elements that satisfy p. Subject to fusion.
takeWhile :: (Word8 -> Bool) -> ByteString -> ByteString
bytestring Data.ByteString, bytestring Data.ByteString.Lazy
takeWhile, applied to a predicate p and a ByteString xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p.
takeWhileL :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(i) applied to a predicate p and a sequence xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p.
takeWhileR :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(i) applied to a predicate p and a sequence xs, returns the longest suffix (possibly empty) of xs of elements that satisfy p. takeWhileR p xs is equivalent to reverse (takeWhileL p (reverse xs)).
takeWord16 :: I16 -> Text -> Text
text Data.Text.Foreign
O(1) Return the prefix of the Text of n Word16 units in length. If n would cause the Text to end inside a surrogate pair, the end of the prefix will be advanced by one additional Word16 unit to maintain its validity.
takeWord16 :: Int -> Text -> Text
text Data.Text.Unsafe
O(1) Unchecked take of k Word16s from the front of a Text.
tryTakeTMVar :: TMVar a -> STM (Maybe a)
stm Control.Concurrent.STM.TMVar
A version of takeTMVar that does not retry. The tryTakeTMVar function returns Nothing if the TMVar was empty, or Just a if the TMVar was full with contents a. After tryTakeTMVar, the TMVar is left empty.
unsafeTake :: Int -> ByteString -> ByteString
bytestring Data.ByteString.Unsafe
A variety of take which omits the checks on n so there is an obligation on the programmer to provide a proof that 0 <= n <= length xs.