aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Thompson <what_is_it_to_do_anything@yahoo.com>2014-02-16 11:42:56 -0500
committerMichael Thompson <what_is_it_to_do_anything@yahoo.com>2014-02-16 11:42:56 -0500
commit7141b182e53b4590f15e7f12cac19de5b25b6396 (patch)
tree22f1186e8be6a3f194ee9be87041ec3cc71b81b2
parent327be7638ab8de6c0589b5fcb9177f5186ace4de (diff)
parent21eb409c2587f6ccefaa4c008789614298c84487 (diff)
downloadtext-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.hs10
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)
38import Data.Word (Word8) 38import Data.Word (Word8)
39import Pipes 39import Pipes
40 40
41 41type 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 -}
48type Codec = forall f m r . (Functor f , Monad m ) => 48type 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
52decodeStream :: Monad m 54decodeStream :: Monad m
53 => (B.ByteString -> DecodeResult) 55 => (B.ByteString -> DecodeResult)