proto-lens-jsonpb 0.1.0.0 → 0.2.0.0
raw patch · 5 files changed
+1/−2980 lines, 5 filesdep −microlensdep −proto-lensdep −proto-lens-jsonpbPVP ok
version bump matches the API change (PVP)
Dependencies removed: microlens, proto-lens, proto-lens-jsonpb
API changes (from Hackage documentation)
Files
- app/Main.hs +0/−23
- app/Proto/Haberdasher.hs +0/−2279
- app/Proto/Haberdasher_Fields.hs +0/−243
- app/Proto/Haberdasher_JSON.hs +0/−419
- proto-lens-jsonpb.cabal +1/−16
− app/Main.hs
@@ -1,23 +0,0 @@-module Main where--import Data.Aeson (ToJSON (..), fromEncoding)-import Data.ByteString.Builder (toLazyByteString)-import qualified Data.ByteString.Lazy.Char8 as BC-import Data.ProtoLens (defMessage)-import Lens.Micro-import Proto.Haberdasher as P-import Proto.Haberdasher_Fields as P-import Proto.Haberdasher_JSON ()--main :: IO ()-main = do- print mkPong- BC.putStrLn $ toLazyByteString (fromEncoding (toEncoding mkPong))- where- mkPong :: Pong- mkPong = defMessage- & P.status .~ "OK"- & P.stuff .~ mempty- & P.maybe'extra .~ Nothing- & P.id .~ 1- & P.type' .~ "hello"
− app/Proto/Haberdasher.hs
@@ -1,2279 +0,0 @@-{- This file was auto-generated from haberdasher.proto by the proto-lens-protoc program. -}-{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies,- UndecidableInstances, GeneralizedNewtypeDeriving,- MultiParamTypeClasses, FlexibleContexts, FlexibleInstances,- PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds,- BangPatterns, TypeApplications #-}-{-# OPTIONS_GHC -fno-warn-unused-imports#-}-{-# OPTIONS_GHC -fno-warn-duplicate-exports#-}-module Proto.Haberdasher- (Haberdasher(..), Health(..), Bill(), Bill'Extra(..),- _Bill'VatInfo, _Bill'ZipCode, Bill'BillingStatus(..),- Bill'BillingStatus(), Bill'BillingStatus'UnrecognizedValue,- ChangeType(..), ChangeType(), ChangeType'UnrecognizedValue,- DeletedTerm(), Demo(), DiffTreeVertex(),- DiffTreeVertex'DiffTerm(..), _DiffTreeVertex'Deleted,- _DiffTreeVertex'Inserted, EmptyMessage(), FieldTestMessage(),- Hat(), InsertedTerm(), Ping(), Pong(), Pong'Extra(..), _Pong'T,- _Pong'U, Price(), Size(), Test())- where-import qualified Data.ProtoLens.Runtime.Control.DeepSeq- as Control.DeepSeq-import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Prism- as Data.ProtoLens.Prism-import qualified Data.ProtoLens.Runtime.Prelude as Prelude-import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int-import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid-import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word-import qualified Data.ProtoLens.Runtime.Data.ProtoLens- as Data.ProtoLens-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes- as Data.ProtoLens.Encoding.Bytes-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing- as Data.ProtoLens.Encoding.Growing-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe- as Data.ProtoLens.Encoding.Parser.Unsafe-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire- as Data.ProtoLens.Encoding.Wire-import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field- as Data.ProtoLens.Field-import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum- as Data.ProtoLens.Message.Enum-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types- as Data.ProtoLens.Service.Types-import qualified Data.ProtoLens.Runtime.Lens.Family2- as Lens.Family2-import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked- as Lens.Family2.Unchecked-import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text-import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map-import qualified Data.ProtoLens.Runtime.Data.ByteString- as Data.ByteString-import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8- as Data.ByteString.Char8-import qualified Data.ProtoLens.Runtime.Data.Text.Encoding- as Data.Text.Encoding-import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector-import qualified Data.ProtoLens.Runtime.Data.Vector.Generic- as Data.Vector.Generic-import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed- as Data.Vector.Unboxed-import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read--{- | Fields :-- * 'Proto.Haberdasher_Fields.price' @:: Lens' Bill Price@- * 'Proto.Haberdasher_Fields.maybe'price' @:: Lens' Bill (Prelude.Maybe Price)@- * 'Proto.Haberdasher_Fields.status' @:: Lens' Bill Bill'BillingStatus@- * 'Proto.Haberdasher_Fields.maybe'extra' @:: Lens' Bill (Prelude.Maybe Bill'Extra)@- * 'Proto.Haberdasher_Fields.maybe'vatInfo' @:: Lens' Bill (Prelude.Maybe Data.Text.Text)@- * 'Proto.Haberdasher_Fields.vatInfo' @:: Lens' Bill Data.Text.Text@- * 'Proto.Haberdasher_Fields.maybe'zipCode' @:: Lens' Bill (Prelude.Maybe Data.Text.Text)@- * 'Proto.Haberdasher_Fields.zipCode' @:: Lens' Bill Data.Text.Text@- -}-data Bill = Bill{_Bill'price :: !(Prelude.Maybe Price),- _Bill'status :: !Bill'BillingStatus,- _Bill'extra :: !(Prelude.Maybe Bill'Extra),- _Bill'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Bill where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-data Bill'Extra = Bill'VatInfo !Data.Text.Text- | Bill'ZipCode !Data.Text.Text- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)-instance Data.ProtoLens.Field.HasField Bill "price" (Price) where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'price- (\ x__ y__ -> x__{_Bill'price = y__}))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage-instance Data.ProtoLens.Field.HasField Bill "maybe'price"- (Prelude.Maybe Price)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'price- (\ x__ y__ -> x__{_Bill'price = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Bill "status"- (Bill'BillingStatus)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'status- (\ x__ y__ -> x__{_Bill'status = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Bill "maybe'extra"- (Prelude.Maybe Bill'Extra)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'extra- (\ x__ y__ -> x__{_Bill'extra = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Bill "maybe'vatInfo"- (Prelude.Maybe Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'extra- (\ x__ y__ -> x__{_Bill'extra = y__}))- Prelude..- Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Bill'VatInfo x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Bill'VatInfo y__)-instance Data.ProtoLens.Field.HasField Bill "vatInfo"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'extra- (\ x__ y__ -> x__{_Bill'extra = y__}))- Prelude..- (Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Bill'VatInfo x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Bill'VatInfo y__))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault-instance Data.ProtoLens.Field.HasField Bill "maybe'zipCode"- (Prelude.Maybe Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'extra- (\ x__ y__ -> x__{_Bill'extra = y__}))- Prelude..- Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Bill'ZipCode x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Bill'ZipCode y__)-instance Data.ProtoLens.Field.HasField Bill "zipCode"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Bill'extra- (\ x__ y__ -> x__{_Bill'extra = y__}))- Prelude..- (Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Bill'ZipCode x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Bill'ZipCode y__))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault-instance Data.ProtoLens.Message Bill where- messageName _ = Data.Text.pack "example.haberdasher.Bill"- fieldsByTag- = let price__field_descriptor- = Data.ProtoLens.FieldDescriptor "price"- (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::- Data.ProtoLens.FieldTypeDescriptor Price)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe'price"))- :: Data.ProtoLens.FieldDescriptor Bill- status__field_descriptor- = Data.ProtoLens.FieldDescriptor "status"- (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::- Data.ProtoLens.FieldTypeDescriptor Bill'BillingStatus)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"status"))- :: Data.ProtoLens.FieldDescriptor Bill- vatInfo__field_descriptor- = Data.ProtoLens.FieldDescriptor "vat_info"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe'vatInfo"))- :: Data.ProtoLens.FieldDescriptor Bill- zipCode__field_descriptor- = Data.ProtoLens.FieldDescriptor "zip_code"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe'zipCode"))- :: Data.ProtoLens.FieldDescriptor Bill- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, price__field_descriptor),- (Data.ProtoLens.Tag 2, status__field_descriptor),- (Data.ProtoLens.Tag 3, vatInfo__field_descriptor),- (Data.ProtoLens.Tag 4, zipCode__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Bill'_unknownFields- (\ x__ y__ -> x__{_Bill'_unknownFields = y__})- defMessage- = Bill{_Bill'price = Prelude.Nothing,- _Bill'status = Data.ProtoLens.fieldDefault,- _Bill'extra = Prelude.Nothing, _Bill'_unknownFields = ([])}- parseMessage- = let loop :: Bill -> Data.ProtoLens.Encoding.Bytes.Parser Bill- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 10 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.isolate- (Prelude.fromIntegral len)- Data.ProtoLens.parseMessage)- Data.ProtoLens.Encoding.Bytes.<?> "price"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"price") y- x)- 16 -> do y <- (Prelude.fmap Prelude.toEnum- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt))- Data.ProtoLens.Encoding.Bytes.<?> "status"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"status")- y- x)- 26 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "vat_info"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"vatInfo")- y- x)- 34 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "zip_code"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"zipCode")- y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "Bill"- buildMessage- = (\ _x ->- (case- Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'price") _x of- (Prelude.Nothing) -> Data.Monoid.mempty- Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 10)- Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<>- Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.ProtoLens.encodeMessage)- _v)- Data.Monoid.<>- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"status") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 16) Data.Monoid.<>- (((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- Prelude.. Prelude.fromEnum)- _v)- Data.Monoid.<>- (case- Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'extra") _x of- (Prelude.Nothing) -> Data.Monoid.mempty- Prelude.Just- (Bill'VatInfo v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 26)- Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral- (Data.ByteString.length bs)))- Data.Monoid.<>- Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- v- Prelude.Just- (Bill'ZipCode v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 34)- Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral- (Data.ByteString.length bs)))- Data.Monoid.<>- Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Bill where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Bill'_unknownFields x__)- (Control.DeepSeq.deepseq (_Bill'price x__)- (Control.DeepSeq.deepseq (_Bill'status x__)- (Control.DeepSeq.deepseq (_Bill'extra x__) (())))))-instance Control.DeepSeq.NFData Bill'Extra where- rnf (Bill'VatInfo x__) = Control.DeepSeq.rnf x__- rnf (Bill'ZipCode x__) = Control.DeepSeq.rnf x__-_Bill'VatInfo ::- Data.ProtoLens.Prism.Prism' Bill'Extra Data.Text.Text-_Bill'VatInfo- = Data.ProtoLens.Prism.prism' Bill'VatInfo- (\ p__ ->- case p__ of- Bill'VatInfo p__val -> Prelude.Just p__val- _otherwise -> Prelude.Nothing)-_Bill'ZipCode ::- Data.ProtoLens.Prism.Prism' Bill'Extra Data.Text.Text-_Bill'ZipCode- = Data.ProtoLens.Prism.prism' Bill'ZipCode- (\ p__ ->- case p__ of- Bill'ZipCode p__val -> Prelude.Just p__val- _otherwise -> Prelude.Nothing)-newtype Bill'BillingStatus'UnrecognizedValue = Bill'BillingStatus'UnrecognizedValue Data.Int.Int32- deriving (Prelude.Eq, Prelude.Ord, Prelude.Show)-data Bill'BillingStatus = Bill'UN_PAID- | Bill'PAID- | Bill'BillingStatus'Unrecognized !Bill'BillingStatus'UnrecognizedValue- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)-instance Data.ProtoLens.MessageEnum Bill'BillingStatus where- maybeToEnum 0 = Prelude.Just Bill'UN_PAID- maybeToEnum 1 = Prelude.Just Bill'PAID- maybeToEnum k- = Prelude.Just- (Bill'BillingStatus'Unrecognized- (Bill'BillingStatus'UnrecognizedValue (Prelude.fromIntegral k)))- showEnum Bill'UN_PAID = "UN_PAID"- showEnum Bill'PAID = "PAID"- showEnum- (Bill'BillingStatus'Unrecognized- (Bill'BillingStatus'UnrecognizedValue k))- = Prelude.show k- readEnum k- | (k) Prelude.== "UN_PAID" = Prelude.Just Bill'UN_PAID- | (k) Prelude.== "PAID" = Prelude.Just Bill'PAID- readEnum k- = (Text.Read.readMaybe k) Prelude.>>= Data.ProtoLens.maybeToEnum-instance Prelude.Bounded Bill'BillingStatus where- minBound = Bill'UN_PAID- maxBound = Bill'PAID-instance Prelude.Enum Bill'BillingStatus where- toEnum k__- = Prelude.maybe- (Prelude.error- (("toEnum: unknown value for enum BillingStatus: ") Prelude.++- Prelude.show k__))- Prelude.id- (Data.ProtoLens.maybeToEnum k__)- fromEnum Bill'UN_PAID = 0- fromEnum Bill'PAID = 1- fromEnum- (Bill'BillingStatus'Unrecognized- (Bill'BillingStatus'UnrecognizedValue k))- = Prelude.fromIntegral k- succ Bill'PAID- = Prelude.error- "Bill'BillingStatus.succ: bad argument Bill'PAID. This value would be out of bounds."- succ Bill'UN_PAID = Bill'PAID- succ (Bill'BillingStatus'Unrecognized _)- = Prelude.error- "Bill'BillingStatus.succ: bad argument: unrecognized value"- pred Bill'UN_PAID- = Prelude.error- "Bill'BillingStatus.pred: bad argument Bill'UN_PAID. This value would be out of bounds."- pred Bill'PAID = Bill'UN_PAID- pred (Bill'BillingStatus'Unrecognized _)- = Prelude.error- "Bill'BillingStatus.pred: bad argument: unrecognized value"- enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom- enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo- enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen- enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo-instance Data.ProtoLens.FieldDefault Bill'BillingStatus where- fieldDefault = Bill'UN_PAID-instance Control.DeepSeq.NFData Bill'BillingStatus where- rnf x__ = Prelude.seq x__ (())-newtype ChangeType'UnrecognizedValue = ChangeType'UnrecognizedValue Data.Int.Int32- deriving (Prelude.Eq, Prelude.Ord, Prelude.Show)-data ChangeType = ADDED- | REMOVED- | ChangeType'Unrecognized !ChangeType'UnrecognizedValue- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)-instance Data.ProtoLens.MessageEnum ChangeType where- maybeToEnum 0 = Prelude.Just ADDED- maybeToEnum 1 = Prelude.Just REMOVED- maybeToEnum k- = Prelude.Just- (ChangeType'Unrecognized- (ChangeType'UnrecognizedValue (Prelude.fromIntegral k)))- showEnum ADDED = "ADDED"- showEnum REMOVED = "REMOVED"- showEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k))- = Prelude.show k- readEnum k- | (k) Prelude.== "ADDED" = Prelude.Just ADDED- | (k) Prelude.== "REMOVED" = Prelude.Just REMOVED- readEnum k- = (Text.Read.readMaybe k) Prelude.>>= Data.ProtoLens.maybeToEnum-instance Prelude.Bounded ChangeType where- minBound = ADDED- maxBound = REMOVED-instance Prelude.Enum ChangeType where- toEnum k__- = Prelude.maybe- (Prelude.error- (("toEnum: unknown value for enum ChangeType: ") Prelude.++- Prelude.show k__))- Prelude.id- (Data.ProtoLens.maybeToEnum k__)- fromEnum ADDED = 0- fromEnum REMOVED = 1- fromEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k))- = Prelude.fromIntegral k- succ REMOVED- = Prelude.error- "ChangeType.succ: bad argument REMOVED. This value would be out of bounds."- succ ADDED = REMOVED- succ (ChangeType'Unrecognized _)- = Prelude.error "ChangeType.succ: bad argument: unrecognized value"- pred ADDED- = Prelude.error- "ChangeType.pred: bad argument ADDED. This value would be out of bounds."- pred REMOVED = ADDED- pred (ChangeType'Unrecognized _)- = Prelude.error "ChangeType.pred: bad argument: unrecognized value"- enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom- enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo- enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen- enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo-instance Data.ProtoLens.FieldDefault ChangeType where- fieldDefault = ADDED-instance Control.DeepSeq.NFData ChangeType where- rnf x__ = Prelude.seq x__ (())-{- | Fields :-- * 'Proto.Haberdasher_Fields.term' @:: Lens' DeletedTerm Data.Text.Text@- -}-data DeletedTerm = DeletedTerm{_DeletedTerm'term ::- !Data.Text.Text,- _DeletedTerm'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show DeletedTerm where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField DeletedTerm "term"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DeletedTerm'term- (\ x__ y__ -> x__{_DeletedTerm'term = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message DeletedTerm where- messageName _ = Data.Text.pack "example.haberdasher.DeletedTerm"- fieldsByTag- = let term__field_descriptor- = Data.ProtoLens.FieldDescriptor "term"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"term"))- :: Data.ProtoLens.FieldDescriptor DeletedTerm- in- Data.Map.fromList [(Data.ProtoLens.Tag 1, term__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _DeletedTerm'_unknownFields- (\ x__ y__ -> x__{_DeletedTerm'_unknownFields = y__})- defMessage- = DeletedTerm{_DeletedTerm'term = Data.ProtoLens.fieldDefault,- _DeletedTerm'_unknownFields = ([])}- parseMessage- = let loop ::- DeletedTerm -> Data.ProtoLens.Encoding.Bytes.Parser DeletedTerm- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 10 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "term"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "DeletedTerm"- buildMessage- = (\ _x ->- (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData DeletedTerm where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_DeletedTerm'_unknownFields x__)- (Control.DeepSeq.deepseq (_DeletedTerm'term x__) (())))-{- | Fields :-- * 'Proto.Haberdasher_Fields.changeType' @:: Lens' Demo ChangeType@- -}-data Demo = Demo{_Demo'changeType :: !ChangeType,- _Demo'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Demo where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField Demo "changeType"- (ChangeType)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Demo'changeType- (\ x__ y__ -> x__{_Demo'changeType = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message Demo where- messageName _ = Data.Text.pack "example.haberdasher.Demo"- fieldsByTag- = let changeType__field_descriptor- = Data.ProtoLens.FieldDescriptor "change_type"- (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::- Data.ProtoLens.FieldTypeDescriptor ChangeType)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"changeType"))- :: Data.ProtoLens.FieldDescriptor Demo- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, changeType__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Demo'_unknownFields- (\ x__ y__ -> x__{_Demo'_unknownFields = y__})- defMessage- = Demo{_Demo'changeType = Data.ProtoLens.fieldDefault,- _Demo'_unknownFields = ([])}- parseMessage- = let loop :: Demo -> Data.ProtoLens.Encoding.Bytes.Parser Demo- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 8 -> do y <- (Prelude.fmap Prelude.toEnum- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt))- Data.ProtoLens.Encoding.Bytes.<?> "change_type"- loop- (Lens.Family2.set- (Data.ProtoLens.Field.field @"changeType")- y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "Demo"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"changeType") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<>- (((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- Prelude.. Prelude.fromEnum)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Demo where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Demo'_unknownFields x__)- (Control.DeepSeq.deepseq (_Demo'changeType x__) (())))-{- | Fields :-- * 'Proto.Haberdasher_Fields.diffVertexId' @:: Lens' DiffTreeVertex Data.Int.Int32@- * 'Proto.Haberdasher_Fields.maybe'diffTerm' @:: Lens' DiffTreeVertex (Prelude.Maybe DiffTreeVertex'DiffTerm)@- * 'Proto.Haberdasher_Fields.maybe'deleted' @:: Lens' DiffTreeVertex (Prelude.Maybe DeletedTerm)@- * 'Proto.Haberdasher_Fields.deleted' @:: Lens' DiffTreeVertex DeletedTerm@- * 'Proto.Haberdasher_Fields.maybe'inserted' @:: Lens' DiffTreeVertex (Prelude.Maybe InsertedTerm)@- * 'Proto.Haberdasher_Fields.inserted' @:: Lens' DiffTreeVertex InsertedTerm@- -}-data DiffTreeVertex = DiffTreeVertex{_DiffTreeVertex'diffVertexId- :: !Data.Int.Int32,- _DiffTreeVertex'diffTerm ::- !(Prelude.Maybe DiffTreeVertex'DiffTerm),- _DiffTreeVertex'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show DiffTreeVertex where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-data DiffTreeVertex'DiffTerm = DiffTreeVertex'Deleted !DeletedTerm- | DiffTreeVertex'Inserted !InsertedTerm- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)-instance Data.ProtoLens.Field.HasField DiffTreeVertex- "diffVertexId"- (Data.Int.Int32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffVertexId- (\ x__ y__ -> x__{_DiffTreeVertex'diffVertexId = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField DiffTreeVertex- "maybe'diffTerm"- (Prelude.Maybe DiffTreeVertex'DiffTerm)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm- (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField DiffTreeVertex- "maybe'deleted"- (Prelude.Maybe DeletedTerm)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm- (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__}))- Prelude..- Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (DiffTreeVertex'Deleted x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap DiffTreeVertex'Deleted y__)-instance Data.ProtoLens.Field.HasField DiffTreeVertex "deleted"- (DeletedTerm)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm- (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__}))- Prelude..- (Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (DiffTreeVertex'Deleted x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap DiffTreeVertex'Deleted y__))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage-instance Data.ProtoLens.Field.HasField DiffTreeVertex- "maybe'inserted"- (Prelude.Maybe InsertedTerm)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm- (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__}))- Prelude..- Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (DiffTreeVertex'Inserted x__val) -> Prelude.Just- x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap DiffTreeVertex'Inserted y__)-instance Data.ProtoLens.Field.HasField DiffTreeVertex "inserted"- (InsertedTerm)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm- (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__}))- Prelude..- (Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (DiffTreeVertex'Inserted x__val) -> Prelude.Just- x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap DiffTreeVertex'Inserted y__))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage-instance Data.ProtoLens.Message DiffTreeVertex where- messageName _ = Data.Text.pack "example.haberdasher.DiffTreeVertex"- fieldsByTag- = let diffVertexId__field_descriptor- = Data.ProtoLens.FieldDescriptor "diff_vertex_id"- (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"diffVertexId"))- :: Data.ProtoLens.FieldDescriptor DiffTreeVertex- deleted__field_descriptor- = Data.ProtoLens.FieldDescriptor "deleted"- (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::- Data.ProtoLens.FieldTypeDescriptor DeletedTerm)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe'deleted"))- :: Data.ProtoLens.FieldDescriptor DiffTreeVertex- inserted__field_descriptor- = Data.ProtoLens.FieldDescriptor "inserted"- (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::- Data.ProtoLens.FieldTypeDescriptor InsertedTerm)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe'inserted"))- :: Data.ProtoLens.FieldDescriptor DiffTreeVertex- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, diffVertexId__field_descriptor),- (Data.ProtoLens.Tag 2, deleted__field_descriptor),- (Data.ProtoLens.Tag 3, inserted__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _DiffTreeVertex'_unknownFields- (\ x__ y__ -> x__{_DiffTreeVertex'_unknownFields = y__})- defMessage- = DiffTreeVertex{_DiffTreeVertex'diffVertexId =- Data.ProtoLens.fieldDefault,- _DiffTreeVertex'diffTerm = Prelude.Nothing,- _DiffTreeVertex'_unknownFields = ([])}- parseMessage- = let loop ::- DiffTreeVertex ->- Data.ProtoLens.Encoding.Bytes.Parser DiffTreeVertex- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 8 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "diff_vertex_id"- loop- (Lens.Family2.set- (Data.ProtoLens.Field.field @"diffVertexId")- y- x)- 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.isolate- (Prelude.fromIntegral len)- Data.ProtoLens.parseMessage)- Data.ProtoLens.Encoding.Bytes.<?> "deleted"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"deleted")- y- x)- 26 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.isolate- (Prelude.fromIntegral len)- Data.ProtoLens.parseMessage)- Data.ProtoLens.Encoding.Bytes.<?> "inserted"- loop- (Lens.Family2.set- (Data.ProtoLens.Field.field @"inserted")- y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "DiffTreeVertex"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"diffVertexId") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- _v)- Data.Monoid.<>- (case- Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'diffTerm") _x- of- (Prelude.Nothing) -> Data.Monoid.mempty- Prelude.Just- (DiffTreeVertex'Deleted- v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.ProtoLens.encodeMessage)- v- Prelude.Just- (DiffTreeVertex'Inserted- v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.ProtoLens.encodeMessage)- v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData DiffTreeVertex where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_DiffTreeVertex'_unknownFields x__)- (Control.DeepSeq.deepseq (_DiffTreeVertex'diffVertexId x__)- (Control.DeepSeq.deepseq (_DiffTreeVertex'diffTerm x__) (()))))-instance Control.DeepSeq.NFData DiffTreeVertex'DiffTerm where- rnf (DiffTreeVertex'Deleted x__) = Control.DeepSeq.rnf x__- rnf (DiffTreeVertex'Inserted x__) = Control.DeepSeq.rnf x__-_DiffTreeVertex'Deleted ::- Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm DeletedTerm-_DiffTreeVertex'Deleted- = Data.ProtoLens.Prism.prism' DiffTreeVertex'Deleted- (\ p__ ->- case p__ of- DiffTreeVertex'Deleted p__val -> Prelude.Just p__val- _otherwise -> Prelude.Nothing)-_DiffTreeVertex'Inserted ::- Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm InsertedTerm-_DiffTreeVertex'Inserted- = Data.ProtoLens.Prism.prism' DiffTreeVertex'Inserted- (\ p__ ->- case p__ of- DiffTreeVertex'Inserted p__val -> Prelude.Just p__val- _otherwise -> Prelude.Nothing)-{- | Fields :-- -}-data EmptyMessage = EmptyMessage{_EmptyMessage'_unknownFields ::- !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show EmptyMessage where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Message EmptyMessage where- messageName _ = Data.Text.pack "example.haberdasher.EmptyMessage"- fieldsByTag = let in Data.Map.fromList []- unknownFields- = Lens.Family2.Unchecked.lens _EmptyMessage'_unknownFields- (\ x__ y__ -> x__{_EmptyMessage'_unknownFields = y__})- defMessage = EmptyMessage{_EmptyMessage'_unknownFields = ([])}- parseMessage- = let loop ::- EmptyMessage -> Data.ProtoLens.Encoding.Bytes.Parser EmptyMessage- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "EmptyMessage"- buildMessage- = (\ _x ->- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData EmptyMessage where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_EmptyMessage'_unknownFields x__) (()))-{- | Fields :-- * 'Proto.Haberdasher_Fields.testBytes' @:: Lens' FieldTestMessage Data.ByteString.ByteString@- -}-data FieldTestMessage = FieldTestMessage{_FieldTestMessage'testBytes- :: !Data.ByteString.ByteString,- _FieldTestMessage'_unknownFields ::- !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show FieldTestMessage where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField FieldTestMessage "testBytes"- (Data.ByteString.ByteString)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _FieldTestMessage'testBytes- (\ x__ y__ -> x__{_FieldTestMessage'testBytes = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message FieldTestMessage where- messageName _- = Data.Text.pack "example.haberdasher.FieldTestMessage"- fieldsByTag- = let testBytes__field_descriptor- = Data.ProtoLens.FieldDescriptor "test_bytes"- (Data.ProtoLens.ScalarField Data.ProtoLens.BytesField ::- Data.ProtoLens.FieldTypeDescriptor Data.ByteString.ByteString)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"testBytes"))- :: Data.ProtoLens.FieldDescriptor FieldTestMessage- in- Data.Map.fromList- [(Data.ProtoLens.Tag 3, testBytes__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _FieldTestMessage'_unknownFields- (\ x__ y__ -> x__{_FieldTestMessage'_unknownFields = y__})- defMessage- = FieldTestMessage{_FieldTestMessage'testBytes =- Data.ProtoLens.fieldDefault,- _FieldTestMessage'_unknownFields = ([])}- parseMessage- = let loop ::- FieldTestMessage ->- Data.ProtoLens.Encoding.Bytes.Parser FieldTestMessage- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 26 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len))- Data.ProtoLens.Encoding.Bytes.<?> "test_bytes"- loop- (Lens.Family2.set- (Data.ProtoLens.Field.field @"testBytes")- y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "FieldTestMessage"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"testBytes") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<>- (\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData FieldTestMessage where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_FieldTestMessage'_unknownFields x__)- (Control.DeepSeq.deepseq (_FieldTestMessage'testBytes x__) (())))-{- | Fields :-- * 'Proto.Haberdasher_Fields.inches' @:: Lens' Hat Data.Int.Int32@- * 'Proto.Haberdasher_Fields.color' @:: Lens' Hat Data.Text.Text@- * 'Proto.Haberdasher_Fields.name' @:: Lens' Hat Data.Text.Text@- -}-data Hat = Hat{_Hat'inches :: !Data.Int.Int32,- _Hat'color :: !Data.Text.Text, _Hat'name :: !Data.Text.Text,- _Hat'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Hat where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField Hat "inches"- (Data.Int.Int32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Hat'inches- (\ x__ y__ -> x__{_Hat'inches = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Hat "color" (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Hat'color- (\ x__ y__ -> x__{_Hat'color = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Hat "name" (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Hat'name- (\ x__ y__ -> x__{_Hat'name = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message Hat where- messageName _ = Data.Text.pack "example.haberdasher.Hat"- fieldsByTag- = let inches__field_descriptor- = Data.ProtoLens.FieldDescriptor "inches"- (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"inches"))- :: Data.ProtoLens.FieldDescriptor Hat- color__field_descriptor- = Data.ProtoLens.FieldDescriptor "color"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"color"))- :: Data.ProtoLens.FieldDescriptor Hat- name__field_descriptor- = Data.ProtoLens.FieldDescriptor "name"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"name"))- :: Data.ProtoLens.FieldDescriptor Hat- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, inches__field_descriptor),- (Data.ProtoLens.Tag 2, color__field_descriptor),- (Data.ProtoLens.Tag 3, name__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Hat'_unknownFields- (\ x__ y__ -> x__{_Hat'_unknownFields = y__})- defMessage- = Hat{_Hat'inches = Data.ProtoLens.fieldDefault,- _Hat'color = Data.ProtoLens.fieldDefault,- _Hat'name = Data.ProtoLens.fieldDefault,- _Hat'_unknownFields = ([])}- parseMessage- = let loop :: Hat -> Data.ProtoLens.Encoding.Bytes.Parser Hat- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 8 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "inches"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"inches") y- x)- 18 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "color"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"color") y- x)- 26 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "name"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"name") y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "Hat"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"inches") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- _v)- Data.Monoid.<>- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"color") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"name") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Hat where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Hat'_unknownFields x__)- (Control.DeepSeq.deepseq (_Hat'inches x__)- (Control.DeepSeq.deepseq (_Hat'color x__)- (Control.DeepSeq.deepseq (_Hat'name x__) (())))))-{- | Fields :-- * 'Proto.Haberdasher_Fields.term' @:: Lens' InsertedTerm Data.Text.Text@- -}-data InsertedTerm = InsertedTerm{_InsertedTerm'term ::- !Data.Text.Text,- _InsertedTerm'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show InsertedTerm where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField InsertedTerm "term"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _InsertedTerm'term- (\ x__ y__ -> x__{_InsertedTerm'term = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message InsertedTerm where- messageName _ = Data.Text.pack "example.haberdasher.InsertedTerm"- fieldsByTag- = let term__field_descriptor- = Data.ProtoLens.FieldDescriptor "term"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"term"))- :: Data.ProtoLens.FieldDescriptor InsertedTerm- in- Data.Map.fromList [(Data.ProtoLens.Tag 1, term__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _InsertedTerm'_unknownFields- (\ x__ y__ -> x__{_InsertedTerm'_unknownFields = y__})- defMessage- = InsertedTerm{_InsertedTerm'term = Data.ProtoLens.fieldDefault,- _InsertedTerm'_unknownFields = ([])}- parseMessage- = let loop ::- InsertedTerm -> Data.ProtoLens.Encoding.Bytes.Parser InsertedTerm- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 10 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "term"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "InsertedTerm"- buildMessage- = (\ _x ->- (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData InsertedTerm where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_InsertedTerm'_unknownFields x__)- (Control.DeepSeq.deepseq (_InsertedTerm'term x__) (())))-{- | Fields :-- * 'Proto.Haberdasher_Fields.service' @:: Lens' Ping Data.Text.Text@- -}-data Ping = Ping{_Ping'service :: !Data.Text.Text,- _Ping'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Ping where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField Ping "service"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Ping'service- (\ x__ y__ -> x__{_Ping'service = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message Ping where- messageName _ = Data.Text.pack "example.haberdasher.Ping"- fieldsByTag- = let service__field_descriptor- = Data.ProtoLens.FieldDescriptor "service"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"service"))- :: Data.ProtoLens.FieldDescriptor Ping- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, service__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Ping'_unknownFields- (\ x__ y__ -> x__{_Ping'_unknownFields = y__})- defMessage- = Ping{_Ping'service = Data.ProtoLens.fieldDefault,- _Ping'_unknownFields = ([])}- parseMessage- = let loop :: Ping -> Data.ProtoLens.Encoding.Bytes.Parser Ping- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 10 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "service"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"service")- y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "Ping"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"service") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Ping where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Ping'_unknownFields x__)- (Control.DeepSeq.deepseq (_Ping'service x__) (())))-{- | Fields :-- * 'Proto.Haberdasher_Fields.status' @:: Lens' Pong Data.Text.Text@- * 'Proto.Haberdasher_Fields.stuff' @:: Lens' Pong [Test]@- * 'Proto.Haberdasher_Fields.vec'stuff' @:: Lens' Pong (Data.Vector.Vector Test)@- * 'Proto.Haberdasher_Fields.id' @:: Lens' Pong Data.Int.Int32@- * 'Proto.Haberdasher_Fields.type'' @:: Lens' Pong Data.Text.Text@- * 'Proto.Haberdasher_Fields.maybe'extra' @:: Lens' Pong (Prelude.Maybe Pong'Extra)@- * 'Proto.Haberdasher_Fields.maybe't' @:: Lens' Pong (Prelude.Maybe Data.Word.Word32)@- * 'Proto.Haberdasher_Fields.t' @:: Lens' Pong Data.Word.Word32@- * 'Proto.Haberdasher_Fields.maybe'u' @:: Lens' Pong (Prelude.Maybe Data.Text.Text)@- * 'Proto.Haberdasher_Fields.u' @:: Lens' Pong Data.Text.Text@- -}-data Pong = Pong{_Pong'status :: !Data.Text.Text,- _Pong'stuff :: !(Data.Vector.Vector Test),- _Pong'id :: !Data.Int.Int32, _Pong'type' :: !Data.Text.Text,- _Pong'extra :: !(Prelude.Maybe Pong'Extra),- _Pong'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Pong where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-data Pong'Extra = Pong'T !Data.Word.Word32- | Pong'U !Data.Text.Text- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)-instance Data.ProtoLens.Field.HasField Pong "status"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'status- (\ x__ y__ -> x__{_Pong'status = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Pong "stuff" ([Test]) where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'stuff- (\ x__ y__ -> x__{_Pong'stuff = y__}))- Prelude..- Lens.Family2.Unchecked.lens Data.Vector.Generic.toList- (\ _ y__ -> Data.Vector.Generic.fromList y__)-instance Data.ProtoLens.Field.HasField Pong "vec'stuff"- (Data.Vector.Vector Test)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'stuff- (\ x__ y__ -> x__{_Pong'stuff = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Pong "id" (Data.Int.Int32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'id- (\ x__ y__ -> x__{_Pong'id = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Pong "type'"- (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'type'- (\ x__ y__ -> x__{_Pong'type' = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Pong "maybe'extra"- (Prelude.Maybe Pong'Extra)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'extra- (\ x__ y__ -> x__{_Pong'extra = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Pong "maybe't"- (Prelude.Maybe Data.Word.Word32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'extra- (\ x__ y__ -> x__{_Pong'extra = y__}))- Prelude..- Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Pong'T x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Pong'T y__)-instance Data.ProtoLens.Field.HasField Pong "t" (Data.Word.Word32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'extra- (\ x__ y__ -> x__{_Pong'extra = y__}))- Prelude..- (Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Pong'T x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Pong'T y__))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault-instance Data.ProtoLens.Field.HasField Pong "maybe'u"- (Prelude.Maybe Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'extra- (\ x__ y__ -> x__{_Pong'extra = y__}))- Prelude..- Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Pong'U x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Pong'U y__)-instance Data.ProtoLens.Field.HasField Pong "u" (Data.Text.Text)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Pong'extra- (\ x__ y__ -> x__{_Pong'extra = y__}))- Prelude..- (Lens.Family2.Unchecked.lens- (\ x__ ->- case x__ of- Prelude.Just (Pong'U x__val) -> Prelude.Just x__val- _otherwise -> Prelude.Nothing)- (\ _ y__ -> Prelude.fmap Pong'U y__))- Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault-instance Data.ProtoLens.Message Pong where- messageName _ = Data.Text.pack "example.haberdasher.Pong"- fieldsByTag- = let status__field_descriptor- = Data.ProtoLens.FieldDescriptor "status"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"status"))- :: Data.ProtoLens.FieldDescriptor Pong- stuff__field_descriptor- = Data.ProtoLens.FieldDescriptor "stuff"- (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::- Data.ProtoLens.FieldTypeDescriptor Test)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked- (Data.ProtoLens.Field.field @"stuff"))- :: Data.ProtoLens.FieldDescriptor Pong- id__field_descriptor- = Data.ProtoLens.FieldDescriptor "id"- (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"id"))- :: Data.ProtoLens.FieldDescriptor Pong- type'__field_descriptor- = Data.ProtoLens.FieldDescriptor "type"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"type'"))- :: Data.ProtoLens.FieldDescriptor Pong- t__field_descriptor- = Data.ProtoLens.FieldDescriptor "t"- (Data.ProtoLens.ScalarField Data.ProtoLens.UInt32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Word.Word32)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe't"))- :: Data.ProtoLens.FieldDescriptor Pong- u__field_descriptor- = Data.ProtoLens.FieldDescriptor "u"- (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField- (Data.ProtoLens.Field.field @"maybe'u"))- :: Data.ProtoLens.FieldDescriptor Pong- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, status__field_descriptor),- (Data.ProtoLens.Tag 2, stuff__field_descriptor),- (Data.ProtoLens.Tag 5, id__field_descriptor),- (Data.ProtoLens.Tag 6, type'__field_descriptor),- (Data.ProtoLens.Tag 3, t__field_descriptor),- (Data.ProtoLens.Tag 4, u__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Pong'_unknownFields- (\ x__ y__ -> x__{_Pong'_unknownFields = y__})- defMessage- = Pong{_Pong'status = Data.ProtoLens.fieldDefault,- _Pong'stuff = Data.Vector.Generic.empty,- _Pong'id = Data.ProtoLens.fieldDefault,- _Pong'type' = Data.ProtoLens.fieldDefault,- _Pong'extra = Prelude.Nothing, _Pong'_unknownFields = ([])}- parseMessage- = let loop ::- Pong ->- Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector- Data.ProtoLens.Encoding.Growing.RealWorld- Test- -> Data.ProtoLens.Encoding.Bytes.Parser Pong- loop x mutable'stuff- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do frozen'stuff <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.unsafeFreeze- mutable'stuff)- let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'stuff")- frozen'stuff- x))- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 10 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "status"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"status")- y- x)- mutable'stuff- 18 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.isolate- (Prelude.fromIntegral len)- Data.ProtoLens.parseMessage)- Data.ProtoLens.Encoding.Bytes.<?> "stuff"- v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.append- mutable'stuff- y)- loop x v- 40 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "id"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"id") y x)- mutable'stuff- 50 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "type"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"type'") y- x)- mutable'stuff- 24 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "t"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"t") y x)- mutable'stuff- 34 -> do y <- (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.getBytes- (Prelude.fromIntegral len)- Data.ProtoLens.Encoding.Bytes.runEither- (case Data.Text.Encoding.decodeUtf8' value of- Prelude.Left err -> Prelude.Left- (Prelude.show err)- Prelude.Right r -> Prelude.Right r))- Data.ProtoLens.Encoding.Bytes.<?> "u"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"u") y x)- mutable'stuff- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- mutable'stuff- in- (do mutable'stuff <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- Data.ProtoLens.Encoding.Growing.new- loop Data.ProtoLens.defMessage mutable'stuff)- Data.ProtoLens.Encoding.Bytes.<?> "Pong"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"status") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- (Data.ProtoLens.Encoding.Bytes.foldMapBuilder- (\ _v ->- (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.ProtoLens.encodeMessage)- _v)- (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'stuff") _x))- Data.Monoid.<>- (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"id") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 40) Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- _v)- Data.Monoid.<>- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"type'") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 50) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- _v)- Data.Monoid.<>- (case- Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'extra") _x of- (Prelude.Nothing) -> Data.Monoid.mempty- Prelude.Just (Pong'T v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt- 24)- Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt)- Prelude.. Prelude.fromIntegral)- v- Prelude.Just (Pong'U v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt- 34)- Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral- (Data.ByteString.length bs)))- Data.Monoid.<>- Data.ProtoLens.Encoding.Bytes.putBytes- bs))- Prelude.. Data.Text.Encoding.encodeUtf8)- v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Pong where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Pong'_unknownFields x__)- (Control.DeepSeq.deepseq (_Pong'status x__)- (Control.DeepSeq.deepseq (_Pong'stuff x__)- (Control.DeepSeq.deepseq (_Pong'id x__)- (Control.DeepSeq.deepseq (_Pong'type' x__)- (Control.DeepSeq.deepseq (_Pong'extra x__) (())))))))-instance Control.DeepSeq.NFData Pong'Extra where- rnf (Pong'T x__) = Control.DeepSeq.rnf x__- rnf (Pong'U x__) = Control.DeepSeq.rnf x__-_Pong'T :: Data.ProtoLens.Prism.Prism' Pong'Extra Data.Word.Word32-_Pong'T- = Data.ProtoLens.Prism.prism' Pong'T- (\ p__ ->- case p__ of- Pong'T p__val -> Prelude.Just p__val- _otherwise -> Prelude.Nothing)-_Pong'U :: Data.ProtoLens.Prism.Prism' Pong'Extra Data.Text.Text-_Pong'U- = Data.ProtoLens.Prism.prism' Pong'U- (\ p__ ->- case p__ of- Pong'U p__val -> Prelude.Just p__val- _otherwise -> Prelude.Nothing)-{- | Fields :-- * 'Proto.Haberdasher_Fields.dollars' @:: Lens' Price Data.Word.Word32@- * 'Proto.Haberdasher_Fields.cents' @:: Lens' Price Data.Word.Word32@- -}-data Price = Price{_Price'dollars :: !Data.Word.Word32,- _Price'cents :: !Data.Word.Word32,- _Price'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Price where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField Price "dollars"- (Data.Word.Word32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Price'dollars- (\ x__ y__ -> x__{_Price'dollars = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Price "cents"- (Data.Word.Word32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Price'cents- (\ x__ y__ -> x__{_Price'cents = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message Price where- messageName _ = Data.Text.pack "example.haberdasher.Price"- fieldsByTag- = let dollars__field_descriptor- = Data.ProtoLens.FieldDescriptor "dollars"- (Data.ProtoLens.ScalarField Data.ProtoLens.UInt32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Word.Word32)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"dollars"))- :: Data.ProtoLens.FieldDescriptor Price- cents__field_descriptor- = Data.ProtoLens.FieldDescriptor "cents"- (Data.ProtoLens.ScalarField Data.ProtoLens.UInt32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Word.Word32)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"cents"))- :: Data.ProtoLens.FieldDescriptor Price- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, dollars__field_descriptor),- (Data.ProtoLens.Tag 2, cents__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Price'_unknownFields- (\ x__ y__ -> x__{_Price'_unknownFields = y__})- defMessage- = Price{_Price'dollars = Data.ProtoLens.fieldDefault,- _Price'cents = Data.ProtoLens.fieldDefault,- _Price'_unknownFields = ([])}- parseMessage- = let loop :: Price -> Data.ProtoLens.Encoding.Bytes.Parser Price- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 8 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "dollars"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"dollars")- y- x)- 16 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "cents"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"cents") y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "Price"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"dollars") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- _v)- Data.Monoid.<>- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"cents") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 16) Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Price where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Price'_unknownFields x__)- (Control.DeepSeq.deepseq (_Price'dollars x__)- (Control.DeepSeq.deepseq (_Price'cents x__) (()))))-{- | Fields :-- * 'Proto.Haberdasher_Fields.inches' @:: Lens' Size Data.Int.Int32@- -}-data Size = Size{_Size'inches :: !Data.Int.Int32,- _Size'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Size where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField Size "inches"- (Data.Int.Int32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Size'inches- (\ x__ y__ -> x__{_Size'inches = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message Size where- messageName _ = Data.Text.pack "example.haberdasher.Size"- fieldsByTag- = let inches__field_descriptor- = Data.ProtoLens.FieldDescriptor "inches"- (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)- (Data.ProtoLens.PlainField Data.ProtoLens.Optional- (Data.ProtoLens.Field.field @"inches"))- :: Data.ProtoLens.FieldDescriptor Size- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, inches__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Size'_unknownFields- (\ x__ y__ -> x__{_Size'_unknownFields = y__})- defMessage- = Size{_Size'inches = Data.ProtoLens.fieldDefault,- _Size'_unknownFields = ([])}- parseMessage- = let loop :: Size -> Data.ProtoLens.Encoding.Bytes.Parser Size- loop x- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- x)- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 8 -> do y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "inches"- loop- (Lens.Family2.set (Data.ProtoLens.Field.field @"inches") y- x)- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- in- (do loop Data.ProtoLens.defMessage)- Data.ProtoLens.Encoding.Bytes.<?> "Size"- buildMessage- = (\ _x ->- (let _v- = Lens.Family2.view (Data.ProtoLens.Field.field @"inches") _x- in- if (_v) Prelude.== Data.ProtoLens.fieldDefault then- Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<>- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- _v)- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Size where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Size'_unknownFields x__)- (Control.DeepSeq.deepseq (_Size'inches x__) (())))-{- | Fields :-- * 'Proto.Haberdasher_Fields.items' @:: Lens' Test [Data.Int.Int32]@- * 'Proto.Haberdasher_Fields.vec'items' @:: Lens' Test (Data.Vector.Unboxed.Vector Data.Int.Int32)@- * 'Proto.Haberdasher_Fields.altPrices' @:: Lens' Test [Price]@- * 'Proto.Haberdasher_Fields.vec'altPrices' @:: Lens' Test (Data.Vector.Vector Price)@- -}-data Test = Test{_Test'items ::- !(Data.Vector.Unboxed.Vector Data.Int.Int32),- _Test'altPrices :: !(Data.Vector.Vector Price),- _Test'_unknownFields :: !Data.ProtoLens.FieldSet}- deriving (Prelude.Eq, Prelude.Ord)-instance Prelude.Show Test where- showsPrec _ __x __s- = Prelude.showChar '{'- (Prelude.showString (Data.ProtoLens.showMessageShort __x)- (Prelude.showChar '}' __s))-instance Data.ProtoLens.Field.HasField Test "items"- ([Data.Int.Int32])- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Test'items- (\ x__ y__ -> x__{_Test'items = y__}))- Prelude..- Lens.Family2.Unchecked.lens Data.Vector.Generic.toList- (\ _ y__ -> Data.Vector.Generic.fromList y__)-instance Data.ProtoLens.Field.HasField Test "vec'items"- (Data.Vector.Unboxed.Vector Data.Int.Int32)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Test'items- (\ x__ y__ -> x__{_Test'items = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Field.HasField Test "altPrices" ([Price])- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Test'altPrices- (\ x__ y__ -> x__{_Test'altPrices = y__}))- Prelude..- Lens.Family2.Unchecked.lens Data.Vector.Generic.toList- (\ _ y__ -> Data.Vector.Generic.fromList y__)-instance Data.ProtoLens.Field.HasField Test "vec'altPrices"- (Data.Vector.Vector Price)- where- fieldOf _- = (Lens.Family2.Unchecked.lens _Test'altPrices- (\ x__ y__ -> x__{_Test'altPrices = y__}))- Prelude.. Prelude.id-instance Data.ProtoLens.Message Test where- messageName _ = Data.Text.pack "example.haberdasher.Test"- fieldsByTag- = let items__field_descriptor- = Data.ProtoLens.FieldDescriptor "items"- (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Packed- (Data.ProtoLens.Field.field @"items"))- :: Data.ProtoLens.FieldDescriptor Test- altPrices__field_descriptor- = Data.ProtoLens.FieldDescriptor "alt_prices"- (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::- Data.ProtoLens.FieldTypeDescriptor Price)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked- (Data.ProtoLens.Field.field @"altPrices"))- :: Data.ProtoLens.FieldDescriptor Test- in- Data.Map.fromList- [(Data.ProtoLens.Tag 1, items__field_descriptor),- (Data.ProtoLens.Tag 2, altPrices__field_descriptor)]- unknownFields- = Lens.Family2.Unchecked.lens _Test'_unknownFields- (\ x__ y__ -> x__{_Test'_unknownFields = y__})- defMessage- = Test{_Test'items = Data.Vector.Generic.empty,- _Test'altPrices = Data.Vector.Generic.empty,- _Test'_unknownFields = ([])}- parseMessage- = let loop ::- Test ->- Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector- Data.ProtoLens.Encoding.Growing.RealWorld- Price- ->- Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Unboxed.Vector- Data.ProtoLens.Encoding.Growing.RealWorld- Data.Int.Int32- -> Data.ProtoLens.Encoding.Bytes.Parser Test- loop x mutable'altPrices mutable'items- = do end <- Data.ProtoLens.Encoding.Bytes.atEnd- if end then- do frozen'altPrices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.unsafeFreeze- mutable'altPrices)- frozen'items <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.unsafeFreeze- mutable'items)- let missing = [] in- if Prelude.null missing then Prelude.return () else- Prelude.fail- (("Missing required fields: ") Prelude.++- Prelude.show (missing :: ([Prelude.String])))- Prelude.return- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> Prelude.reverse t)- (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'altPrices")- frozen'altPrices- (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'items")- frozen'items- x)))- else- do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt- case tag of- 8 -> do !y <- (Prelude.fmap Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?> "items"- v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.append mutable'items- y)- loop x mutable'altPrices v- 10 -> do y <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.isolate- (Prelude.fromIntegral len)- ((let ploop qs- = do packedEnd <- Data.ProtoLens.Encoding.Bytes.atEnd- if packedEnd then Prelude.return qs- else- do !q <- (Prelude.fmap- Prelude.fromIntegral- Data.ProtoLens.Encoding.Bytes.getVarInt)- Data.ProtoLens.Encoding.Bytes.<?>- "items"- qs' <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.append- qs- q)- ploop qs'- in ploop)- mutable'items)- loop x mutable'altPrices y- 18 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt- Data.ProtoLens.Encoding.Bytes.isolate- (Prelude.fromIntegral len)- Data.ProtoLens.parseMessage)- Data.ProtoLens.Encoding.Bytes.<?> "alt_prices"- v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- (Data.ProtoLens.Encoding.Growing.append- mutable'altPrices- y)- loop x v mutable'items- wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire- wire- loop- (Lens.Family2.over Data.ProtoLens.unknownFields- (\ !t -> (:) y t)- x)- mutable'altPrices- mutable'items- in- (do mutable'altPrices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- Data.ProtoLens.Encoding.Growing.new- mutable'items <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO- Data.ProtoLens.Encoding.Growing.new- loop Data.ProtoLens.defMessage mutable'altPrices mutable'items)- Data.ProtoLens.Encoding.Bytes.<?> "Test"- buildMessage- = (\ _x ->- (let p = Lens.Family2.view- (Data.ProtoLens.Field.field @"vec'items")- _x- in- if Data.Vector.Generic.null p then Data.Monoid.mempty else- (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<>- (\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)- (Data.ProtoLens.Encoding.Bytes.runBuilder- (Data.ProtoLens.Encoding.Bytes.foldMapBuilder- ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..- Prelude.fromIntegral)- p)))- Data.Monoid.<>- (Data.ProtoLens.Encoding.Bytes.foldMapBuilder- (\ _v ->- (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<>- (((\ bs ->- (Data.ProtoLens.Encoding.Bytes.putVarInt- (Prelude.fromIntegral (Data.ByteString.length bs)))- Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs))- Prelude.. Data.ProtoLens.encodeMessage)- _v)- (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'altPrices")- _x))- Data.Monoid.<>- Data.ProtoLens.Encoding.Wire.buildFieldSet- (Lens.Family2.view Data.ProtoLens.unknownFields _x))-instance Control.DeepSeq.NFData Test where- rnf- = (\ x__ ->- Control.DeepSeq.deepseq (_Test'_unknownFields x__)- (Control.DeepSeq.deepseq (_Test'items x__)- (Control.DeepSeq.deepseq (_Test'altPrices x__) (()))))-data Haberdasher = Haberdasher{}- deriving ()-instance Data.ProtoLens.Service.Types.Service Haberdasher where- type ServiceName Haberdasher = "Haberdasher"- type ServicePackage Haberdasher = "example.haberdasher"- type ServiceMethods Haberdasher = '["getBill", "makeHat"]-instance Data.ProtoLens.Service.Types.HasMethodImpl Haberdasher- "makeHat"- where- type MethodName Haberdasher "makeHat" = "MakeHat"- type MethodInput Haberdasher "makeHat" = Size- type MethodOutput Haberdasher "makeHat" = Hat- type MethodStreamingType Haberdasher "makeHat" =- 'Data.ProtoLens.Service.Types.NonStreaming-instance Data.ProtoLens.Service.Types.HasMethodImpl Haberdasher- "getBill"- where- type MethodName Haberdasher "getBill" = "GetBill"- type MethodInput Haberdasher "getBill" = Hat- type MethodOutput Haberdasher "getBill" = Bill- type MethodStreamingType Haberdasher "getBill" =- 'Data.ProtoLens.Service.Types.NonStreaming-data Health = Health{}- deriving ()-instance Data.ProtoLens.Service.Types.Service Health where- type ServiceName Health = "Health"- type ServicePackage Health = "example.haberdasher"- type ServiceMethods Health = '["check"]-instance Data.ProtoLens.Service.Types.HasMethodImpl Health "check"- where- type MethodName Health "check" = "Check"- type MethodInput Health "check" = Ping- type MethodOutput Health "check" = Pong- type MethodStreamingType Health "check" =- 'Data.ProtoLens.Service.Types.NonStreaming
− app/Proto/Haberdasher_Fields.hs
@@ -1,243 +0,0 @@-{- This file was auto-generated from haberdasher.proto by the proto-lens-protoc program. -}-{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies,- UndecidableInstances, GeneralizedNewtypeDeriving,- MultiParamTypeClasses, FlexibleContexts, FlexibleInstances,- PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds,- BangPatterns, TypeApplications #-}-{-# OPTIONS_GHC -fno-warn-unused-imports#-}-{-# OPTIONS_GHC -fno-warn-duplicate-exports#-}-module Proto.Haberdasher_Fields where-import qualified Data.ProtoLens.Runtime.Prelude as Prelude-import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int-import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid-import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word-import qualified Data.ProtoLens.Runtime.Data.ProtoLens- as Data.ProtoLens-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes- as Data.ProtoLens.Encoding.Bytes-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing- as Data.ProtoLens.Encoding.Growing-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe- as Data.ProtoLens.Encoding.Parser.Unsafe-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire- as Data.ProtoLens.Encoding.Wire-import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field- as Data.ProtoLens.Field-import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum- as Data.ProtoLens.Message.Enum-import qualified- Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types- as Data.ProtoLens.Service.Types-import qualified Data.ProtoLens.Runtime.Lens.Family2- as Lens.Family2-import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked- as Lens.Family2.Unchecked-import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text-import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map-import qualified Data.ProtoLens.Runtime.Data.ByteString- as Data.ByteString-import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8- as Data.ByteString.Char8-import qualified Data.ProtoLens.Runtime.Data.Text.Encoding- as Data.Text.Encoding-import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector-import qualified Data.ProtoLens.Runtime.Data.Vector.Generic- as Data.Vector.Generic-import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed- as Data.Vector.Unboxed-import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read--altPrices ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "altPrices" a) =>- Lens.Family2.LensLike' f s a-altPrices = Data.ProtoLens.Field.field @"altPrices"-cents ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "cents" a) =>- Lens.Family2.LensLike' f s a-cents = Data.ProtoLens.Field.field @"cents"-changeType ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "changeType" a) =>- Lens.Family2.LensLike' f s a-changeType = Data.ProtoLens.Field.field @"changeType"-color ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "color" a) =>- Lens.Family2.LensLike' f s a-color = Data.ProtoLens.Field.field @"color"-deleted ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "deleted" a) =>- Lens.Family2.LensLike' f s a-deleted = Data.ProtoLens.Field.field @"deleted"-diffVertexId ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "diffVertexId" a) =>- Lens.Family2.LensLike' f s a-diffVertexId = Data.ProtoLens.Field.field @"diffVertexId"-dollars ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "dollars" a) =>- Lens.Family2.LensLike' f s a-dollars = Data.ProtoLens.Field.field @"dollars"-id ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "id" a) =>- Lens.Family2.LensLike' f s a-id = Data.ProtoLens.Field.field @"id"-inches ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "inches" a) =>- Lens.Family2.LensLike' f s a-inches = Data.ProtoLens.Field.field @"inches"-inserted ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "inserted" a) =>- Lens.Family2.LensLike' f s a-inserted = Data.ProtoLens.Field.field @"inserted"-items ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "items" a) =>- Lens.Family2.LensLike' f s a-items = Data.ProtoLens.Field.field @"items"-maybe'deleted ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'deleted" a) =>- Lens.Family2.LensLike' f s a-maybe'deleted = Data.ProtoLens.Field.field @"maybe'deleted"-maybe'diffTerm ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'diffTerm" a) =>- Lens.Family2.LensLike' f s a-maybe'diffTerm = Data.ProtoLens.Field.field @"maybe'diffTerm"-maybe'extra ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'extra" a) =>- Lens.Family2.LensLike' f s a-maybe'extra = Data.ProtoLens.Field.field @"maybe'extra"-maybe'inserted ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'inserted" a) =>- Lens.Family2.LensLike' f s a-maybe'inserted = Data.ProtoLens.Field.field @"maybe'inserted"-maybe'price ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'price" a) =>- Lens.Family2.LensLike' f s a-maybe'price = Data.ProtoLens.Field.field @"maybe'price"-maybe't ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "maybe't" a) =>- Lens.Family2.LensLike' f s a-maybe't = Data.ProtoLens.Field.field @"maybe't"-maybe'u ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "maybe'u" a) =>- Lens.Family2.LensLike' f s a-maybe'u = Data.ProtoLens.Field.field @"maybe'u"-maybe'vatInfo ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'vatInfo" a) =>- Lens.Family2.LensLike' f s a-maybe'vatInfo = Data.ProtoLens.Field.field @"maybe'vatInfo"-maybe'zipCode ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "maybe'zipCode" a) =>- Lens.Family2.LensLike' f s a-maybe'zipCode = Data.ProtoLens.Field.field @"maybe'zipCode"-name ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "name" a) =>- Lens.Family2.LensLike' f s a-name = Data.ProtoLens.Field.field @"name"-price ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "price" a) =>- Lens.Family2.LensLike' f s a-price = Data.ProtoLens.Field.field @"price"-service ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "service" a) =>- Lens.Family2.LensLike' f s a-service = Data.ProtoLens.Field.field @"service"-status ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "status" a) =>- Lens.Family2.LensLike' f s a-status = Data.ProtoLens.Field.field @"status"-stuff ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "stuff" a) =>- Lens.Family2.LensLike' f s a-stuff = Data.ProtoLens.Field.field @"stuff"-t ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "t" a) =>- Lens.Family2.LensLike' f s a-t = Data.ProtoLens.Field.field @"t"-term ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "term" a) =>- Lens.Family2.LensLike' f s a-term = Data.ProtoLens.Field.field @"term"-testBytes ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "testBytes" a) =>- Lens.Family2.LensLike' f s a-testBytes = Data.ProtoLens.Field.field @"testBytes"-type' ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "type'" a) =>- Lens.Family2.LensLike' f s a-type' = Data.ProtoLens.Field.field @"type'"-u ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "u" a) =>- Lens.Family2.LensLike' f s a-u = Data.ProtoLens.Field.field @"u"-vatInfo ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "vatInfo" a) =>- Lens.Family2.LensLike' f s a-vatInfo = Data.ProtoLens.Field.field @"vatInfo"-vec'altPrices ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "vec'altPrices" a) =>- Lens.Family2.LensLike' f s a-vec'altPrices = Data.ProtoLens.Field.field @"vec'altPrices"-vec'items ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "vec'items" a) =>- Lens.Family2.LensLike' f s a-vec'items = Data.ProtoLens.Field.field @"vec'items"-vec'stuff ::- forall f s a .- (Prelude.Functor f,- Data.ProtoLens.Field.HasField s "vec'stuff" a) =>- Lens.Family2.LensLike' f s a-vec'stuff = Data.ProtoLens.Field.field @"vec'stuff"-zipCode ::- forall f s a .- (Prelude.Functor f, Data.ProtoLens.Field.HasField s "zipCode" a) =>- Lens.Family2.LensLike' f s a-zipCode = Data.ProtoLens.Field.field @"zipCode"
− app/Proto/Haberdasher_JSON.hs
@@ -1,419 +0,0 @@--- Code generated by protoc-gen-jsonpb_haskell 0.1.0, DO NOT EDIT.-{-# OPTIONS_GHC -Wno-orphans -Wno-unused-imports -Wno-missing-export-lists #-}-module Proto.Haberdasher_JSON where--import Prelude(($), (.), (<$>), pure, show, Maybe(..))--import Data.ProtoLens.Runtime.Lens.Family2 ((^.), (.~), (&))-import Data.Monoid (mconcat)-import Control.Monad (msum)-import Data.ProtoLens (defMessage)-import qualified Data.Aeson as A-import qualified Data.Aeson.Encoding as E-import Data.ProtoLens.JSONPB as JSONPB-import qualified Data.Text as T--import Proto.Haberdasher as P-import Proto.Haberdasher_Fields as P--instance FromJSONPB Size where- parseJSONPB = withObject "Size" $ \obj -> do- inches' <- obj .: "inches"- pure $ defMessage- & P.inches .~ inches'--instance ToJSONPB Size where- toJSONPB x = object- [ "inches" .= (x^.inches)- ]- toEncodingPB x = pairs- [ "inches" .= (x^.inches)- ]--instance FromJSON Size where- parseJSON = parseJSONPB--instance ToJSON Size where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Hat where- parseJSONPB = withObject "Hat" $ \obj -> do- inches' <- obj .: "inches"- color' <- obj .: "color"- name' <- obj .: "name"- pure $ defMessage- & P.inches .~ inches'- & P.color .~ color'- & P.name .~ name'--instance ToJSONPB Hat where- toJSONPB x = object- [ "inches" .= (x^.inches)- , "color" .= (x^.color)- , "name" .= (x^.name)- ]- toEncodingPB x = pairs- [ "inches" .= (x^.inches)- , "color" .= (x^.color)- , "name" .= (x^.name)- ]--instance FromJSON Hat where- parseJSON = parseJSONPB--instance ToJSON Hat where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Bill'Extra where- parseJSONPB = A.withObject "Bill'Extra" $ \obj -> mconcat- [- Bill'VatInfo <$> parseField obj "vat_info"- , Bill'ZipCode <$> parseField obj "zip_code"- ]--instance ToJSONPB Bill'Extra where- toJSONPB (Bill'VatInfo x) = object [ "vat_info" .= x ]- toJSONPB (Bill'ZipCode x) = object [ "zip_code" .= x ]- toEncodingPB (Bill'VatInfo x) = pairs [ "vat_info" .= x ]- toEncodingPB (Bill'ZipCode x) = pairs [ "zip_code" .= x ]--instance FromJSON Bill'Extra where- parseJSON = parseJSONPB--instance ToJSON Bill'Extra where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Bill where- parseJSONPB = withObject "Bill" $ \obj -> do- price' <- obj A..:? "price"- status' <- obj .: "status"- extra' <- obj A..:? "extra"- pure $ defMessage- & P.maybe'price .~ price'- & P.status .~ status'- & P.maybe'extra .~ extra'--instance ToJSONPB Bill where- toJSONPB x = object- [ "price" .= (x^.maybe'price)- , "status" .= (x^.status)- , "extra" .= (x^.maybe'extra)- ]- toEncodingPB x = pairs- [ "price" .= (x^.maybe'price)- , "status" .= (x^.status)- , "extra" .= (x^.maybe'extra)- ]--instance FromJSON Bill where- parseJSON = parseJSONPB--instance ToJSON Bill where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Bill'BillingStatus where- parseJSONPB (JSONPB.String "UN_PAID") = pure Bill'UN_PAID- parseJSONPB (JSONPB.String "PAID") = pure Bill'PAID- parseJSONPB x = typeMismatch "BillingStatus" x--instance ToJSONPB Bill'BillingStatus where- toJSONPB x _ = A.String . T.toUpper . T.pack $ show x- toEncodingPB x _ = E.text . T.toUpper . T.pack $ show x--instance FromJSON Bill'BillingStatus where- parseJSON = parseJSONPB--instance ToJSON Bill'BillingStatus where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Test where- parseJSONPB = withObject "Test" $ \obj -> do- items' <- obj .: "items"- altPrices' <- obj .: "altPrices"- pure $ defMessage- & P.items .~ items'- & P.altPrices .~ altPrices'--instance ToJSONPB Test where- toJSONPB x = object- [ "items" .= (x^.items)- , "altPrices" .= (x^.altPrices)- ]- toEncodingPB x = pairs- [ "items" .= (x^.items)- , "altPrices" .= (x^.altPrices)- ]--instance FromJSON Test where- parseJSON = parseJSONPB--instance ToJSON Test where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Price where- parseJSONPB = withObject "Price" $ \obj -> do- dollars' <- obj .: "dollars"- cents' <- obj .: "cents"- pure $ defMessage- & P.dollars .~ dollars'- & P.cents .~ cents'--instance ToJSONPB Price where- toJSONPB x = object- [ "dollars" .= (x^.dollars)- , "cents" .= (x^.cents)- ]- toEncodingPB x = pairs- [ "dollars" .= (x^.dollars)- , "cents" .= (x^.cents)- ]--instance FromJSON Price where- parseJSON = parseJSONPB--instance ToJSON Price where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Ping where- parseJSONPB = withObject "Ping" $ \obj -> do- service' <- obj .: "service"- pure $ defMessage- & P.service .~ service'--instance ToJSONPB Ping where- toJSONPB x = object- [ "service" .= (x^.service)- ]- toEncodingPB x = pairs- [ "service" .= (x^.service)- ]--instance FromJSON Ping where- parseJSON = parseJSONPB--instance ToJSON Ping where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Pong'Extra where- parseJSONPB = A.withObject "Pong'Extra" $ \obj -> mconcat- [- Pong'T <$> parseField obj "t"- , Pong'U <$> parseField obj "u"- ]--instance ToJSONPB Pong'Extra where- toJSONPB (Pong'T x) = object [ "t" .= x ]- toJSONPB (Pong'U x) = object [ "u" .= x ]- toEncodingPB (Pong'T x) = pairs [ "t" .= x ]- toEncodingPB (Pong'U x) = pairs [ "u" .= x ]--instance FromJSON Pong'Extra where- parseJSON = parseJSONPB--instance ToJSON Pong'Extra where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Pong where- parseJSONPB = withObject "Pong" $ \obj -> do- status' <- obj .: "status"- stuff' <- obj .: "stuff"- id' <- obj .: "id"- type'' <- obj .: "type'"- extra' <- obj A..:? "extra"- pure $ defMessage- & P.status .~ status'- & P.stuff .~ stuff'- & P.id .~ id'- & P.type' .~ type''- & P.maybe'extra .~ extra'--instance ToJSONPB Pong where- toJSONPB x = object- [ "status" .= (x^.status)- , "stuff" .= (x^.stuff)- , "id" .= (x^.id)- , "type'" .= (x^.type')- , "extra" .= (x^.maybe'extra)- ]- toEncodingPB x = pairs- [ "status" .= (x^.status)- , "stuff" .= (x^.stuff)- , "id" .= (x^.id)- , "type'" .= (x^.type')- , "extra" .= (x^.maybe'extra)- ]--instance FromJSON Pong where- parseJSON = parseJSONPB--instance ToJSON Pong where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB Demo where- parseJSONPB = withObject "Demo" $ \obj -> do- changeType' <- obj .: "changeType"- pure $ defMessage- & P.changeType .~ changeType'--instance ToJSONPB Demo where- toJSONPB x = object- [ "changeType" .= (x^.changeType)- ]- toEncodingPB x = pairs- [ "changeType" .= (x^.changeType)- ]--instance FromJSON Demo where- parseJSON = parseJSONPB--instance ToJSON Demo where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB FieldTestMessage where- parseJSONPB = withObject "FieldTestMessage" $ \obj -> do- testBytes' <- obj .: "testBytes"- pure $ defMessage- & P.testBytes .~ testBytes'--instance ToJSONPB FieldTestMessage where- toJSONPB x = object- [ "testBytes" .= (x^.testBytes)- ]- toEncodingPB x = pairs- [ "testBytes" .= (x^.testBytes)- ]--instance FromJSON FieldTestMessage where- parseJSON = parseJSONPB--instance ToJSON FieldTestMessage where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB EmptyMessage where- parseJSONPB = withObject "EmptyMessage" $ \_ -> pure defMessage--instance ToJSONPB EmptyMessage where- toJSONPB _ = object []- toEncodingPB _ = pairs []--instance FromJSON EmptyMessage where- parseJSON = parseJSONPB--instance ToJSON EmptyMessage where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB DiffTreeVertex'DiffTerm where- parseJSONPB = A.withObject "DiffTreeVertex'DiffTerm" $ \obj -> mconcat- [- DiffTreeVertex'Deleted <$> parseField obj "deleted"- , DiffTreeVertex'Inserted <$> parseField obj "inserted"- ]--instance ToJSONPB DiffTreeVertex'DiffTerm where- toJSONPB (DiffTreeVertex'Deleted x) = object [ "deleted" .= Just x ]- toJSONPB (DiffTreeVertex'Inserted x) = object [ "inserted" .= Just x ]- toEncodingPB (DiffTreeVertex'Deleted x) = pairs [ "deleted" .= Just x ]- toEncodingPB (DiffTreeVertex'Inserted x) = pairs [ "inserted" .= Just x ]--instance FromJSON DiffTreeVertex'DiffTerm where- parseJSON = parseJSONPB--instance ToJSON DiffTreeVertex'DiffTerm where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB DiffTreeVertex where- parseJSONPB = withObject "DiffTreeVertex" $ \obj -> do- diffVertexId' <- obj .: "diffVertexId"- diffTerm' <- obj A..:? "diffTerm"- pure $ defMessage- & P.diffVertexId .~ diffVertexId'- & P.maybe'diffTerm .~ diffTerm'--instance ToJSONPB DiffTreeVertex where- toJSONPB x = object- [ "diffVertexId" .= (x^.diffVertexId)- , "diffTerm" .= (x^.maybe'diffTerm)- ]- toEncodingPB x = pairs- [ "diffVertexId" .= (x^.diffVertexId)- , "diffTerm" .= (x^.maybe'diffTerm)- ]--instance FromJSON DiffTreeVertex where- parseJSON = parseJSONPB--instance ToJSON DiffTreeVertex where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB DeletedTerm where- parseJSONPB = withObject "DeletedTerm" $ \obj -> do- term' <- obj .: "term"- pure $ defMessage- & P.term .~ term'--instance ToJSONPB DeletedTerm where- toJSONPB x = object- [ "term" .= (x^.term)- ]- toEncodingPB x = pairs- [ "term" .= (x^.term)- ]--instance FromJSON DeletedTerm where- parseJSON = parseJSONPB--instance ToJSON DeletedTerm where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB InsertedTerm where- parseJSONPB = withObject "InsertedTerm" $ \obj -> do- term' <- obj .: "term"- pure $ defMessage- & P.term .~ term'--instance ToJSONPB InsertedTerm where- toJSONPB x = object- [ "term" .= (x^.term)- ]- toEncodingPB x = pairs- [ "term" .= (x^.term)- ]--instance FromJSON InsertedTerm where- parseJSON = parseJSONPB--instance ToJSON InsertedTerm where- toJSON = toAesonValue- toEncoding = toAesonEncoding--instance FromJSONPB ChangeType where- parseJSONPB (JSONPB.String "ADDED") = pure ADDED- parseJSONPB (JSONPB.String "REMOVED") = pure REMOVED- parseJSONPB x = typeMismatch "ChangeType" x--instance ToJSONPB ChangeType where- toJSONPB x _ = A.String . T.toUpper . T.pack $ show x- toEncodingPB x _ = E.text . T.toUpper . T.pack $ show x--instance FromJSON ChangeType where- parseJSON = parseJSONPB--instance ToJSON ChangeType where- toJSON = toAesonValue- toEncoding = toAesonEncoding
proto-lens-jsonpb.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 name: proto-lens-jsonpb-version: 0.1.0.0+version: 0.2.0.0 synopsis: JSON protobuf encoding for proto-lens description: Please see the README on GitHub at <https://github.com/tclem/proto-lens-jsonpb#readme> homepage: https://github.com/tclem/proto-lens-jsonpb#readme@@ -56,21 +56,6 @@ src ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints build-depends:--executable example- import: haskell, dependencies- main-is: Main.hs- other-modules:- Proto.Haberdasher- Proto.Haberdasher_Fields- Proto.Haberdasher_JSON- hs-source-dirs:- app- ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N- build-depends:- proto-lens >= 0.5.0.0- , proto-lens-jsonpb- , microlens source-repository head type: git