]> git.immae.eu Git - github/fretlink/text-pipes.git/blobdiff - Pipes/Text/Encoding.hs
started generalizing lenses
[github/fretlink/text-pipes.git] / Pipes / Text / Encoding.hs
index 991000f57dcaeef6621b284665c8cbb2dd6293a2..99433b779b7dc9e4b3f65e25158aa157a1e8d3fe 100644 (file)
@@ -64,6 +64,9 @@ import Pipes
 type Lens'_ a b = forall f . Functor f => (b -> f b) -> (a -> f a)
 type Iso'_ a b = forall f p . (Functor f, Profunctor p) => p b (f b) -> p a (f a)
 
+type Lens s t a b = forall f . Functor f => (a -> f b) -> (s -> f t)
+
+
 {- $lenses
     The 'Codec' type is a simple specializion of 
     the @Lens'_@ type synonymn used by the standard lens libraries, 
@@ -79,11 +82,12 @@ type Iso'_ a b = forall f p . (Functor f, Profunctor p) => p b (f b) -> p a (f a
     -}
 
 type Codec
-    =  forall m r
+    =  forall m x y 
     .  Monad m
-    => Lens'_ (Producer ByteString m r)
-             (Producer Text m (Producer ByteString m r))
-
+    => Lens (Producer ByteString m x)
+            (Producer ByteString m y)
+            (Producer Text m (Producer ByteString m x))
+            (Producer Text m (Producer ByteString m y))
 {- | 'decode' is just the ordinary @view@ or @(^.)@ of the lens libraries;
       exported here under a name appropriate to the material. All of these are
       the same: