Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Bytes.Text.AsciiExt
Description
This module contains functions which operate on supersets of Bytes
containing ASCII-encoded text.
That is, none of the functions here inspect bytes with a value greater than 127, and do not fail due to the presence of such bytes.
Synopsis
- hFoldLines :: Handle -> a -> (a -> Bytes -> IO a) -> IO a
- hForLines_ :: Handle -> (Bytes -> IO a) -> IO ()
- forLines_ :: (Bytes -> IO a) -> IO ()
- foldLines :: a -> (a -> Bytes -> IO a) -> IO a
- anyEq :: Char -> Bytes -> Bool
- takeWhileNotEq :: Char -> Bytes -> Bytes
- dropWhileNotEq :: Char -> Bytes -> Bytes
- takeWhileEndNotEq :: Char -> Bytes -> Bytes
- dropWhileEndEq :: Char -> Bytes -> Bytes
- split1 :: Char -> Bytes -> Maybe (Bytes, Bytes)
- splitTetragram1 :: Char -> Char -> Char -> Char -> Bytes -> Maybe (Bytes, Bytes)
- split2 :: Char -> Bytes -> Maybe (Bytes, Bytes, Bytes)
- split3 :: Char -> Bytes -> Maybe (Bytes, Bytes, Bytes, Bytes)
- split4 :: Char -> Bytes -> Maybe (Bytes, Bytes, Bytes, Bytes, Bytes)
- toLowerU :: Bytes -> ByteArray
Line-Oriented IO
hFoldLines :: Handle -> a -> (a -> Bytes -> IO a) -> IO a Source #
Perform an action on each line of the input, threading state through the computation.
If you do not need to keep a state, see hForLines_
.
Lines are extracted with with hGetLine
, which does not document its
detection algorithm. As of writing (bytestring v0.11.1.0), lines are
delimited by a single n
character (UNIX-style, as all things should be).
hForLines_ :: Handle -> (Bytes -> IO a) -> IO () Source #
Perform an action on each line of the input, discarding results.
To maintain a running state, see hFoldLines
.
Lines are extracted with with hGetLine
, which does not document its
detection algorithm. As of writing (bytestring v0.11.1.0), lines are
delimited by a single n
character (UNIX-style, as all things should be).
Standard Handles
Predicates
Filtering
takeWhileNotEq :: Char -> Bytes -> Bytes Source #
Throws an exception the Char
argument is non-ascii.
dropWhileNotEq :: Char -> Bytes -> Bytes Source #
Throws an exception the Char
argument is non-ascii.
takeWhileEndNotEq :: Char -> Bytes -> Bytes Source #
Throws an exception the Char
argument is non-ascii.
dropWhileEndEq :: Char -> Bytes -> Bytes Source #
Throws an exception the Char
argument is non-ascii.
Splitting
Fixed from Beginning
split1 :: Char -> Bytes -> Maybe (Bytes, Bytes) Source #
Throws an exception the Char
argument is non-ascii.
splitTetragram1 :: Char -> Char -> Char -> Char -> Bytes -> Maybe (Bytes, Bytes) Source #
Throws an exception if any of the Char
arguments are non-ascii.
split2 :: Char -> Bytes -> Maybe (Bytes, Bytes, Bytes) Source #
Throws an exception the Char
argument is non-ascii.
split3 :: Char -> Bytes -> Maybe (Bytes, Bytes, Bytes, Bytes) Source #
Throws an exception the Char
argument is non-ascii.
split4 :: Char -> Bytes -> Maybe (Bytes, Bytes, Bytes, Bytes, Bytes) Source #
Throws an exception the Char
argument is non-ascii.