Skip to content

Commit

Permalink
Actually make it work. Eta-reduction of packZipWith
Browse files Browse the repository at this point in the history
  • Loading branch information
elikoga committed Oct 3, 2020
1 parent 6b454b2 commit e0946d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Data/ByteString/Char8.hs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ import GHC.Char (eqChar)
import qualified Data.List as List (intersperse)

import System.IO (Handle,stdout)
import GHC.IO (unsafeDupablePerformIO)
import Foreign


Expand Down Expand Up @@ -843,7 +842,9 @@ zipWith f = B.zipWith ((. w2c) . f . w2c)
-- | A specialised version of `zipWith` for the common case of a
-- simultaneous map over two ByteStrings, to build a 3rd.
packZipWith :: (Char -> Char -> Char) -> ByteString -> ByteString -> ByteString
packZipWith f bs bt = B.packZipWith (c2w . f . w2c) bs bt
packZipWith f = B.packZipWith f'
where
f' c1 c2 = c2w $ f (w2c c1) (w2c c2)
{-# INLINE packZipWith #-}

-- | 'unzip' transforms a list of pairs of Chars into a pair of
Expand Down

0 comments on commit e0946d1

Please sign in to comment.