From b23136b1aed02febbe0fa539c2b74edbecd9e1e0 Mon Sep 17 00:00:00 2001 From: michaelt Date: Wed, 5 Feb 2014 05:00:39 -0500 Subject: rearranged internal modules to placate haddock --- Pipes/Text/Internal.hs | 16 ++++------------ Pipes/Text/Internal/Codec.hs | 16 +++++++--------- Pipes/Text/Internal/Decoding.hs | 23 +++++++++++++---------- 3 files changed, 24 insertions(+), 31 deletions(-) (limited to 'Pipes/Text') diff --git a/Pipes/Text/Internal.hs b/Pipes/Text/Internal.hs index 2530b23..582ef14 100644 --- a/Pipes/Text/Internal.hs +++ b/Pipes/Text/Internal.hs @@ -1,15 +1,7 @@ module Pipes.Text.Internal - ( Decoding(..) - , streamDecodeUtf8 - , decodeSomeUtf8 - , Codec(..) - , TextException(..) - , utf8 - , utf16_le - , utf16_be - , utf32_le - , utf32_be + (module Pipes.Text.Internal.Codec + , module Pipes.Text.Internal.Decoding ) where -import Pipes.Text.Internal.Decoding -import Pipes.Text.Internal.Codec \ No newline at end of file +import Pipes.Text.Internal.Codec +import Pipes.Text.Internal.Decoding \ No newline at end of file diff --git a/Pipes/Text/Internal/Codec.hs b/Pipes/Text/Internal/Codec.hs index 63cbd74..075a152 100644 --- a/Pipes/Text/Internal/Codec.hs +++ b/Pipes/Text/Internal/Codec.hs @@ -4,17 +4,15 @@ -- 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(..) - , streamDecodeUtf8 - , decodeSomeUtf8 - , Codec(..) + ( Codec(..) , TextException(..) , utf8 , utf16_le diff --git a/Pipes/Text/Internal/Decoding.hs b/Pipes/Text/Internal/Decoding.hs index 4b4bbe6..b5d928a 100644 --- a/Pipes/Text/Internal/Decoding.hs +++ b/Pipes/Text/Internal/Decoding.hs @@ -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 @@ import Data.Maybe (catMaybes) --- | 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 @@ instance Show Decoding where 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 @@ streamDecodeUtf8 = decodeChunkUtf8 B.empty 0 0 {-# 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) -- cgit v1.2.3