diff options
author | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-05-30 09:28:49 -0400 |
---|---|---|
committer | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-05-30 09:28:49 -0400 |
commit | a31032bb469a2d7eef089d54fb5069405f0710c9 (patch) | |
tree | 35093d22d070ef91795e081108941a32388c34e2 /Pipes/Text | |
parent | 7abdd20141969912b3ed2fd067d7328ab7ad267b (diff) | |
download | text-pipes-a31032bb469a2d7eef089d54fb5069405f0710c9.tar.gz text-pipes-a31032bb469a2d7eef089d54fb5069405f0710c9.tar.zst text-pipes-a31032bb469a2d7eef089d54fb5069405f0710c9.zip |
commentary
Diffstat (limited to 'Pipes/Text')
-rw-r--r-- | Pipes/Text/Encoding.hs | 15 |
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 | ||