aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes/Text/Encoding.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Pipes/Text/Encoding.hs')
-rw-r--r--Pipes/Text/Encoding.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs
index e00cd43..991000f 100644
--- a/Pipes/Text/Encoding.hs
+++ b/Pipes/Text/Encoding.hs
@@ -41,10 +41,13 @@ module Pipes.Text.Encoding
41 , decodeAscii 41 , decodeAscii
42 , encodeIso8859_1 42 , encodeIso8859_1
43 , decodeIso8859_1 43 , decodeIso8859_1
44 , Lens'_
45 , Iso'_
44 ) 46 )
45 where 47 where
46 48
47import Data.Functor.Constant (Constant(..)) 49import Data.Functor.Constant (Constant(..))
50import Data.Profunctor (Profunctor)
48import Data.Char (ord) 51import Data.Char (ord)
49import Data.ByteString as B 52import Data.ByteString as B
50import Data.ByteString (ByteString) 53import Data.ByteString (ByteString)
@@ -58,15 +61,16 @@ import Control.Monad (join)
58import Data.Word (Word8) 61import Data.Word (Word8)
59import Pipes 62import Pipes
60 63
61type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a) 64type Lens'_ a b = forall f . Functor f => (b -> f b) -> (a -> f a)
65type Iso'_ a b = forall f p . (Functor f, Profunctor p) => p b (f b) -> p a (f a)
62 66
63{- $lenses 67{- $lenses
64 The 'Codec' type is a simple specializion of 68 The 'Codec' type is a simple specializion of
65 the @Lens'@ type synonymn used by the standard lens libraries, 69 the @Lens'_@ type synonymn used by the standard lens libraries,
66 <http://hackage.haskell.org/package/lens lens> and 70 <http://hackage.haskell.org/package/lens lens> and
67 <http://hackage.haskell.org/package/lens-family lens-family>. That type, 71 <http://hackage.haskell.org/package/lens-family lens-family>. That type,
68 72
69> type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a) 73> type Lens'_ a b = forall f . Functor f => (b -> f b) -> (a -> f a)
70 74
71 is just an alias for a Prelude type. Thus you use any particular codec with 75 is just an alias for a Prelude type. Thus you use any particular codec with
72 the @view@ / @(^.)@ , @zoom@ and @over@ functions from either of those libraries; 76 the @view@ / @(^.)@ , @zoom@ and @over@ functions from either of those libraries;
@@ -77,7 +81,7 @@ type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a)
77type Codec 81type Codec
78 = forall m r 82 = forall m r
79 . Monad m 83 . Monad m
80 => Lens' (Producer ByteString m r) 84 => Lens'_ (Producer ByteString m r)
81 (Producer Text m (Producer ByteString m r)) 85 (Producer Text m (Producer ByteString m r))
82 86
83{- | 'decode' is just the ordinary @view@ or @(^.)@ of the lens libraries; 87{- | 'decode' is just the ordinary @view@ or @(^.)@ of the lens libraries;