Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Pipes/ByteString.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ module Pipes.ByteString (
, lines
, words

-- * Utilities
, pipeIso

-- * Re-exports
-- $reexports
, module Data.ByteString
Expand Down Expand Up @@ -988,6 +991,14 @@ words = Data.Profunctor.dimap _words (fmap _unwords)
_unwords = PG.intercalates (yield $ BS.singleton $ fromIntegral $ ord ' ')
{-# INLINABLE words #-}

-- | Upgrade a 'Word8' isomorphism to work with 'ByteString' 'Producer's
pipeIso
:: Monad m
=> Iso' Word8 Word8
-> Iso' (Proxy x' x () ByteString m r) (Proxy x' x () ByteString m r)
pipeIso = PP.mapIso $ (<-<) . map
{-# INLINABLE pipeIso #-}

{- $parse
The following parsing utilities are single-byte analogs of the ones found
in @pipes-parse@.
Expand Down