pipes-text 0.0.0.3 → 0.0.0.4
raw patch · 4 files changed
+24/−16 lines, 4 files
Files
- Pipes/Text/Internal/Codec.hs +6/−5
- Pipes/Text/Internal/Decoding.hs +13/−10
- changelog +4/−0
- pipes-text.cabal +1/−1
Pipes/Text/Internal/Codec.hs view
@@ -4,11 +4,12 @@ -- Copyright: 2014 Michael Thompson, 2011 Michael Snoyman, 2010-2011 John Millikin -- License: MIT -- This Parts of this code were taken from enumerator and conduits, and adapted for pipes-{- | This module follows the model of the enumerator and conduits libraries, and defines- 'Codec' s for various encodings. Note that we do not export a 'Codec' for ascii and - iso8859_1. A 'Lens' in the sense of the pipes library cannot be defined for these, so- special functions appear in @Pipes.Text@--}++-- This module follows the model of the enumerator and conduits libraries, and defines+-- 'Codec' s for various encodings. Note that we do not export a 'Codec' for ascii and +-- iso8859_1. A 'Lens' in the sense of the pipes library cannot be defined for these, so+-- special functions appear in @Pipes.Text@+ module Pipes.Text.Internal.Codec ( Decoding(..)
Pipes/Text/Internal/Decoding.hs view
@@ -2,11 +2,10 @@ {-# LANGUAGE GeneralizedNewtypeDeriving, MagicHash, UnliftedFFITypes #-} {-# LANGUAGE DeriveDataTypeable, RankNTypes #-} -{- |-This module lifts assorted materials from Brian O'Sullivan's text package -especially @Data.Text.Encoding@ in order to define a pipes-appropriate-'streamDecodeUtf8'--} +-- This module lifts assorted materials from Brian O'Sullivan's text package +-- especially @Data.Text.Encoding@ in order to define a pipes-appropriate+-- 'streamDecodeUtf8'+ module Pipes.Text.Internal.Decoding ( Decoding(..) , streamDecodeUtf8@@ -43,9 +42,13 @@ --- | A stream oriented decoding result. Distinct from the similar type in @Data.Text.Encoding@-data Decoding = Some Text ByteString (ByteString -> Decoding) -- | Text, continuation and any undecoded fragment.- | Other Text ByteString -- | Text followed by an undecodable ByteString+-- A stream oriented decoding result. Distinct from the similar type in Data.Text.Encoding++data Decoding = Some Text ByteString (ByteString -> Decoding) + -- Text, continuation and any undecoded fragment.+ | Other Text ByteString + -- Text followed by an undecodable ByteString+ instance Show Decoding where showsPrec d (Some t bs _) = showParen (d > prec) $ showString "Some " . showsPrec prec' t .@@ -61,7 +64,7 @@ newtype CodePoint = CodePoint Word32 deriving (Eq, Show, Num, Storable) newtype DecoderState = DecoderState Word32 deriving (Eq, Show, Num, Storable) --- | Resolve a 'ByteString' into 'Text' and a continuation that can handle further 'ByteStrings'. +-- Resolve a 'ByteString' into 'Text' and a continuation that can handle further 'ByteStrings'. streamDecodeUtf8 :: ByteString -> Decoding streamDecodeUtf8 = decodeChunkUtf8 B.empty 0 0 where@@ -95,7 +98,7 @@ {-# INLINE decodeChunkUtf8 #-} {-# INLINE streamDecodeUtf8 #-} --- | Resolve a ByteString into an initial segment of intelligible 'Text' and whatever is unintelligble+-- Resolve a ByteString into an initial segment of intelligible 'Text' and whatever is unintelligble decodeSomeUtf8 :: ByteString -> (Text, ByteString) decodeSomeUtf8 bs@(PS fp off len) = runST $ do dest <- A.new (len+1)
changelog view
@@ -1,4 +1,8 @@ # Version 0.0.0.3++ * Altered bad haddock markup++ # Version 0.0.0.3 * Actually added changelog
pipes-text.cabal view
@@ -1,5 +1,5 @@ name: pipes-text-version: 0.0.0.3+version: 0.0.0.4 synopsis: Text pipes. description: Many of the pipes and other operations defined here mirror those in the `pipes-bytestring` library. Folds like `length` and grouping