<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.ByteString.Lazy.Char8</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Data-ByteString-Lazy-Char8.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">bytestring-0.9.2.1: Fast, packed, strict and lazy byte arrays with a list interface</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable (imports Data.ByteString.Lazy)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>dons@cse.unsw.edu.au</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Data.ByteString.Lazy.Char8</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The <code>ByteString</code> type </a></li><li><a href="#g:2">Introducing and eliminating <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s </a></li><li><a href="#g:3">Basic interface </a></li><li><a href="#g:4">Transforming ByteStrings </a></li><li><a href="#g:5">Reducing <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s (folds) </a><ul><li><a href="#g:6">Special folds </a></li></ul></li><li><a href="#g:7">Building ByteStrings </a><ul><li><a href="#g:8">Scans </a></li><li><a href="#g:9">Accumulating maps </a></li><li><a href="#g:10">Infinite ByteStrings </a></li><li><a href="#g:11">Unfolding ByteStrings </a></li></ul></li><li><a href="#g:12">Substrings </a><ul><li><a href="#g:13">Breaking strings </a></li><li><a href="#g:14">Breaking into many substrings </a></li><li><a href="#g:15">Breaking into lines and words </a></li></ul></li><li><a href="#g:16">Predicates </a></li><li><a href="#g:17">Searching ByteStrings </a><ul><li><a href="#g:18">Searching by equality </a></li><li><a href="#g:19">Searching with a predicate </a></li></ul></li><li><a href="#g:20">Indexing ByteStrings </a></li><li><a href="#g:21">Zipping and unzipping ByteStrings </a></li><li><a href="#g:22">Ordered ByteStrings </a></li><li><a href="#g:23">Low level conversions </a><ul><li><a href="#g:24">Copying ByteStrings </a></li></ul></li><li><a href="#g:25">Reading from ByteStrings </a></li><li><a href="#g:26">I/O with <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s </a><ul><li><a href="#g:27">Standard input and output </a></li><li><a href="#g:28">Files </a></li><li><a href="#g:29">I/O with Handles </a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Manipulate <em>lazy</em> <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s using <code><a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></code> operations. All Chars will be truncated to 8 bits. It can be expected that these functions will run at identical speeds to their <code><a href="../base-4.5.1.0/Data-Word.html#t:Word8">Word8</a></code> equivalents in <a href="Data-ByteString-Lazy.html">Data.ByteString.Lazy</a>. </p><p>This module is intended to be imported <code>qualified</code>, to avoid name clashes with <a href="../base-4.5.1.0/Prelude.html">Prelude</a> functions. eg. </p><pre> import qualified Data.ByteString.Lazy.Char8 as C </pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:ByteString">ByteString</a> </li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:pack">pack</a> :: [<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unpack">unpack</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>]</li><li class="src short"><a href="#v:fromChunks">fromChunks</a> :: [<a href="Data-ByteString.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toChunks">toChunks</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:cons">cons</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:cons-39-">cons'</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:snoc">snoc</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:append">append</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:head">head</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:uncons">uncons</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:last">last</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:tail">tail</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:init">init</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:null">null</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:length">length</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:map">map</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:reverse">reverse</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:intersperse">intersperse</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:intercalate">intercalate</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:transpose">transpose</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:foldl">foldl</a> :: (a -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> a</li><li class="src short"><a href="#v:foldl-39-">foldl'</a> :: (a -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> a</li><li class="src short"><a href="#v:foldl1">foldl1</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldl1-39-">foldl1'</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldr">foldr</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a -> a) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> a</li><li class="src short"><a href="#v:foldr1">foldr1</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:concat">concat</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:concatMap">concatMap</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:any">any</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:all">all</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:maximum">maximum</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:minimum">minimum</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:scanl">scanl</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:mapAccumL">mapAccumL</a> :: (acc -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> (acc, <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>)) -> acc -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (acc, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:mapAccumR">mapAccumR</a> :: (acc -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> (acc, <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>)) -> acc -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (acc, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:repeat">repeat</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:replicate">replicate</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:cycle">cycle</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:iterate">iterate</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unfoldr">unfoldr</a> :: (a -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>, a)) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:take">take</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:drop">drop</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:splitAt">splitAt</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:span">span</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:break">break</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:group">group</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:groupBy">groupBy</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:inits">inits</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:tails">tails</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:split">split</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:splitWith">splitWith</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:lines">lines</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:words">words</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:unlines">unlines</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:unwords">unwords</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:isPrefixOf">isPrefixOf</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:elem">elem</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:notElem">notElem</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:find">find</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:filter">filter</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:index">index</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:elemIndex">elemIndex</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:elemIndices">elemIndices</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a>]</li><li class="src short"><a href="#v:findIndex">findIndex</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:findIndices">findIndices</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a>]</li><li class="src short"><a href="#v:count">count</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:zip">zip</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [(<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>, <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>)]</li><li class="src short"><a href="#v:zipWith">zipWith</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [a]</li><li class="src short"><a href="#v:copy">copy</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:readInt">readInt</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:readInteger">readInteger</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Prelude.html#t:Integer">Integer</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</li><li class="src short"><a href="#v:getContents">getContents</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:putStr">putStr</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:putStrLn">putStrLn</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:interact">interact</a> :: (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>) -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:readFile">readFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:writeFile">writeFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:appendFile">appendFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:hGetContents">hGetContents</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:hGet">hGet</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:hGetNonBlocking">hGetNonBlocking</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:hPut">hPut</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:hPutNonBlocking">hPutNonBlocking</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:hPutStr">hPutStr</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:hPutStrLn">hPutStrLn</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li></ul></div><div id="interface"><h1 id="g:1">The <code>ByteString</code> type </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:ByteString" class="def">ByteString</a> </p><div class="doc"><p>A space-efficient representation of a Word8 vector, supporting many efficient operations. A <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> contains 8-bit characters only. </p><p>Instances of Eq, Ord, Read, Show, Data, Typeable </p></div><div class="subs instances"><p id="control.i:ByteString" class="caption collapser" onclick="toggleSection('i:ByteString')">Instances</p><div id="section.i:ByteString" class="show"><table><tr><td class="src"><a href="../base-4.5.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Data-Data.html#t:Data">Data</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Text-Read.html#t:Read">Read</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Text-Show.html#t:Show">Show</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Data-String.html#t:IsString">IsString</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="../base-4.5.1.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:2">Introducing and eliminating <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s </h1><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(1)</em> The empty <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> </p></div></div><div class="top"><p class="src"><a name="v:singleton" class="def">singleton</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(1)</em> Convert a <code><a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></code> into a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> </p></div></div><div class="top"><p class="src"><a name="v:pack" class="def">pack</a> :: [<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> Convert a <code><a href="../base-4.5.1.0/Data-String.html#t:String">String</a></code> into a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:unpack" class="def">unpack</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>]</p><div class="doc"><p><em>O(n)</em> Converts a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> to a <code><a href="../base-4.5.1.0/Data-String.html#t:String">String</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:fromChunks" class="def">fromChunks</a> :: [<a href="Data-ByteString.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(c)</em> Convert a list of strict <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> into a lazy <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> </p></div></div><div class="top"><p class="src"><a name="v:toChunks" class="def">toChunks</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><em>O(n)</em> Convert a lazy <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> into a list of strict <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> </p></div></div><h1 id="g:3">Basic interface </h1><div class="top"><p class="src"><a name="v:cons" class="def">cons</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(1)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:cons">cons</a></code> is analogous to '(:)' for lists. </p></div></div><div class="top"><p class="src"><a name="v:cons-39-" class="def">cons'</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(1)</em> Unlike <code><a href="Data-ByteString-Lazy-Char8.html#v:cons">cons</a></code>, 'cons\'' is strict in the ByteString that we are consing onto. More precisely, it forces the head and the first chunk. It does this because, for space efficiency, it may coalesce the new byte onto the first 'chunk' rather than starting a new 'chunk'. </p><p>So that means you can't use a lazy recursive contruction like this: </p><pre> let xs = cons\' c xs in xs </pre><p>You can however use <code><a href="Data-ByteString-Lazy-Char8.html#v:cons">cons</a></code>, as well as <code><a href="Data-ByteString-Lazy-Char8.html#v:repeat">repeat</a></code> and <code><a href="Data-ByteString-Lazy-Char8.html#v:cycle">cycle</a></code>, to build infinite lazy ByteStrings. </p></div></div><div class="top"><p class="src"><a name="v:snoc" class="def">snoc</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> Append a Char to the end of a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>. Similar to <code><a href="Data-ByteString-Lazy-Char8.html#v:cons">cons</a></code>, this function performs a memcpy. </p></div></div><div class="top"><p class="src"><a name="v:append" class="def">append</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n\</em>c)/ Append two ByteStrings </p></div></div><div class="top"><p class="src"><a name="v:head" class="def">head</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><em>O(1)</em> Extract the first element of a ByteString, which must be non-empty. </p></div></div><div class="top"><p class="src"><a name="v:uncons" class="def">uncons</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p><em>O(1)</em> Extract the head and tail of a ByteString, returning Nothing if it is empty. </p></div></div><div class="top"><p class="src"><a name="v:last" class="def">last</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><em>O(1)</em> Extract the last element of a packed string, which must be non-empty. </p></div></div><div class="top"><p class="src"><a name="v:tail" class="def">tail</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(1)</em> Extract the elements after the head of a ByteString, which must be non-empty. </p></div></div><div class="top"><p class="src"><a name="v:init" class="def">init</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n\</em>c)/ Return all the elements of a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> except the last one. </p></div></div><div class="top"><p class="src"><a name="v:null" class="def">null</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p><em>O(1)</em> Test whether a ByteString is empty. </p></div></div><div class="top"><p class="src"><a name="v:length" class="def">length</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></p><div class="doc"><p><em>O(n\</em>c)/ <code><a href="Data-ByteString-Lazy-Char8.html#v:length">length</a></code> returns the length of a ByteString as an <code><a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></code> </p></div></div><h1 id="g:4">Transforming ByteStrings </h1><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:map">map</a></code> <code>f xs</code> is the ByteString obtained by applying <code>f</code> to each element of <code>xs</code> </p></div></div><div class="top"><p class="src"><a name="v:reverse" class="def">reverse</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:reverse">reverse</a></code> <code>xs</code> returns the elements of <code>xs</code> in reverse order. </p></div></div><div class="top"><p class="src"><a name="v:intersperse" class="def">intersperse</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:intersperse">intersperse</a></code> function takes a Char and a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> and `intersperses' that Char between the elements of the <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>. It is analogous to the intersperse function on Lists. </p></div></div><div class="top"><p class="src"><a name="v:intercalate" class="def">intercalate</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:intercalate">intercalate</a></code> function takes a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> and a list of <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s and concatenates the list after interspersing the first argument between each element of the list. </p></div></div><div class="top"><p class="src"><a name="v:transpose" class="def">transpose</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:transpose">transpose</a></code> function transposes the rows and columns of its <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> argument. </p></div></div><h1 id="g:5">Reducing <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s (folds) </h1><div class="top"><p class="src"><a name="v:foldl" class="def">foldl</a> :: (a -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> a</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:foldl">foldl</a></code>, applied to a binary operator, a starting value (typically the left-identity of the operator), and a ByteString, reduces the ByteString using the binary operator, from left to right. </p></div></div><div class="top"><p class="src"><a name="v:foldl-39-" class="def">foldl'</a> :: (a -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> a</p><div class="doc"><p>'foldl\'' is like foldl, but strict in the accumulator. </p></div></div><div class="top"><p class="src"><a name="v:foldl1" class="def">foldl1</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:foldl1">foldl1</a></code> is a variant of <code><a href="Data-ByteString-Lazy-Char8.html#v:foldl">foldl</a></code> that has no starting value argument, and thus must be applied to non-empty <code>ByteStrings</code>. </p></div></div><div class="top"><p class="src"><a name="v:foldl1-39-" class="def">foldl1'</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p>'foldl1\'' is like <code><a href="Data-ByteString-Lazy-Char8.html#v:foldl1">foldl1</a></code>, but strict in the accumulator. </p></div></div><div class="top"><p class="src"><a name="v:foldr" class="def">foldr</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a -> a) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> a</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:foldr">foldr</a></code>, applied to a binary operator, a starting value (typically the right-identity of the operator), and a packed string, reduces the packed string using the binary operator, from right to left. </p></div></div><div class="top"><p class="src"><a name="v:foldr1" class="def">foldr1</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:foldr1">foldr1</a></code> is a variant of <code><a href="Data-ByteString-Lazy-Char8.html#v:foldr">foldr</a></code> that has no starting value argument, and thus must be applied to non-empty <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s </p></div></div><h2 id="g:6">Special folds </h2><div class="top"><p class="src"><a name="v:concat" class="def">concat</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> Concatenate a list of ByteStrings. </p></div></div><div class="top"><p class="src"><a name="v:concatMap" class="def">concatMap</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>Map a function over a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> and concatenate the results </p></div></div><div class="top"><p class="src"><a name="v:any" class="def">any</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Applied to a predicate and a ByteString, <code><a href="Data-ByteString-Lazy-Char8.html#v:any">any</a></code> determines if any element of the <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> satisfies the predicate. </p></div></div><div class="top"><p class="src"><a name="v:all" class="def">all</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Applied to a predicate and a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>, <code><a href="Data-ByteString-Lazy-Char8.html#v:all">all</a></code> determines if all elements of the <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> satisfy the predicate. </p></div></div><div class="top"><p class="src"><a name="v:maximum" class="def">maximum</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:maximum">maximum</a></code> returns the maximum value from a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> </p></div></div><div class="top"><p class="src"><a name="v:minimum" class="def">minimum</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:minimum">minimum</a></code> returns the minimum value from a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> </p></div></div><h1 id="g:7">Building ByteStrings </h1><h2 id="g:8">Scans </h2><div class="top"><p class="src"><a name="v:scanl" class="def">scanl</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:scanl">scanl</a></code> is similar to <code><a href="Data-ByteString-Lazy-Char8.html#v:foldl">foldl</a></code>, but returns a list of successive reduced values from the left. This function will fuse. </p><pre> scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...] </pre><p>Note that </p><pre> last (scanl f z xs) == foldl f z xs. </pre></div></div><h2 id="g:9">Accumulating maps </h2><div class="top"><p class="src"><a name="v:mapAccumL" class="def">mapAccumL</a> :: (acc -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> (acc, <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>)) -> acc -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (acc, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:mapAccumL">mapAccumL</a></code> function behaves like a combination of <code><a href="Data-ByteString-Lazy-Char8.html#v:map">map</a></code> and <code><a href="Data-ByteString-Lazy-Char8.html#v:foldl">foldl</a></code>; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString. </p></div></div><div class="top"><p class="src"><a name="v:mapAccumR" class="def">mapAccumR</a> :: (acc -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> (acc, <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>)) -> acc -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (acc, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:mapAccumR">mapAccumR</a></code> function behaves like a combination of <code><a href="Data-ByteString-Lazy-Char8.html#v:map">map</a></code> and <code><a href="Data-ByteString-Lazy-Char8.html#v:foldr">foldr</a></code>; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString. </p></div></div><h2 id="g:10">Infinite ByteStrings </h2><div class="top"><p class="src"><a name="v:repeat" class="def">repeat</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><code><a href="Data-ByteString-Lazy-Char8.html#v:repeat">repeat</a></code> x</code> is an infinite ByteString, with <code>x</code> the value of every element. </p></div></div><div class="top"><p class="src"><a name="v:replicate" class="def">replicate</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> <code><code><a href="Data-ByteString-Lazy-Char8.html#v:replicate">replicate</a></code> n x</code> is a ByteString of length <code>n</code> with <code>x</code> the value of every element. </p></div></div><div class="top"><p class="src"><a name="v:cycle" class="def">cycle</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:cycle">cycle</a></code> ties a finite ByteString into a circular one, or equivalently, the infinite repetition of the original ByteString. </p></div></div><div class="top"><p class="src"><a name="v:iterate" class="def">iterate</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>) -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><code><a href="Data-ByteString-Lazy-Char8.html#v:iterate">iterate</a></code> f x</code> returns an infinite ByteString of repeated applications of <code>f</code> to <code>x</code>: </p><pre> iterate f x == [x, f x, f (f x), ...] </pre></div></div><h2 id="g:11">Unfolding ByteStrings </h2><div class="top"><p class="src"><a name="v:unfoldr" class="def">unfoldr</a> :: (a -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>, a)) -> a -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:unfoldr">unfoldr</a></code> function is analogous to the List 'unfoldr'. <code><a href="Data-ByteString-Lazy-Char8.html#v:unfoldr">unfoldr</a></code> builds a ByteString from a seed value. The function takes the element and returns <code><a href="../base-4.5.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if it is done producing the ByteString or returns <code><a href="../base-4.5.1.0/Data-Maybe.html#v:Just">Just</a></code> <code>(a,b)</code>, in which case, <code>a</code> is a prepending to the ByteString and <code>b</code> is used as the next element in a recursive call. </p></div></div><h1 id="g:12">Substrings </h1><h2 id="g:13">Breaking strings </h2><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n\</em>c)/ <code><a href="Data-ByteString-Lazy-Char8.html#v:take">take</a></code> <code>n</code>, applied to a ByteString <code>xs</code>, returns the prefix of <code>xs</code> of length <code>n</code>, or <code>xs</code> itself if <code>n > <code><a href="Data-ByteString-Lazy-Char8.html#v:length">length</a></code> xs</code>. </p></div></div><div class="top"><p class="src"><a name="v:drop" class="def">drop</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n\</em>c)/ <code><a href="Data-ByteString-Lazy-Char8.html#v:drop">drop</a></code> <code>n xs</code> returns the suffix of <code>xs</code> after the first <code>n</code> elements, or <code>[]</code> if <code>n > <code><a href="Data-ByteString-Lazy-Char8.html#v:length">length</a></code> xs</code>. </p></div></div><div class="top"><p class="src"><a name="v:splitAt" class="def">splitAt</a> :: <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p><em>O(n\</em>c)/ <code><a href="Data-ByteString-Lazy-Char8.html#v:splitAt">splitAt</a></code> <code>n xs</code> is equivalent to <code>(<code><a href="Data-ByteString-Lazy-Char8.html#v:take">take</a></code> n xs, <code><a href="Data-ByteString-Lazy-Char8.html#v:drop">drop</a></code> n xs)</code>. </p></div></div><div class="top"><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:takeWhile">takeWhile</a></code>, applied to a predicate <code>p</code> and a ByteString <code>xs</code>, returns the longest prefix (possibly empty) of <code>xs</code> of elements that satisfy <code>p</code>. </p></div></div><div class="top"><p class="src"><a name="v:dropWhile" class="def">dropWhile</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:dropWhile">dropWhile</a></code> <code>p xs</code> returns the suffix remaining after <code><a href="Data-ByteString-Lazy-Char8.html#v:takeWhile">takeWhile</a></code> <code>p xs</code>. </p></div></div><div class="top"><p class="src"><a name="v:span" class="def">span</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:span">span</a></code> <code>p xs</code> breaks the ByteString into two segments. It is equivalent to <code>(<code><a href="Data-ByteString-Lazy-Char8.html#v:takeWhile">takeWhile</a></code> p xs, <code><a href="Data-ByteString-Lazy-Char8.html#v:dropWhile">dropWhile</a></code> p xs)</code> </p></div></div><div class="top"><p class="src"><a name="v:break" class="def">break</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:break">break</a></code> <code>p</code> is equivalent to <code><code><a href="Data-ByteString-Lazy-Char8.html#v:span">span</a></code> (<code><a href="../base-4.5.1.0/Data-Bool.html#v:not">not</a></code> . p)</code>. </p></div></div><div class="top"><p class="src"><a name="v:group" class="def">group</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:group">group</a></code> function takes a ByteString and returns a list of ByteStrings such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result contains only equal elements. For example, </p><pre> group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"] </pre><p>It is a special case of <code><a href="Data-ByteString-Lazy.html#v:groupBy">groupBy</a></code>, which allows the programmer to supply their own equality test. </p></div></div><div class="top"><p class="src"><a name="v:groupBy" class="def">groupBy</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:groupBy">groupBy</a></code> function is the non-overloaded version of <code><a href="Data-ByteString-Lazy-Char8.html#v:group">group</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:inits" class="def">inits</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><em>O(n)</em> Return all initial segments of the given <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>, shortest first. </p></div></div><div class="top"><p class="src"><a name="v:tails" class="def">tails</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><em>O(n)</em> Return all final segments of the given <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>, longest first. </p></div></div><h2 id="g:14">Breaking into many substrings </h2><div class="top"><p class="src"><a name="v:split" class="def">split</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><em>O(n)</em> Break a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> into pieces separated by the byte argument, consuming the delimiter. I.e. </p><pre> split '\n' "a\nb\nd\ne" == ["a","b","d","e"] split 'a' "aXaXaXa" == ["","X","X","X"] split 'x' "x" == ["",""] </pre><p>and </p><pre> intercalate [c] . split c == id split == splitWith . (==) </pre><p>As for all splitting functions in this library, this function does not copy the substrings, it just constructs new <code>ByteStrings</code> that are slices of the original. </p></div></div><div class="top"><p class="src"><a name="v:splitWith" class="def">splitWith</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><em>O(n)</em> Splits a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg. </p><pre> splitWith (=='a') "aabbaca" == ["","","bb","c",""] </pre></div></div><h2 id="g:15">Breaking into lines and words </h2><div class="top"><p class="src"><a name="v:lines" class="def">lines</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:lines">lines</a></code> breaks a ByteString up into a list of ByteStrings at newline Chars. The resulting strings do not contain newlines. </p><p>As of bytestring 0.9.0.3, this function is stricter than its list cousin. </p></div></div><div class="top"><p class="src"><a name="v:words" class="def">words</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>]</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:words">words</a></code> breaks a ByteString up into a list of words, which were delimited by Chars representing white space. And </p><pre> tokens isSpace = words </pre></div></div><div class="top"><p class="src"><a name="v:unlines" class="def">unlines</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:unlines">unlines</a></code> is an inverse operation to <code><a href="Data-ByteString-Lazy-Char8.html#v:lines">lines</a></code>. It joins lines, after appending a terminating newline to each. </p></div></div><div class="top"><p class="src"><a name="v:unwords" class="def">unwords</a> :: [<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>] -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:unwords">unwords</a></code> function is analogous to the <code><a href="Data-ByteString-Lazy-Char8.html#v:unlines">unlines</a></code> function, on words. </p></div></div><h1 id="g:16">Predicates </h1><div class="top"><p class="src"><a name="v:isPrefixOf" class="def">isPrefixOf</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:isPrefixOf">isPrefixOf</a></code> function takes two ByteStrings and returns <code><a href="../base-4.5.1.0/Data-Bool.html#v:True">True</a></code> iff the first is a prefix of the second. </p></div></div><h1 id="g:17">Searching ByteStrings </h1><h2 id="g:18">Searching by equality </h2><div class="top"><p class="src"><a name="v:elem" class="def">elem</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:elem">elem</a></code> is the <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> membership predicate. This implementation uses <code>memchr(3)</code>. </p></div></div><div class="top"><p class="src"><a name="v:notElem" class="def">notElem</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:notElem">notElem</a></code> is the inverse of <code><a href="Data-ByteString-Lazy-Char8.html#v:elem">elem</a></code> </p></div></div><h2 id="g:19">Searching with a predicate </h2><div class="top"><p class="src"><a name="v:find" class="def">find</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:find">find</a></code> function takes a predicate and a ByteString, and returns the first element in matching the predicate, or <code><a href="../base-4.5.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if there is no such element. </p></div></div><div class="top"><p class="src"><a name="v:filter" class="def">filter</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:filter">filter</a></code>, applied to a predicate and a ByteString, returns a ByteString containing those characters that satisfy the predicate. </p></div></div><h1 id="g:20">Indexing ByteStrings </h1><div class="top"><p class="src"><a name="v:index" class="def">index</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a></p><div class="doc"><p><em>O(1)</em> <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> index (subscript) operator, starting from 0. </p></div></div><div class="top"><p class="src"><a name="v:elemIndex" class="def">elemIndex</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:elemIndex">elemIndex</a></code> function returns the index of the first element in the given <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> which is equal (by memchr) to the query element, or <code><a href="../base-4.5.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if there is no such element. </p></div></div><div class="top"><p class="src"><a name="v:elemIndices" class="def">elemIndices</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a>]</p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-ByteString-Lazy-Char8.html#v:elemIndices">elemIndices</a></code> function extends <code><a href="Data-ByteString-Lazy-Char8.html#v:elemIndex">elemIndex</a></code>, by returning the indices of all elements equal to the query element, in ascending order. </p></div></div><div class="top"><p class="src"><a name="v:findIndex" class="def">findIndex</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:findIndex">findIndex</a></code> function takes a predicate and a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> and returns the index of the first element in the ByteString satisfying the predicate. </p></div></div><div class="top"><p class="src"><a name="v:findIndices" class="def">findIndices</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [<a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a>]</p><div class="doc"><p>The <code><a href="Data-ByteString-Lazy-Char8.html#v:findIndices">findIndices</a></code> function extends <code><a href="Data-ByteString-Lazy-Char8.html#v:findIndex">findIndex</a></code>, by returning the indices of all elements satisfying the predicate, in ascending order. </p></div></div><div class="top"><p class="src"><a name="v:count" class="def">count</a> :: <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int64">Int64</a></p><div class="doc"><p>count returns the number of times its argument appears in the ByteString </p><pre> count == length . elemIndices count '\n' == length . lines </pre><p>But more efficiently than using length on the intermediate list. </p></div></div><h1 id="g:21">Zipping and unzipping ByteStrings </h1><div class="top"><p class="src"><a name="v:zip" class="def">zip</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [(<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>, <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a>)]</p><div class="doc"><p><em>O(n)</em> <code><a href="Data-ByteString-Lazy-Char8.html#v:zip">zip</a></code> takes two ByteStrings and returns a list of corresponding pairs of Chars. If one input ByteString is short, excess elements of the longer ByteString are discarded. This is equivalent to a pair of <code><a href="Data-ByteString-Lazy-Char8.html#v:unpack">unpack</a></code> operations, and so space usage may be large for multi-megabyte ByteStrings </p></div></div><div class="top"><p class="src"><a name="v:zipWith" class="def">zipWith</a> :: (<a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> <a href="../base-4.5.1.0/Data-Char.html#t:Char">Char</a> -> a) -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> [a]</p><div class="doc"><p><code><a href="Data-ByteString-Lazy-Char8.html#v:zipWith">zipWith</a></code> generalises <code><a href="Data-ByteString-Lazy-Char8.html#v:zip">zip</a></code> by zipping with the function given as the first argument, instead of a tupling function. For example, <code><code><a href="Data-ByteString-Lazy-Char8.html#v:zipWith">zipWith</a></code> (+)</code> is applied to two ByteStrings to produce the list of corresponding sums. </p></div></div><h1 id="g:22">Ordered ByteStrings </h1><h1 id="g:23">Low level conversions </h1><h2 id="g:24">Copying ByteStrings </h2><div class="top"><p class="src"><a name="v:copy" class="def">copy</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p><em>O(n)</em> Make a copy of the <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> with its own storage. This is mainly useful to allow the rest of the data pointed to by the <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> to be garbage collected, for example if a large string has been read in, and only a small part of it is needed in the rest of the program. </p></div></div><h1 id="g:25">Reading from ByteStrings </h1><div class="top"><p class="src"><a name="v:readInt" class="def">readInt</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p>readInt reads an Int from the beginning of the ByteString. If there is no integer at the beginning of the string, it returns Nothing, otherwise it just returns the int read, and the rest of the string. </p></div></div><div class="top"><p class="src"><a name="v:readInteger" class="def">readInteger</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../base-4.5.1.0/Prelude.html#t:Integer">Integer</a>, <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>)</p><div class="doc"><p>readInteger reads an Integer from the beginning of the ByteString. If there is no integer at the beginning of the string, it returns Nothing, otherwise it just returns the int read, and the rest of the string. </p></div></div><h1 id="g:26">I/O with <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>s </h1><h2 id="g:27">Standard input and output </h2><div class="top"><p class="src"><a name="v:getContents" class="def">getContents</a> :: <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>getContents. Equivalent to hGetContents stdin. Will read <em>lazily</em> </p></div></div><div class="top"><p class="src"><a name="v:putStr" class="def">putStr</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>Write a ByteString to stdout </p></div></div><div class="top"><p class="src"><a name="v:putStrLn" class="def">putStrLn</a> :: <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>Write a ByteString to stdout, appending a newline byte </p></div></div><div class="top"><p class="src"><a name="v:interact" class="def">interact</a> :: (<a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a>) -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>The interact function takes a function of type <code>ByteString -> ByteString</code> as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device. </p></div></div><h2 id="g:28">Files </h2><div class="top"><p class="src"><a name="v:readFile" class="def">readFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>Read an entire file <em>lazily</em> into a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>. Use 'text mode' on Windows to interpret newlines </p></div></div><div class="top"><p class="src"><a name="v:writeFile" class="def">writeFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>Write a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> to a file. </p></div></div><div class="top"><p class="src"><a name="v:appendFile" class="def">appendFile</a> :: <a href="../base-4.5.1.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>Append a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> to a file. </p></div></div><h2 id="g:29">I/O with Handles </h2><div class="top"><p class="src"><a name="v:hGetContents" class="def">hGetContents</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>Read entire handle contents <em>lazily</em> into a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>. Chunks are read on demand, using the default chunk size. </p><p>Once EOF is encountered, the Handle is closed. </p><p>Note: the <code><a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> should be placed in binary mode with <code><a href="../base-4.5.1.0/System-IO.html#v:hSetBinaryMode">hSetBinaryMode</a></code> for <code><a href="Data-ByteString-Lazy-Char8.html#v:hGetContents">hGetContents</a></code> to work correctly. </p></div></div><div class="top"><p class="src"><a name="v:hGet" class="def">hGet</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>Read <code>n</code> bytes into a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code>, directly from the specified <code><a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:hGetNonBlocking" class="def">hGetNonBlocking</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>hGetNonBlocking is similar to <code><a href="Data-ByteString-Lazy-Char8.html#v:hGet">hGet</a></code>, except that it will never block waiting for data to become available, instead it returns only whatever data is available. If there is no data available to be read, <code><a href="Data-ByteString-Lazy-Char8.html#v:hGetNonBlocking">hGetNonBlocking</a></code> returns <code><a href="Data-ByteString-Lazy-Char8.html#v:empty">empty</a></code>. </p><p>Note: on Windows and with Haskell implementation other than GHC, this function does not work correctly; it behaves identically to <code><a href="Data-ByteString-Lazy-Char8.html#v:hGet">hGet</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:hPut" class="def">hPut</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>Outputs a <code><a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></code> to the specified <code><a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:hPutNonBlocking" class="def">hPutNonBlocking</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a></p><div class="doc"><p>Similar to <code><a href="Data-ByteString-Lazy-Char8.html#v:hPut">hPut</a></code> except that it will never block. Instead it returns any tail that did not get written. This tail may be <code><a href="Data-ByteString-Lazy-Char8.html#v:empty">empty</a></code> in the case that the whole string was written, or the whole original string if nothing was written. Partial writes are also possible. </p><p>Note: on Windows and with Haskell implementation other than GHC, this function does not work correctly; it behaves identically to <code><a href="Data-ByteString-Lazy-Char8.html#v:hPut">hPut</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:hPutStr" class="def">hPutStr</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>A synonym for <code>hPut</code>, for compatibility </p></div></div><div class="top"><p class="src"><a name="v:hPutStrLn" class="def">hPutStrLn</a> :: <a href="../base-4.5.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-ByteString-Lazy-Char8.html#t:ByteString">ByteString</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>Write a ByteString to a handle, appending a newline byte </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>