From c3c19f9b4f0564f3fae39a18555f6cfb322ee7c9 Mon Sep 17 00:00:00 2001 From: michaelt Date: Sun, 15 Jun 2014 18:16:42 -0400 Subject: started generalizing lenses --- Pipes/Text/Encoding.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Pipes/Text') diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs index 991000f..99433b7 100644 --- a/Pipes/Text/Encoding.hs +++ b/Pipes/Text/Encoding.hs @@ -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: -- cgit v1.2.3