diff options
author | Michael Thompson <what_is_it_to_do_anything@yahoo.com> | 2014-02-16 11:42:56 -0500 |
---|---|---|
committer | Michael Thompson <what_is_it_to_do_anything@yahoo.com> | 2014-02-16 11:42:56 -0500 |
commit | 7141b182e53b4590f15e7f12cac19de5b25b6396 (patch) | |
tree | 22f1186e8be6a3f194ee9be87041ec3cc71b81b2 | |
parent | 327be7638ab8de6c0589b5fcb9177f5186ace4de (diff) | |
parent | 21eb409c2587f6ccefaa4c008789614298c84487 (diff) | |
download | text-pipes-7141b182e53b4590f15e7f12cac19de5b25b6396.tar.gz text-pipes-7141b182e53b4590f15e7f12cac19de5b25b6396.tar.zst text-pipes-7141b182e53b4590f15e7f12cac19de5b25b6396.zip |
Merge pull request #8 from Gabriel439/codecsynonym
Simplified `Codec` type synonym
-rw-r--r-- | Pipes/Text/Encoding.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs index a8be8e4..21269cf 100644 --- a/Pipes/Text/Encoding.hs +++ b/Pipes/Text/Encoding.hs | |||
@@ -38,16 +38,18 @@ import Control.Monad (join) | |||
38 | import Data.Word (Word8) | 38 | import Data.Word (Word8) |
39 | import Pipes | 39 | import Pipes |
40 | 40 | ||
41 | 41 | type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a) | |
42 | 42 | ||
43 | {- | A 'Codec' is just an improper lens into a byte stream that is expected to contain text. | 43 | {- | A 'Codec' is just an improper lens into a byte stream that is expected to contain text. |
44 | They are named in accordance with the expected encoding, 'utf8', 'utf16LE' etc. | 44 | They are named in accordance with the expected encoding, 'utf8', 'utf16LE' etc. |
45 | The stream of text they 'see' in a bytestream ends by returning the original byte stream | 45 | The stream of text they 'see' in a bytestream ends by returning the original byte stream |
46 | beginning at the point of failure, or the empty bytestream with its return value. | 46 | beginning at the point of failure, or the empty bytestream with its return value. |
47 | -} | 47 | -} |
48 | type Codec = forall f m r . (Functor f , Monad m ) => | 48 | type Codec |
49 | (Producer Text m (Producer ByteString m r) -> f (Producer Text m (Producer ByteString m r))) | 49 | = forall m r |
50 | -> Producer ByteString m r -> f (Producer ByteString m r ) | 50 | . Monad m |
51 | => Lens' (Producer ByteString m r) | ||
52 | (Producer Text m (Producer ByteString m r)) | ||
51 | 53 | ||
52 | decodeStream :: Monad m | 54 | decodeStream :: Monad m |
53 | => (B.ByteString -> DecodeResult) | 55 | => (B.ByteString -> DecodeResult) |