proto-lens-combinators 0.1.0.4 → 0.1.0.6
raw patch · 3 files changed
+138/−127 lines, 3 filesdep +lens-family-coredep ~proto-lensdep ~proto-lens-protoc
Dependencies added: lens-family-core
Dependency ranges changed: proto-lens, proto-lens-protoc
Files
- dist/build/autogen/Proto/Combinators.hs +132/−122
- proto-lens-combinators.cabal +4/−3
- tests/combinators_test.hs +2/−2
dist/build/autogen/Proto/Combinators.hs view
@@ -1,7 +1,7 @@ {- This file was auto-generated from combinators.proto by the proto-lens-protoc program. -} {-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies,- MultiParamTypeClasses, FlexibleContexts, FlexibleInstances,- PatternSynonyms #-}+ UndecidableInstances, MultiParamTypeClasses, FlexibleContexts,+ FlexibleInstances, PatternSynonyms, MagicHash #-} {-# OPTIONS_GHC -fno-warn-unused-imports#-} module Proto.Combinators where import qualified Prelude@@ -22,70 +22,72 @@ import qualified Data.ProtoLens.Reexport.Data.Map as Data.Map import qualified Data.ProtoLens.Reexport.Data.ByteString as Data.ByteString+import qualified Data.ProtoLens.Reexport.Lens.Labels as Lens.Labels -data Foo = Foo{_Foo'quux :: Prelude.Maybe Data.Int.Int32,- _Foo'foo :: Prelude.Maybe Foo'Bar,- _Foo'bar :: Prelude.Maybe Foo'Bar,- _Foo'baz :: Prelude.Maybe Foo'Bar}+data Foo = Foo{_Foo'quux :: !(Prelude.Maybe Data.Int.Int32),+ _Foo'foo :: !(Prelude.Maybe Foo'Bar),+ _Foo'bar :: !(Prelude.Maybe Foo'Bar),+ _Foo'baz :: !(Prelude.Maybe Foo'Bar)} deriving (Prelude.Show, Prelude.Eq) -type instance Data.ProtoLens.Field "quux" Foo = Data.Int.Int32--instance Data.ProtoLens.HasField "quux" Foo Foo where- field _+instance (a ~ Data.Int.Int32, b ~ Data.Int.Int32,+ Prelude.Functor f) =>+ Lens.Labels.HasLens "quux" f Foo Foo a b+ where+ lensOf _ = (Prelude..) maybe'quux (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault) -type instance Data.ProtoLens.Field "maybe'quux" Foo =- Prelude.Maybe Data.Int.Int32--instance Data.ProtoLens.HasField "maybe'quux" Foo Foo where- field _+instance (a ~ Prelude.Maybe Data.Int.Int32,+ b ~ Prelude.Maybe Data.Int.Int32, Prelude.Functor f) =>+ Lens.Labels.HasLens "maybe'quux" f Foo Foo a b+ where+ lensOf _ = Lens.Family2.Unchecked.lens _Foo'quux (\ x__ y__ -> x__{_Foo'quux = y__}) -type instance Data.ProtoLens.Field "foo" Foo = Foo'Bar--instance Data.ProtoLens.HasField "foo" Foo Foo where- field _+instance (a ~ Foo'Bar, b ~ Foo'Bar, Prelude.Functor f) =>+ Lens.Labels.HasLens "foo" f Foo Foo a b+ where+ lensOf _ = (Prelude..) maybe'foo (Data.ProtoLens.maybeLens Data.Default.Class.def) -type instance Data.ProtoLens.Field "maybe'foo" Foo =- Prelude.Maybe Foo'Bar--instance Data.ProtoLens.HasField "maybe'foo" Foo Foo where- field _+instance (a ~ Prelude.Maybe Foo'Bar, b ~ Prelude.Maybe Foo'Bar,+ Prelude.Functor f) =>+ Lens.Labels.HasLens "maybe'foo" f Foo Foo a b+ where+ lensOf _ = Lens.Family2.Unchecked.lens _Foo'foo (\ x__ y__ -> x__{_Foo'foo = y__}) -type instance Data.ProtoLens.Field "bar" Foo = Foo'Bar--instance Data.ProtoLens.HasField "bar" Foo Foo where- field _+instance (a ~ Foo'Bar, b ~ Foo'Bar, Prelude.Functor f) =>+ Lens.Labels.HasLens "bar" f Foo Foo a b+ where+ lensOf _ = (Prelude..) maybe'bar (Data.ProtoLens.maybeLens Data.Default.Class.def) -type instance Data.ProtoLens.Field "maybe'bar" Foo =- Prelude.Maybe Foo'Bar--instance Data.ProtoLens.HasField "maybe'bar" Foo Foo where- field _+instance (a ~ Prelude.Maybe Foo'Bar, b ~ Prelude.Maybe Foo'Bar,+ Prelude.Functor f) =>+ Lens.Labels.HasLens "maybe'bar" f Foo Foo a b+ where+ lensOf _ = Lens.Family2.Unchecked.lens _Foo'bar (\ x__ y__ -> x__{_Foo'bar = y__}) -type instance Data.ProtoLens.Field "baz" Foo = Foo'Bar--instance Data.ProtoLens.HasField "baz" Foo Foo where- field _+instance (a ~ Foo'Bar, b ~ Foo'Bar, Prelude.Functor f) =>+ Lens.Labels.HasLens "baz" f Foo Foo a b+ where+ lensOf _ = (Prelude..) maybe'baz (Data.ProtoLens.maybeLens Data.Default.Class.def) -type instance Data.ProtoLens.Field "maybe'baz" Foo =- Prelude.Maybe Foo'Bar--instance Data.ProtoLens.HasField "maybe'baz" Foo Foo where- field _+instance (a ~ Prelude.Maybe Foo'Bar, b ~ Prelude.Maybe Foo'Bar,+ Prelude.Functor f) =>+ Lens.Labels.HasLens "maybe'baz" f Foo Foo a b+ where+ lensOf _ = Lens.Family2.Unchecked.lens _Foo'baz (\ x__ y__ -> x__{_Foo'baz = y__}) @@ -101,21 +103,25 @@ (Data.ProtoLens.Int32Field :: Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) (Data.ProtoLens.OptionalField maybe'quux)+ :: Data.ProtoLens.FieldDescriptor Foo foo__field_descriptor = Data.ProtoLens.FieldDescriptor "foo" (Data.ProtoLens.MessageField :: Data.ProtoLens.FieldTypeDescriptor Foo'Bar) (Data.ProtoLens.OptionalField maybe'foo)+ :: Data.ProtoLens.FieldDescriptor Foo bar__field_descriptor = Data.ProtoLens.FieldDescriptor "bar" (Data.ProtoLens.MessageField :: Data.ProtoLens.FieldTypeDescriptor Foo'Bar) (Data.ProtoLens.OptionalField maybe'bar)+ :: Data.ProtoLens.FieldDescriptor Foo baz__field_descriptor = Data.ProtoLens.FieldDescriptor "baz" (Data.ProtoLens.MessageField :: Data.ProtoLens.FieldTypeDescriptor Foo'Bar) (Data.ProtoLens.OptionalField maybe'baz)+ :: Data.ProtoLens.FieldDescriptor Foo in Data.ProtoLens.MessageDescriptor (Data.Map.fromList@@ -128,37 +134,39 @@ ("bar", bar__field_descriptor), ("baz", baz__field_descriptor)]) data Foo'Bar = Foo'Bar{_Foo'Bar'fizz ::- Prelude.Maybe Data.Int.Int32,- _Foo'Bar'buzz :: Prelude.Maybe Data.Text.Text}+ !(Prelude.Maybe Data.Int.Int32),+ _Foo'Bar'buzz :: !(Prelude.Maybe Data.Text.Text)} deriving (Prelude.Show, Prelude.Eq) -type instance Data.ProtoLens.Field "fizz" Foo'Bar = Data.Int.Int32--instance Data.ProtoLens.HasField "fizz" Foo'Bar Foo'Bar where- field _+instance (a ~ Data.Int.Int32, b ~ Data.Int.Int32,+ Prelude.Functor f) =>+ Lens.Labels.HasLens "fizz" f Foo'Bar Foo'Bar a b+ where+ lensOf _ = (Prelude..) maybe'fizz (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault) -type instance Data.ProtoLens.Field "maybe'fizz" Foo'Bar =- Prelude.Maybe Data.Int.Int32--instance Data.ProtoLens.HasField "maybe'fizz" Foo'Bar Foo'Bar where- field _+instance (a ~ Prelude.Maybe Data.Int.Int32,+ b ~ Prelude.Maybe Data.Int.Int32, Prelude.Functor f) =>+ Lens.Labels.HasLens "maybe'fizz" f Foo'Bar Foo'Bar a b+ where+ lensOf _ = Lens.Family2.Unchecked.lens _Foo'Bar'fizz (\ x__ y__ -> x__{_Foo'Bar'fizz = y__}) -type instance Data.ProtoLens.Field "buzz" Foo'Bar = Data.Text.Text--instance Data.ProtoLens.HasField "buzz" Foo'Bar Foo'Bar where- field _+instance (a ~ Data.Text.Text, b ~ Data.Text.Text,+ Prelude.Functor f) =>+ Lens.Labels.HasLens "buzz" f Foo'Bar Foo'Bar a b+ where+ lensOf _ = (Prelude..) maybe'buzz (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault) -type instance Data.ProtoLens.Field "maybe'buzz" Foo'Bar =- Prelude.Maybe Data.Text.Text--instance Data.ProtoLens.HasField "maybe'buzz" Foo'Bar Foo'Bar where- field _+instance (a ~ Prelude.Maybe Data.Text.Text,+ b ~ Prelude.Maybe Data.Text.Text, Prelude.Functor f) =>+ Lens.Labels.HasLens "maybe'buzz" f Foo'Bar Foo'Bar a b+ where+ lensOf _ = Lens.Family2.Unchecked.lens _Foo'Bar'buzz (\ x__ y__ -> x__{_Foo'Bar'buzz = y__}) @@ -174,11 +182,13 @@ (Data.ProtoLens.Int32Field :: Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) (Data.ProtoLens.OptionalField maybe'fizz)+ :: Data.ProtoLens.FieldDescriptor Foo'Bar buzz__field_descriptor = Data.ProtoLens.FieldDescriptor "buzz" (Data.ProtoLens.StringField :: Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) (Data.ProtoLens.OptionalField maybe'buzz)+ :: Data.ProtoLens.FieldDescriptor Foo'Bar in Data.ProtoLens.MessageDescriptor (Data.Map.fromList@@ -189,97 +199,97 @@ ("buzz", buzz__field_descriptor)]) bar ::- forall msg msg' . Data.ProtoLens.HasField "bar" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "bar" msg)- (Data.ProtoLens.Field "bar" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "bar" f s t a b) =>+ Lens.Family2.LensLike f s t a b bar- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "bar")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "bar") baz ::- forall msg msg' . Data.ProtoLens.HasField "baz" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "baz" msg)- (Data.ProtoLens.Field "baz" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "baz" f s t a b) =>+ Lens.Family2.LensLike f s t a b baz- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "baz")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "baz") buzz ::- forall msg msg' . Data.ProtoLens.HasField "buzz" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "buzz" msg)- (Data.ProtoLens.Field "buzz" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "buzz" f s t a b) =>+ Lens.Family2.LensLike f s t a b buzz- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "buzz")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "buzz") fizz ::- forall msg msg' . Data.ProtoLens.HasField "fizz" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "fizz" msg)- (Data.ProtoLens.Field "fizz" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "fizz" f s t a b) =>+ Lens.Family2.LensLike f s t a b fizz- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "fizz")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "fizz") foo ::- forall msg msg' . Data.ProtoLens.HasField "foo" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "foo" msg)- (Data.ProtoLens.Field "foo" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "foo" f s t a b) =>+ Lens.Family2.LensLike f s t a b foo- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "foo")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "foo") maybe'bar ::- forall msg msg' . Data.ProtoLens.HasField "maybe'bar" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "maybe'bar" msg)- (Data.ProtoLens.Field "maybe'bar" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "maybe'bar" f s t a b) =>+ Lens.Family2.LensLike f s t a b maybe'bar- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "maybe'bar")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'bar") maybe'baz ::- forall msg msg' . Data.ProtoLens.HasField "maybe'baz" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "maybe'baz" msg)- (Data.ProtoLens.Field "maybe'baz" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "maybe'baz" f s t a b) =>+ Lens.Family2.LensLike f s t a b maybe'baz- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "maybe'baz")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'baz") maybe'buzz ::- forall msg msg' . Data.ProtoLens.HasField "maybe'buzz" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "maybe'buzz" msg)- (Data.ProtoLens.Field "maybe'buzz" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "maybe'buzz" f s t a b) =>+ Lens.Family2.LensLike f s t a b maybe'buzz- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "maybe'buzz")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'buzz") maybe'fizz ::- forall msg msg' . Data.ProtoLens.HasField "maybe'fizz" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "maybe'fizz" msg)- (Data.ProtoLens.Field "maybe'fizz" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "maybe'fizz" f s t a b) =>+ Lens.Family2.LensLike f s t a b maybe'fizz- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "maybe'fizz")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'fizz") maybe'foo ::- forall msg msg' . Data.ProtoLens.HasField "maybe'foo" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "maybe'foo" msg)- (Data.ProtoLens.Field "maybe'foo" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "maybe'foo" f s t a b) =>+ Lens.Family2.LensLike f s t a b maybe'foo- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "maybe'foo")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'foo") maybe'quux ::- forall msg msg' . Data.ProtoLens.HasField "maybe'quux" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "maybe'quux" msg)- (Data.ProtoLens.Field "maybe'quux" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "maybe'quux" f s t a b) =>+ Lens.Family2.LensLike f s t a b maybe'quux- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "maybe'quux")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'quux") quux ::- forall msg msg' . Data.ProtoLens.HasField "quux" msg msg' =>- Lens.Family2.Lens msg msg' (Data.ProtoLens.Field "quux" msg)- (Data.ProtoLens.Field "quux" msg')+ forall x f s t a b .+ (Prelude.Functor f, Lens.Labels.HasLens "quux" f s t a b) =>+ Lens.Family2.LensLike f s t a b quux- = Data.ProtoLens.field- (Data.ProtoLens.ProxySym :: Data.ProtoLens.ProxySym "quux")+ = Lens.Labels.lensOf+ ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "quux")
proto-lens-combinators.cabal view
@@ -1,5 +1,5 @@ name: proto-lens-combinators-version: 0.1.0.4+version: 0.1.0.6 synopsis: Utilities functions to proto-lens. description: Useful things for working with protos.@@ -19,9 +19,9 @@ default-language: Haskell2010 hs-source-dirs: src exposed-modules: Data.ProtoLens.Combinators- build-depends: proto-lens == 0.1.*+ build-depends: proto-lens >= 0.1 && < 0.3 -- Used by the custom Setup script (for the test-suite).- , proto-lens-protoc == 0.1.*+ , proto-lens-protoc >= 0.1 && < 0.3 , base >= 4.8 && < 4.10 , data-default-class >= 0.0 && < 0.2 , lens-family == 1.2.*@@ -36,6 +36,7 @@ build-depends: HUnit , base , lens-family+ , lens-family-core , proto-lens , proto-lens-combinators , proto-lens-protoc
tests/combinators_test.hs view
@@ -9,8 +9,8 @@ import Data.ProtoLens (def) import Data.ProtoLens.Combinators-import Lens.Family2 ((^.), (.~), (&))-import Lens.Family2.State ((.=), (<~), use, zoom)+import Lens.Family ((^.), (.~), (&))+import Lens.Family.State ((.=), (<~), use, zoom) import Proto.Combinators import Test.Framework (defaultMain) import Test.Framework.Providers.HUnit (hUnitTestToTests)