aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes/Text
diff options
context:
space:
mode:
Diffstat (limited to 'Pipes/Text')
-rw-r--r--Pipes/Text/Encoding.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs
index e242411..a576a42 100644
--- a/Pipes/Text/Encoding.hs
+++ b/Pipes/Text/Encoding.hs
@@ -220,14 +220,17 @@ type Codec
220 220
221 221
222{- | @decode@ is just the ordinary @view@ or @(^.)@ of the lens libraries; 222{- | @decode@ is just the ordinary @view@ or @(^.)@ of the lens libraries;
223 exported here under a name appropriate to the material. Thus 223 exported here under a name appropriate to the material.
224 Thus given a bytestring producer called @bytes@ we have
224 225
225> decode utf8 bytes :: Producer Text IO (Producer ByteString IO ()) 226> decode utf8 bytes :: Producer Text IO (Producer ByteString IO ())
226 227
227 All of these are thus the same: 228 All of these are thus the same:
228 229
229> decode utf8 bytes = view utf8 bytes = bytes ^. utf8 = decodeUtf8 bytes 230> decode utf8 bytes
230 231> view utf8 bytes
232> bytes ^. utf8
233> decodeUtf8 bytes
231 234
232-} 235-}
233 236
@@ -244,9 +247,11 @@ decode codec a = getConstant (codec Constant a)
244 returned as a Left value; in the happy case, a Right value is returned 247 returned as a Left value; in the happy case, a Right value is returned
245 with the anticipated return value for the original bytestring producer. 248 with the anticipated return value for the original bytestring producer.
246 249
247 Again, all of these are the same 250 Given a bytestring producer called @bytes@ all of these will be the same:
248 251
249> decode (utf8 . eof) bytes = view (utf8 . eof) p = p^.utf8.eof 252> decode (utf8 . eof) bytes
253> view (utf8 . eof) bytes
254> bytes^.utf8.eof
250 255
251-} 256-}
252 257