diff --git a/.gitignore b/.gitignore index 9352acf31d..6ad025336b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ tmp/ *.hp *.prof *.pyc +/hie.yaml /test.* /*.html diff --git a/Dockerfile b/Dockerfile index c3ad60447c..1672f74b11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ # Put protoc and twirp tooling in its own image -FROM golang:1.12-stretch AS protoc +FROM haskell:8.6 as haskell +RUN cabal new-update hackage.haskell.org,HEAD +RUN cabal new-install proto-lens-protoc +RUN which proto-lens-protoc + +FROM golang:1.13-stretch AS protoc RUN apt-get update && apt-get install -y unzip ENV PROTOBUF_VERSION=3.7.1 RUN wget "https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-$PROTOBUF_VERSION-linux-x86_64.zip" && \ @@ -7,10 +12,11 @@ RUN wget "https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/p RUN go get github.com/golang/protobuf/proto && \ go get github.com/twitchtv/protogen/typemap && \ - go get github.com/tclem/twirp-haskell/pkg/gen/haskell && \ - go get github.com/tclem/twirp-haskell/protoc-gen-haskell + GO111MODULE=on go get github.com/tclem/proto-lens-jsonpb/protoc-gen-jsonpb_haskell@e4d10b77f57ee25beb759a33e63e2061420d3dc2 + +COPY --from=haskell /root/.cabal/bin/proto-lens-protoc /usr/local/bin/proto-lens-protoc -ENTRYPOINT ["/protobuf/bin/protoc", "-I/protobuf", "-I=/go/src/github.com/tclem/twirp-haskell"] +ENTRYPOINT ["/protobuf/bin/protoc", "-I/protobuf", "--plugin=protoc-gen-haskell=/usr/local/bin/proto-lens-protoc"] # Build semantic FROM haskell:8.6 as build diff --git a/cabal.project b/cabal.project index fb69a1e3bf..90ae8f4bdc 100644 --- a/cabal.project +++ b/cabal.project @@ -4,10 +4,5 @@ jobs: $ncpus source-repository-package type: git - location: https://github.com/joshvera/proto3-suite.git - tag: 83f3352f0c7c94ea091e6087f60692eda9991fae - -source-repository-package - type: git - location: https://github.com/joshvera/proto3-wire.git - tag: 84664e22f01beb67870368f1f88ada5d0ad01f56 + location: https://github.com/tclem/proto-lens-jsonpb + tag: e4d10b77f57ee25beb759a33e63e2061420d3dc2 diff --git a/proto/semantic.proto b/proto/semantic.proto index 0295f50f51..76e62835af 100644 --- a/proto/semantic.proto +++ b/proto/semantic.proto @@ -1,10 +1,7 @@ syntax = "proto3"; -import "pkg/gen/haskell/haskell.proto"; - package github.semantic; -option (haskell.haskell_package) = "Semantic.Proto"; option ruby_package = "Semantic::Proto"; message PingRequest { diff --git a/script/protoc b/script/protoc index b4823415e1..283de0d501 100755 --- a/script/protoc +++ b/script/protoc @@ -14,6 +14,7 @@ export PROJECT="github.com/github/semantic" # Generate Haskell for semantic's protobuf types docker run --rm --user $(id -u):$(id -g) -v $(pwd):/go/src/$PROJECT -w /go/src/$PROJECT \ - semantic-protoc \ - --proto_path=proto --haskell_out=src/Semantic/Proto \ + semantic-protoc --proto_path=proto \ + --haskell_out=./src \ + --jsonpb_haskell_out=./src \ semantic.proto diff --git a/semantic.cabal b/semantic.cabal index 61915af6c4..ba1e07d2a2 100644 --- a/semantic.cabal +++ b/semantic.cabal @@ -71,8 +71,6 @@ common dependencies , text ^>= 1.2.3.1 , these >= 0.7 && <1 , unix ^>= 2.7.2.2 - , proto3-suite - , proto3-wire , lingo >= 0.2.0.0 common executable-flags @@ -241,6 +239,9 @@ library -- High-level flow & operational functionality (logging, stats, etc.) , Semantic.Analysis -- API + , Proto.Semantic + , Proto.Semantic_Fields + , Proto.Semantic_JSON , Semantic.Api , Semantic.Api.Bridge , Semantic.Api.Diffs @@ -248,7 +249,6 @@ library , Semantic.Api.Symbols , Semantic.Api.Terms , Semantic.Api.TOCSummaries - , Semantic.Proto.SemanticPB , Semantic.AST , Semantic.CLI , Semantic.Config @@ -304,6 +304,9 @@ library , prettyprinter ^>= 1.2.1 , pretty-show ^>= 1.9.5 , profunctors ^>= 5.3 + , proto-lens ^>= 0.5.1.0 + , proto-lens-jsonpb + , proto-lens-runtime ^>= 0.5.0.0 , reducers ^>= 3.12.3 , semantic-tags ^>= 0 , semigroupoids ^>= 5.3.2 diff --git a/src/Data/Graph.hs b/src/Data/Graph.hs index 403a7f25f5..b225458a26 100644 --- a/src/Data/Graph.hs +++ b/src/Data/Graph.hs @@ -21,9 +21,11 @@ import Algebra.Graph.Class (connect, overlay, vertex) import qualified Algebra.Graph.Class as Class import qualified Algebra.Graph.ToGraph as Class import Control.Effect.State +import Control.Lens (view) import Data.Aeson import qualified Data.Set as Set -import Semantic.Proto.SemanticPB +import Proto.Semantic as P +import Proto.Semantic_Fields as P -- | An algebraic graph with 'Ord', 'Semigroup', and 'Monoid' instances. newtype Graph vertex = Graph { unGraph :: G.Graph vertex } @@ -100,8 +102,8 @@ instance Ord vertex => Ord (Graph vertex) where class VertexTag vertex where uniqueTag :: vertex -> Int -instance VertexTag DiffTreeVertex where uniqueTag = fromIntegral . diffVertexId -instance VertexTag TermVertex where uniqueTag = fromIntegral . vertexId +instance VertexTag DiffTreeVertex where uniqueTag = fromIntegral . view diffVertexId +instance VertexTag TermVertex where uniqueTag = fromIntegral . view vertexId instance (Ord vertex, ToJSON vertex, VertexTag vertex) => ToJSON (Graph vertex) where toJSON (Graph graph) = object ["vertices" .= G.vertexList graph, "edges" .= (Edge <$> G.edgeList graph)] diff --git a/src/Proto/Semantic.hs b/src/Proto/Semantic.hs new file mode 100644 index 0000000000..c2f1e9b8ca --- /dev/null +++ b/src/Proto/Semantic.hs @@ -0,0 +1,5553 @@ +{- This file was auto-generated from semantic.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.Semantic + (Blob(), BlobPair(), ChangeType(..), ChangeType(), + ChangeType'UnrecognizedValue, DeletedTerm(), DiffTreeEdge(), + DiffTreeFileGraph(), DiffTreeGraphResponse(), DiffTreeRequest(), + DiffTreeTOCResponse(), DiffTreeVertex(), + DiffTreeVertex'DiffTerm(..), _DiffTreeVertex'Deleted, + _DiffTreeVertex'Inserted, _DiffTreeVertex'Replaced, + _DiffTreeVertex'Merged, Docstring(), File(), InsertedTerm(), + MergedTerm(), ParseError(), ParseTreeFileGraph(), + ParseTreeGraphResponse(), ParseTreeRequest(), + ParseTreeSymbolResponse(), PingRequest(), PingResponse(), + Position(), ReplacedTerm(), Span(), Symbol(), TOCSummaryChange(), + TOCSummaryError(), TOCSummaryFile(), TermEdge(), TermVertex()) + 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.Semantic_Fields.content' @:: Lens' Blob Data.Text.Text@ + * 'Proto.Semantic_Fields.path' @:: Lens' Blob Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' Blob Data.Text.Text@ + -} +data Blob = Blob{_Blob'content :: !Data.Text.Text, + _Blob'path :: !Data.Text.Text, _Blob'language :: !Data.Text.Text, + _Blob'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Blob where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Blob "content" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Blob'content + (\ x__ y__ -> x__{_Blob'content = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Blob "path" (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Blob'path + (\ x__ y__ -> x__{_Blob'path = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Blob "language" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Blob'language + (\ x__ y__ -> x__{_Blob'language = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message Blob where + messageName _ = Data.Text.pack "github.semantic.Blob" + fieldsByTag + = let content__field_descriptor + = Data.ProtoLens.FieldDescriptor "content" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"content")) + :: Data.ProtoLens.FieldDescriptor Blob + path__field_descriptor + = Data.ProtoLens.FieldDescriptor "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"path")) + :: Data.ProtoLens.FieldDescriptor Blob + language__field_descriptor + = Data.ProtoLens.FieldDescriptor "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) + :: Data.ProtoLens.FieldDescriptor Blob + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, content__field_descriptor), + (Data.ProtoLens.Tag 2, path__field_descriptor), + (Data.ProtoLens.Tag 3, language__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _Blob'_unknownFields + (\ x__ y__ -> x__{_Blob'_unknownFields = y__}) + defMessage + = Blob{_Blob'content = Data.ProtoLens.fieldDefault, + _Blob'path = Data.ProtoLens.fieldDefault, + _Blob'language = Data.ProtoLens.fieldDefault, + _Blob'_unknownFields = ([])} + parseMessage + = let loop :: Blob -> Data.ProtoLens.Encoding.Bytes.Parser Blob + 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. "content" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"content") + 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. "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") 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. "language" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"language") + 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. "Blob" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"content") _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.<> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _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 @"language") _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 Blob where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_Blob'_unknownFields x__) + (Control.DeepSeq.deepseq (_Blob'content x__) + (Control.DeepSeq.deepseq (_Blob'path x__) + (Control.DeepSeq.deepseq (_Blob'language x__) (()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.before' @:: Lens' BlobPair Blob@ + * 'Proto.Semantic_Fields.maybe'before' @:: Lens' BlobPair (Prelude.Maybe Blob)@ + * 'Proto.Semantic_Fields.after' @:: Lens' BlobPair Blob@ + * 'Proto.Semantic_Fields.maybe'after' @:: Lens' BlobPair (Prelude.Maybe Blob)@ + -} +data BlobPair = BlobPair{_BlobPair'before :: !(Prelude.Maybe Blob), + _BlobPair'after :: !(Prelude.Maybe Blob), + _BlobPair'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show BlobPair where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField BlobPair "before" (Blob) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _BlobPair'before + (\ x__ y__ -> x__{_BlobPair'before = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField BlobPair "maybe'before" + (Prelude.Maybe Blob) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _BlobPair'before + (\ x__ y__ -> x__{_BlobPair'before = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField BlobPair "after" (Blob) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _BlobPair'after + (\ x__ y__ -> x__{_BlobPair'after = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField BlobPair "maybe'after" + (Prelude.Maybe Blob) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _BlobPair'after + (\ x__ y__ -> x__{_BlobPair'after = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message BlobPair where + messageName _ = Data.Text.pack "github.semantic.BlobPair" + fieldsByTag + = let before__field_descriptor + = Data.ProtoLens.FieldDescriptor "before" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'before")) + :: Data.ProtoLens.FieldDescriptor BlobPair + after__field_descriptor + = Data.ProtoLens.FieldDescriptor "after" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'after")) + :: Data.ProtoLens.FieldDescriptor BlobPair + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, before__field_descriptor), + (Data.ProtoLens.Tag 2, after__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _BlobPair'_unknownFields + (\ x__ y__ -> x__{_BlobPair'_unknownFields = y__}) + defMessage + = BlobPair{_BlobPair'before = Prelude.Nothing, + _BlobPair'after = Prelude.Nothing, _BlobPair'_unknownFields = ([])} + parseMessage + = let loop :: + BlobPair -> Data.ProtoLens.Encoding.Bytes.Parser BlobPair + 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. "before" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"before") + 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. "after" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"after") 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. "BlobPair" + buildMessage + = (\ _x -> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'before") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'after") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData BlobPair where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_BlobPair'_unknownFields x__) + (Control.DeepSeq.deepseq (_BlobPair'before x__) + (Control.DeepSeq.deepseq (_BlobPair'after x__) (())))) +newtype ChangeType'UnrecognizedValue = ChangeType'UnrecognizedValue Data.Int.Int32 + deriving (Prelude.Eq, Prelude.Ord, Prelude.Show) +data ChangeType = NONE + | ADDED + | REMOVED + | MODIFIED + | ChangeType'Unrecognized !ChangeType'UnrecognizedValue + deriving (Prelude.Show, Prelude.Eq, Prelude.Ord) +instance Data.ProtoLens.MessageEnum ChangeType where + maybeToEnum 0 = Prelude.Just NONE + maybeToEnum 1 = Prelude.Just ADDED + maybeToEnum 2 = Prelude.Just REMOVED + maybeToEnum 3 = Prelude.Just MODIFIED + maybeToEnum k + = Prelude.Just + (ChangeType'Unrecognized + (ChangeType'UnrecognizedValue (Prelude.fromIntegral k))) + showEnum NONE = "NONE" + showEnum ADDED = "ADDED" + showEnum REMOVED = "REMOVED" + showEnum MODIFIED = "MODIFIED" + showEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k)) + = Prelude.show k + readEnum k + | (k) Prelude.== "NONE" = Prelude.Just NONE + | (k) Prelude.== "ADDED" = Prelude.Just ADDED + | (k) Prelude.== "REMOVED" = Prelude.Just REMOVED + | (k) Prelude.== "MODIFIED" = Prelude.Just MODIFIED + readEnum k + = (Text.Read.readMaybe k) Prelude.>>= Data.ProtoLens.maybeToEnum +instance Prelude.Bounded ChangeType where + minBound = NONE + maxBound = MODIFIED +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 NONE = 0 + fromEnum ADDED = 1 + fromEnum REMOVED = 2 + fromEnum MODIFIED = 3 + fromEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k)) + = Prelude.fromIntegral k + succ MODIFIED + = Prelude.error + "ChangeType.succ: bad argument MODIFIED. This value would be out of bounds." + succ NONE = ADDED + succ ADDED = REMOVED + succ REMOVED = MODIFIED + succ (ChangeType'Unrecognized _) + = Prelude.error "ChangeType.succ: bad argument: unrecognized value" + pred NONE + = Prelude.error + "ChangeType.pred: bad argument NONE. This value would be out of bounds." + pred ADDED = NONE + pred REMOVED = ADDED + pred MODIFIED = REMOVED + 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 = NONE +instance Control.DeepSeq.NFData ChangeType where + rnf x__ = Prelude.seq x__ (()) +{- | Fields : + + * 'Proto.Semantic_Fields.term' @:: Lens' DeletedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' DeletedTerm Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' DeletedTerm (Prelude.Maybe Span)@ + -} +data DeletedTerm = DeletedTerm{_DeletedTerm'term :: + !Data.Text.Text, + _DeletedTerm'span :: !(Prelude.Maybe Span), + _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.Field.HasField DeletedTerm "span" (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DeletedTerm'span + (\ x__ y__ -> x__{_DeletedTerm'span = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField DeletedTerm "maybe'span" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DeletedTerm'span + (\ x__ y__ -> x__{_DeletedTerm'span = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message DeletedTerm where + messageName _ = Data.Text.pack "github.semantic.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 + span__field_descriptor + = Data.ProtoLens.FieldDescriptor "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) + :: Data.ProtoLens.FieldDescriptor DeletedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, term__field_descriptor), + (Data.ProtoLens.Tag 2, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _DeletedTerm'_unknownFields + (\ x__ y__ -> x__{_DeletedTerm'_unknownFields = y__}) + defMessage + = DeletedTerm{_DeletedTerm'term = Data.ProtoLens.fieldDefault, + _DeletedTerm'span = Prelude.Nothing, + _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) + 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. "span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + 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__) + (Control.DeepSeq.deepseq (_DeletedTerm'span x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.source' @:: Lens' DiffTreeEdge Data.Int.Int32@ + * 'Proto.Semantic_Fields.target' @:: Lens' DiffTreeEdge Data.Int.Int32@ + -} +data DiffTreeEdge = DiffTreeEdge{_DiffTreeEdge'source :: + !Data.Int.Int32, + _DiffTreeEdge'target :: !Data.Int.Int32, + _DiffTreeEdge'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeEdge where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeEdge "source" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeEdge'source + (\ x__ y__ -> x__{_DiffTreeEdge'source = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeEdge "target" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeEdge'target + (\ x__ y__ -> x__{_DiffTreeEdge'target = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message DiffTreeEdge where + messageName _ = Data.Text.pack "github.semantic.DiffTreeEdge" + fieldsByTag + = let source__field_descriptor + = Data.ProtoLens.FieldDescriptor "source" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"source")) + :: Data.ProtoLens.FieldDescriptor DiffTreeEdge + target__field_descriptor + = Data.ProtoLens.FieldDescriptor "target" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"target")) + :: Data.ProtoLens.FieldDescriptor DiffTreeEdge + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, source__field_descriptor), + (Data.ProtoLens.Tag 2, target__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _DiffTreeEdge'_unknownFields + (\ x__ y__ -> x__{_DiffTreeEdge'_unknownFields = y__}) + defMessage + = DiffTreeEdge{_DiffTreeEdge'source = Data.ProtoLens.fieldDefault, + _DiffTreeEdge'target = Data.ProtoLens.fieldDefault, + _DiffTreeEdge'_unknownFields = ([])} + parseMessage + = let loop :: + DiffTreeEdge -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeEdge + 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. "source" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y + x) + 16 -> do y <- (Prelude.fmap Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + Data.ProtoLens.Encoding.Bytes. "target" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"target") + 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. "DiffTreeEdge" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _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 @"target") _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 DiffTreeEdge where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_DiffTreeEdge'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeEdge'source x__) + (Control.DeepSeq.deepseq (_DiffTreeEdge'target x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' DiffTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' DiffTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.vertices' @:: Lens' DiffTreeFileGraph [DiffTreeVertex]@ + * 'Proto.Semantic_Fields.vec'vertices' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector DiffTreeVertex)@ + * 'Proto.Semantic_Fields.edges' @:: Lens' DiffTreeFileGraph [DiffTreeEdge]@ + * 'Proto.Semantic_Fields.vec'edges' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector DiffTreeEdge)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' DiffTreeFileGraph [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector ParseError)@ + -} +data DiffTreeFileGraph = DiffTreeFileGraph{_DiffTreeFileGraph'path + :: !Data.Text.Text, + _DiffTreeFileGraph'language :: !Data.Text.Text, + _DiffTreeFileGraph'vertices :: + !(Data.Vector.Vector DiffTreeVertex), + _DiffTreeFileGraph'edges :: + !(Data.Vector.Vector DiffTreeEdge), + _DiffTreeFileGraph'errors :: + !(Data.Vector.Vector ParseError), + _DiffTreeFileGraph'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeFileGraph where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "path" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'path + (\ x__ y__ -> x__{_DiffTreeFileGraph'path = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "language" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'language + (\ x__ y__ -> x__{_DiffTreeFileGraph'language = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "vertices" + ([DiffTreeVertex]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'vertices + (\ x__ y__ -> x__{_DiffTreeFileGraph'vertices = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph + "vec'vertices" + (Data.Vector.Vector DiffTreeVertex) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'vertices + (\ x__ y__ -> x__{_DiffTreeFileGraph'vertices = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "edges" + ([DiffTreeEdge]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'edges + (\ x__ y__ -> x__{_DiffTreeFileGraph'edges = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph + "vec'edges" + (Data.Vector.Vector DiffTreeEdge) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'edges + (\ x__ y__ -> x__{_DiffTreeFileGraph'edges = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "errors" + ([ParseError]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'errors + (\ x__ y__ -> x__{_DiffTreeFileGraph'errors = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph + "vec'errors" + (Data.Vector.Vector ParseError) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'errors + (\ x__ y__ -> x__{_DiffTreeFileGraph'errors = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message DiffTreeFileGraph where + messageName _ = Data.Text.pack "github.semantic.DiffTreeFileGraph" + fieldsByTag + = let path__field_descriptor + = Data.ProtoLens.FieldDescriptor "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"path")) + :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + language__field_descriptor + = Data.ProtoLens.FieldDescriptor "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) + :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + vertices__field_descriptor + = Data.ProtoLens.FieldDescriptor "vertices" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DiffTreeVertex) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"vertices")) + :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + edges__field_descriptor + = Data.ProtoLens.FieldDescriptor "edges" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DiffTreeEdge) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"edges")) + :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseError) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"errors")) + :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, vertices__field_descriptor), + (Data.ProtoLens.Tag 4, edges__field_descriptor), + (Data.ProtoLens.Tag 5, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _DiffTreeFileGraph'_unknownFields + (\ x__ y__ -> x__{_DiffTreeFileGraph'_unknownFields = y__}) + defMessage + = DiffTreeFileGraph{_DiffTreeFileGraph'path = + Data.ProtoLens.fieldDefault, + _DiffTreeFileGraph'language = Data.ProtoLens.fieldDefault, + _DiffTreeFileGraph'vertices = Data.Vector.Generic.empty, + _DiffTreeFileGraph'edges = Data.Vector.Generic.empty, + _DiffTreeFileGraph'errors = Data.Vector.Generic.empty, + _DiffTreeFileGraph'_unknownFields = ([])} + parseMessage + = let loop :: + DiffTreeFileGraph -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + DiffTreeEdge + -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + ParseError + -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + DiffTreeVertex + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeFileGraph + loop x mutable'edges mutable'errors mutable'vertices + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'edges) + frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'vertices) + 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'edges") + frozen'edges + (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'vertices") + frozen'vertices + 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. "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y + x) + mutable'edges + mutable'errors + mutable'vertices + 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. "language" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"language") + y + x) + mutable'edges + mutable'errors + mutable'vertices + 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. "vertices" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'vertices + y) + loop x mutable'edges mutable'errors v + 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "edges" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'edges + y) + loop x v mutable'errors mutable'vertices + 42 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "errors" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'errors + y) + loop x mutable'edges v mutable'vertices + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'edges + mutable'errors + mutable'vertices + in + (do mutable'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'edges mutable'errors + mutable'vertices) + Data.ProtoLens.Encoding.Bytes. "DiffTreeFileGraph" + buildMessage + = (\ _x -> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _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.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _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.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'vertices") + _x)) + Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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.ProtoLens.encodeMessage) + _v) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'edges") _x)) + Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v -> + (Data.ProtoLens.Encoding.Bytes.putVarInt 42) 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'errors") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData DiffTreeFileGraph where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_DiffTreeFileGraph'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeFileGraph'path x__) + (Control.DeepSeq.deepseq (_DiffTreeFileGraph'language x__) + (Control.DeepSeq.deepseq (_DiffTreeFileGraph'vertices x__) + (Control.DeepSeq.deepseq (_DiffTreeFileGraph'edges x__) + (Control.DeepSeq.deepseq (_DiffTreeFileGraph'errors x__) (()))))))) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' DiffTreeGraphResponse [DiffTreeFileGraph]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' DiffTreeGraphResponse (Data.Vector.Vector DiffTreeFileGraph)@ + -} +data DiffTreeGraphResponse = DiffTreeGraphResponse{_DiffTreeGraphResponse'files + :: !(Data.Vector.Vector DiffTreeFileGraph), + _DiffTreeGraphResponse'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeGraphResponse where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeGraphResponse + "files" + ([DiffTreeFileGraph]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeGraphResponse'files + (\ x__ y__ -> x__{_DiffTreeGraphResponse'files = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField DiffTreeGraphResponse + "vec'files" + (Data.Vector.Vector DiffTreeFileGraph) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeGraphResponse'files + (\ x__ y__ -> x__{_DiffTreeGraphResponse'files = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message DiffTreeGraphResponse where + messageName _ + = Data.Text.pack "github.semantic.DiffTreeGraphResponse" + fieldsByTag + = let files__field_descriptor + = Data.ProtoLens.FieldDescriptor "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DiffTreeFileGraph) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"files")) + :: Data.ProtoLens.FieldDescriptor DiffTreeGraphResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _DiffTreeGraphResponse'_unknownFields + (\ x__ y__ -> x__{_DiffTreeGraphResponse'_unknownFields = y__}) + defMessage + = DiffTreeGraphResponse{_DiffTreeGraphResponse'files = + Data.Vector.Generic.empty, + _DiffTreeGraphResponse'_unknownFields = ([])} + parseMessage + = let loop :: + DiffTreeGraphResponse -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + DiffTreeFileGraph + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeGraphResponse + loop x mutable'files + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'files) + 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'files") + frozen'files + 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. "files" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'files + y) + loop x v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'files + in + (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'files) + Data.ProtoLens.Encoding.Bytes. "DiffTreeGraphResponse" + buildMessage + = (\ _x -> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData DiffTreeGraphResponse where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_DiffTreeGraphResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeGraphResponse'files x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.blobs' @:: Lens' DiffTreeRequest [BlobPair]@ + * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' DiffTreeRequest (Data.Vector.Vector BlobPair)@ + -} +data DiffTreeRequest = DiffTreeRequest{_DiffTreeRequest'blobs :: + !(Data.Vector.Vector BlobPair), + _DiffTreeRequest'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeRequest where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeRequest "blobs" + ([BlobPair]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeRequest'blobs + (\ x__ y__ -> x__{_DiffTreeRequest'blobs = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField DiffTreeRequest "vec'blobs" + (Data.Vector.Vector BlobPair) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeRequest'blobs + (\ x__ y__ -> x__{_DiffTreeRequest'blobs = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message DiffTreeRequest where + messageName _ = Data.Text.pack "github.semantic.DiffTreeRequest" + fieldsByTag + = let blobs__field_descriptor + = Data.ProtoLens.FieldDescriptor "blobs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor BlobPair) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"blobs")) + :: Data.ProtoLens.FieldDescriptor DiffTreeRequest + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, blobs__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _DiffTreeRequest'_unknownFields + (\ x__ y__ -> x__{_DiffTreeRequest'_unknownFields = y__}) + defMessage + = DiffTreeRequest{_DiffTreeRequest'blobs = + Data.Vector.Generic.empty, + _DiffTreeRequest'_unknownFields = ([])} + parseMessage + = let loop :: + DiffTreeRequest -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + BlobPair + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeRequest + loop x mutable'blobs + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'blobs) + 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'blobs") + frozen'blobs + 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. "blobs" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'blobs + y) + loop x v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'blobs + in + (do mutable'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'blobs) + Data.ProtoLens.Encoding.Bytes. "DiffTreeRequest" + buildMessage + = (\ _x -> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'blobs") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData DiffTreeRequest where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_DiffTreeRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeRequest'blobs x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' DiffTreeTOCResponse [TOCSummaryFile]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' DiffTreeTOCResponse (Data.Vector.Vector TOCSummaryFile)@ + -} +data DiffTreeTOCResponse = DiffTreeTOCResponse{_DiffTreeTOCResponse'files + :: !(Data.Vector.Vector TOCSummaryFile), + _DiffTreeTOCResponse'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeTOCResponse where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeTOCResponse "files" + ([TOCSummaryFile]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeTOCResponse'files + (\ x__ y__ -> x__{_DiffTreeTOCResponse'files = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField DiffTreeTOCResponse + "vec'files" + (Data.Vector.Vector TOCSummaryFile) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _DiffTreeTOCResponse'files + (\ x__ y__ -> x__{_DiffTreeTOCResponse'files = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message DiffTreeTOCResponse where + messageName _ + = Data.Text.pack "github.semantic.DiffTreeTOCResponse" + fieldsByTag + = let files__field_descriptor + = Data.ProtoLens.FieldDescriptor "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TOCSummaryFile) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"files")) + :: Data.ProtoLens.FieldDescriptor DiffTreeTOCResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _DiffTreeTOCResponse'_unknownFields + (\ x__ y__ -> x__{_DiffTreeTOCResponse'_unknownFields = y__}) + defMessage + = DiffTreeTOCResponse{_DiffTreeTOCResponse'files = + Data.Vector.Generic.empty, + _DiffTreeTOCResponse'_unknownFields = ([])} + parseMessage + = let loop :: + DiffTreeTOCResponse -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + TOCSummaryFile + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeTOCResponse + loop x mutable'files + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'files) + 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'files") + frozen'files + 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. "files" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'files + y) + loop x v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'files + in + (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'files) + Data.ProtoLens.Encoding.Bytes. "DiffTreeTOCResponse" + buildMessage + = (\ _x -> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData DiffTreeTOCResponse where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_DiffTreeTOCResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeTOCResponse'files x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.diffVertexId' @:: Lens' DiffTreeVertex Data.Int.Int32@ + * 'Proto.Semantic_Fields.maybe'diffTerm' @:: Lens' DiffTreeVertex (Prelude.Maybe DiffTreeVertex'DiffTerm)@ + * 'Proto.Semantic_Fields.maybe'deleted' @:: Lens' DiffTreeVertex (Prelude.Maybe DeletedTerm)@ + * 'Proto.Semantic_Fields.deleted' @:: Lens' DiffTreeVertex DeletedTerm@ + * 'Proto.Semantic_Fields.maybe'inserted' @:: Lens' DiffTreeVertex (Prelude.Maybe InsertedTerm)@ + * 'Proto.Semantic_Fields.inserted' @:: Lens' DiffTreeVertex InsertedTerm@ + * 'Proto.Semantic_Fields.maybe'replaced' @:: Lens' DiffTreeVertex (Prelude.Maybe ReplacedTerm)@ + * 'Proto.Semantic_Fields.replaced' @:: Lens' DiffTreeVertex ReplacedTerm@ + * 'Proto.Semantic_Fields.maybe'merged' @:: Lens' DiffTreeVertex (Prelude.Maybe MergedTerm)@ + * 'Proto.Semantic_Fields.merged' @:: Lens' DiffTreeVertex MergedTerm@ + -} +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 + | DiffTreeVertex'Replaced !ReplacedTerm + | DiffTreeVertex'Merged !MergedTerm + 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.Field.HasField DiffTreeVertex + "maybe'replaced" + (Prelude.Maybe ReplacedTerm) + 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'Replaced x__val) -> Prelude.Just + x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Replaced y__) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "replaced" + (ReplacedTerm) + 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'Replaced x__val) -> Prelude.Just + x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Replaced y__)) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField DiffTreeVertex + "maybe'merged" + (Prelude.Maybe MergedTerm) + 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'Merged x__val) -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Merged y__) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "merged" + (MergedTerm) + 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'Merged x__val) -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Merged y__)) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Message DiffTreeVertex where + messageName _ = Data.Text.pack "github.semantic.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 + replaced__field_descriptor + = Data.ProtoLens.FieldDescriptor "replaced" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ReplacedTerm) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'replaced")) + :: Data.ProtoLens.FieldDescriptor DiffTreeVertex + merged__field_descriptor + = Data.ProtoLens.FieldDescriptor "merged" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor MergedTerm) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'merged")) + :: 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), + (Data.ProtoLens.Tag 4, replaced__field_descriptor), + (Data.ProtoLens.Tag 5, merged__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) + 34 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "replaced" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"replaced") + y + x) + 42 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "merged" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"merged") + 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 + Prelude.Just + (DiffTreeVertex'Replaced + 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.ProtoLens.encodeMessage) + v + Prelude.Just + (DiffTreeVertex'Merged + v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 42) 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__ + rnf (DiffTreeVertex'Replaced x__) = Control.DeepSeq.rnf x__ + rnf (DiffTreeVertex'Merged 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) +_DiffTreeVertex'Replaced :: + Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm ReplacedTerm +_DiffTreeVertex'Replaced + = Data.ProtoLens.Prism.prism' DiffTreeVertex'Replaced + (\ p__ -> + case p__ of + DiffTreeVertex'Replaced p__val -> Prelude.Just p__val + _otherwise -> Prelude.Nothing) +_DiffTreeVertex'Merged :: + Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm MergedTerm +_DiffTreeVertex'Merged + = Data.ProtoLens.Prism.prism' DiffTreeVertex'Merged + (\ p__ -> + case p__ of + DiffTreeVertex'Merged p__val -> Prelude.Just p__val + _otherwise -> Prelude.Nothing) +{- | Fields : + + * 'Proto.Semantic_Fields.docstring' @:: Lens' Docstring Data.Text.Text@ + -} +data Docstring = Docstring{_Docstring'docstring :: !Data.Text.Text, + _Docstring'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Docstring where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Docstring "docstring" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Docstring'docstring + (\ x__ y__ -> x__{_Docstring'docstring = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message Docstring where + messageName _ = Data.Text.pack "github.semantic.Docstring" + fieldsByTag + = let docstring__field_descriptor + = Data.ProtoLens.FieldDescriptor "docstring" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"docstring")) + :: Data.ProtoLens.FieldDescriptor Docstring + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, docstring__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _Docstring'_unknownFields + (\ x__ y__ -> x__{_Docstring'_unknownFields = y__}) + defMessage + = Docstring{_Docstring'docstring = Data.ProtoLens.fieldDefault, + _Docstring'_unknownFields = ([])} + parseMessage + = let loop :: + Docstring -> Data.ProtoLens.Encoding.Bytes.Parser Docstring + 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. "docstring" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"docstring") + 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. "Docstring" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"docstring") _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 Docstring where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_Docstring'_unknownFields x__) + (Control.DeepSeq.deepseq (_Docstring'docstring x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' File Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' File Data.Text.Text@ + * 'Proto.Semantic_Fields.symbols' @:: Lens' File [Symbol]@ + * 'Proto.Semantic_Fields.vec'symbols' @:: Lens' File (Data.Vector.Vector Symbol)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' File [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' File (Data.Vector.Vector ParseError)@ + * 'Proto.Semantic_Fields.blobOid' @:: Lens' File Data.Text.Text@ + -} +data File = File{_File'path :: !Data.Text.Text, + _File'language :: !Data.Text.Text, + _File'symbols :: !(Data.Vector.Vector Symbol), + _File'errors :: !(Data.Vector.Vector ParseError), + _File'blobOid :: !Data.Text.Text, + _File'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show File where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField File "path" (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'path + (\ x__ y__ -> x__{_File'path = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField File "language" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'language + (\ x__ y__ -> x__{_File'language = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField File "symbols" ([Symbol]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'symbols + (\ x__ y__ -> x__{_File'symbols = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField File "vec'symbols" + (Data.Vector.Vector Symbol) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'symbols + (\ x__ y__ -> x__{_File'symbols = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField File "errors" ([ParseError]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'errors + (\ x__ y__ -> x__{_File'errors = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField File "vec'errors" + (Data.Vector.Vector ParseError) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'errors + (\ x__ y__ -> x__{_File'errors = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField File "blobOid" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _File'blobOid + (\ x__ y__ -> x__{_File'blobOid = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message File where + messageName _ = Data.Text.pack "github.semantic.File" + fieldsByTag + = let path__field_descriptor + = Data.ProtoLens.FieldDescriptor "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"path")) + :: Data.ProtoLens.FieldDescriptor File + language__field_descriptor + = Data.ProtoLens.FieldDescriptor "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) + :: Data.ProtoLens.FieldDescriptor File + symbols__field_descriptor + = Data.ProtoLens.FieldDescriptor "symbols" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Symbol) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"symbols")) + :: Data.ProtoLens.FieldDescriptor File + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseError) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"errors")) + :: Data.ProtoLens.FieldDescriptor File + blobOid__field_descriptor + = Data.ProtoLens.FieldDescriptor "blob_oid" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"blobOid")) + :: Data.ProtoLens.FieldDescriptor File + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, symbols__field_descriptor), + (Data.ProtoLens.Tag 4, errors__field_descriptor), + (Data.ProtoLens.Tag 5, blobOid__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _File'_unknownFields + (\ x__ y__ -> x__{_File'_unknownFields = y__}) + defMessage + = File{_File'path = Data.ProtoLens.fieldDefault, + _File'language = Data.ProtoLens.fieldDefault, + _File'symbols = Data.Vector.Generic.empty, + _File'errors = Data.Vector.Generic.empty, + _File'blobOid = Data.ProtoLens.fieldDefault, + _File'_unknownFields = ([])} + parseMessage + = let loop :: + File -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + ParseError + -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + Symbol + -> Data.ProtoLens.Encoding.Bytes.Parser File + loop x mutable'errors mutable'symbols + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'symbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'symbols) + 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'errors") + frozen'errors + (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'symbols") + frozen'symbols + 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. "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y + x) + mutable'errors + mutable'symbols + 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. "language" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"language") + y + x) + mutable'errors + mutable'symbols + 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. "symbols" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'symbols + y) + loop x mutable'errors v + 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "errors" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'errors + y) + loop x v mutable'symbols + 42 -> 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. "blob_oid" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"blobOid") + y + x) + mutable'errors + mutable'symbols + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'errors + mutable'symbols + in + (do mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'symbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'errors mutable'symbols) + Data.ProtoLens.Encoding.Bytes. "File" + buildMessage + = (\ _x -> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _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.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _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.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'symbols") _x)) + Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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.ProtoLens.encodeMessage) + _v) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) + Data.Monoid.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"blobOid") _x + in + if (_v) Prelude.== Data.ProtoLens.fieldDefault then + Data.Monoid.mempty else + (Data.ProtoLens.Encoding.Bytes.putVarInt 42) 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 File where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_File'_unknownFields x__) + (Control.DeepSeq.deepseq (_File'path x__) + (Control.DeepSeq.deepseq (_File'language x__) + (Control.DeepSeq.deepseq (_File'symbols x__) + (Control.DeepSeq.deepseq (_File'errors x__) + (Control.DeepSeq.deepseq (_File'blobOid x__) (()))))))) +{- | Fields : + + * 'Proto.Semantic_Fields.term' @:: Lens' InsertedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' InsertedTerm Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' InsertedTerm (Prelude.Maybe Span)@ + -} +data InsertedTerm = InsertedTerm{_InsertedTerm'term :: + !Data.Text.Text, + _InsertedTerm'span :: !(Prelude.Maybe Span), + _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.Field.HasField InsertedTerm "span" (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _InsertedTerm'span + (\ x__ y__ -> x__{_InsertedTerm'span = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField InsertedTerm "maybe'span" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _InsertedTerm'span + (\ x__ y__ -> x__{_InsertedTerm'span = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message InsertedTerm where + messageName _ = Data.Text.pack "github.semantic.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 + span__field_descriptor + = Data.ProtoLens.FieldDescriptor "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) + :: Data.ProtoLens.FieldDescriptor InsertedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, term__field_descriptor), + (Data.ProtoLens.Tag 2, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _InsertedTerm'_unknownFields + (\ x__ y__ -> x__{_InsertedTerm'_unknownFields = y__}) + defMessage + = InsertedTerm{_InsertedTerm'term = Data.ProtoLens.fieldDefault, + _InsertedTerm'span = Prelude.Nothing, + _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) + 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. "span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + 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__) + (Control.DeepSeq.deepseq (_InsertedTerm'span x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.term' @:: Lens' MergedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.beforeSpan' @:: Lens' MergedTerm Span@ + * 'Proto.Semantic_Fields.maybe'beforeSpan' @:: Lens' MergedTerm (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.afterSpan' @:: Lens' MergedTerm Span@ + * 'Proto.Semantic_Fields.maybe'afterSpan' @:: Lens' MergedTerm (Prelude.Maybe Span)@ + -} +data MergedTerm = MergedTerm{_MergedTerm'term :: !Data.Text.Text, + _MergedTerm'beforeSpan :: !(Prelude.Maybe Span), + _MergedTerm'afterSpan :: !(Prelude.Maybe Span), + _MergedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show MergedTerm where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField MergedTerm "term" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _MergedTerm'term + (\ x__ y__ -> x__{_MergedTerm'term = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField MergedTerm "beforeSpan" + (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _MergedTerm'beforeSpan + (\ x__ y__ -> x__{_MergedTerm'beforeSpan = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField MergedTerm + "maybe'beforeSpan" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _MergedTerm'beforeSpan + (\ x__ y__ -> x__{_MergedTerm'beforeSpan = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField MergedTerm "afterSpan" + (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _MergedTerm'afterSpan + (\ x__ y__ -> x__{_MergedTerm'afterSpan = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField MergedTerm "maybe'afterSpan" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _MergedTerm'afterSpan + (\ x__ y__ -> x__{_MergedTerm'afterSpan = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message MergedTerm where + messageName _ = Data.Text.pack "github.semantic.MergedTerm" + 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 MergedTerm + beforeSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor "before_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'beforeSpan")) + :: Data.ProtoLens.FieldDescriptor MergedTerm + afterSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor "after_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'afterSpan")) + :: Data.ProtoLens.FieldDescriptor MergedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, term__field_descriptor), + (Data.ProtoLens.Tag 2, beforeSpan__field_descriptor), + (Data.ProtoLens.Tag 3, afterSpan__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _MergedTerm'_unknownFields + (\ x__ y__ -> x__{_MergedTerm'_unknownFields = y__}) + defMessage + = MergedTerm{_MergedTerm'term = Data.ProtoLens.fieldDefault, + _MergedTerm'beforeSpan = Prelude.Nothing, + _MergedTerm'afterSpan = Prelude.Nothing, + _MergedTerm'_unknownFields = ([])} + parseMessage + = let loop :: + MergedTerm -> Data.ProtoLens.Encoding.Bytes.Parser MergedTerm + 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) + 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. "before_span" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"beforeSpan") + 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. "after_span" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"afterSpan") + 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. "MergedTerm" + 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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'beforeSpan") + _x + of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + Data.Monoid.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'afterSpan") + _x + of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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 MergedTerm where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_MergedTerm'_unknownFields x__) + (Control.DeepSeq.deepseq (_MergedTerm'term x__) + (Control.DeepSeq.deepseq (_MergedTerm'beforeSpan x__) + (Control.DeepSeq.deepseq (_MergedTerm'afterSpan x__) (()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.error' @:: Lens' ParseError Data.Text.Text@ + -} +data ParseError = ParseError{_ParseError'error :: !Data.Text.Text, + _ParseError'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseError where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseError "error" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseError'error + (\ x__ y__ -> x__{_ParseError'error = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message ParseError where + messageName _ = Data.Text.pack "github.semantic.ParseError" + fieldsByTag + = let error__field_descriptor + = Data.ProtoLens.FieldDescriptor "error" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"error")) + :: Data.ProtoLens.FieldDescriptor ParseError + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, error__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _ParseError'_unknownFields + (\ x__ y__ -> x__{_ParseError'_unknownFields = y__}) + defMessage + = ParseError{_ParseError'error = Data.ProtoLens.fieldDefault, + _ParseError'_unknownFields = ([])} + parseMessage + = let loop :: + ParseError -> Data.ProtoLens.Encoding.Bytes.Parser ParseError + 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. "error" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"error") 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. "ParseError" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"error") _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 ParseError where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_ParseError'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseError'error x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' ParseTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' ParseTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.vertices' @:: Lens' ParseTreeFileGraph [TermVertex]@ + * 'Proto.Semantic_Fields.vec'vertices' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector TermVertex)@ + * 'Proto.Semantic_Fields.edges' @:: Lens' ParseTreeFileGraph [TermEdge]@ + * 'Proto.Semantic_Fields.vec'edges' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector TermEdge)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' ParseTreeFileGraph [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector ParseError)@ + -} +data ParseTreeFileGraph = ParseTreeFileGraph{_ParseTreeFileGraph'path + :: !Data.Text.Text, + _ParseTreeFileGraph'language :: !Data.Text.Text, + _ParseTreeFileGraph'vertices :: + !(Data.Vector.Vector TermVertex), + _ParseTreeFileGraph'edges :: + !(Data.Vector.Vector TermEdge), + _ParseTreeFileGraph'errors :: + !(Data.Vector.Vector ParseError), + _ParseTreeFileGraph'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeFileGraph where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "path" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'path + (\ x__ y__ -> x__{_ParseTreeFileGraph'path = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph + "language" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'language + (\ x__ y__ -> x__{_ParseTreeFileGraph'language = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph + "vertices" + ([TermVertex]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'vertices + (\ x__ y__ -> x__{_ParseTreeFileGraph'vertices = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph + "vec'vertices" + (Data.Vector.Vector TermVertex) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'vertices + (\ x__ y__ -> x__{_ParseTreeFileGraph'vertices = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "edges" + ([TermEdge]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'edges + (\ x__ y__ -> x__{_ParseTreeFileGraph'edges = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph + "vec'edges" + (Data.Vector.Vector TermEdge) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'edges + (\ x__ y__ -> x__{_ParseTreeFileGraph'edges = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "errors" + ([ParseError]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'errors + (\ x__ y__ -> x__{_ParseTreeFileGraph'errors = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph + "vec'errors" + (Data.Vector.Vector ParseError) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'errors + (\ x__ y__ -> x__{_ParseTreeFileGraph'errors = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message ParseTreeFileGraph where + messageName _ = Data.Text.pack "github.semantic.ParseTreeFileGraph" + fieldsByTag + = let path__field_descriptor + = Data.ProtoLens.FieldDescriptor "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"path")) + :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + language__field_descriptor + = Data.ProtoLens.FieldDescriptor "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) + :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + vertices__field_descriptor + = Data.ProtoLens.FieldDescriptor "vertices" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TermVertex) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"vertices")) + :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + edges__field_descriptor + = Data.ProtoLens.FieldDescriptor "edges" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TermEdge) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"edges")) + :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseError) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"errors")) + :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, vertices__field_descriptor), + (Data.ProtoLens.Tag 4, edges__field_descriptor), + (Data.ProtoLens.Tag 5, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _ParseTreeFileGraph'_unknownFields + (\ x__ y__ -> x__{_ParseTreeFileGraph'_unknownFields = y__}) + defMessage + = ParseTreeFileGraph{_ParseTreeFileGraph'path = + Data.ProtoLens.fieldDefault, + _ParseTreeFileGraph'language = Data.ProtoLens.fieldDefault, + _ParseTreeFileGraph'vertices = Data.Vector.Generic.empty, + _ParseTreeFileGraph'edges = Data.Vector.Generic.empty, + _ParseTreeFileGraph'errors = Data.Vector.Generic.empty, + _ParseTreeFileGraph'_unknownFields = ([])} + parseMessage + = let loop :: + ParseTreeFileGraph -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + TermEdge + -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + ParseError + -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + TermVertex + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeFileGraph + loop x mutable'edges mutable'errors mutable'vertices + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'edges) + frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'vertices) + 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'edges") + frozen'edges + (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'vertices") + frozen'vertices + 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. "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y + x) + mutable'edges + mutable'errors + mutable'vertices + 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. "language" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"language") + y + x) + mutable'edges + mutable'errors + mutable'vertices + 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. "vertices" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'vertices + y) + loop x mutable'edges mutable'errors v + 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "edges" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'edges + y) + loop x v mutable'errors mutable'vertices + 42 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "errors" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'errors + y) + loop x mutable'edges v mutable'vertices + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'edges + mutable'errors + mutable'vertices + in + (do mutable'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'edges mutable'errors + mutable'vertices) + Data.ProtoLens.Encoding.Bytes. "ParseTreeFileGraph" + buildMessage + = (\ _x -> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _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.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _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.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'vertices") + _x)) + Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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.ProtoLens.encodeMessage) + _v) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'edges") _x)) + Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _v -> + (Data.ProtoLens.Encoding.Bytes.putVarInt 42) 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'errors") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseTreeFileGraph where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_ParseTreeFileGraph'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeFileGraph'path x__) + (Control.DeepSeq.deepseq (_ParseTreeFileGraph'language x__) + (Control.DeepSeq.deepseq (_ParseTreeFileGraph'vertices x__) + (Control.DeepSeq.deepseq (_ParseTreeFileGraph'edges x__) + (Control.DeepSeq.deepseq (_ParseTreeFileGraph'errors x__) + (()))))))) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' ParseTreeGraphResponse [ParseTreeFileGraph]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' ParseTreeGraphResponse + (Data.Vector.Vector ParseTreeFileGraph)@ + -} +data ParseTreeGraphResponse = ParseTreeGraphResponse{_ParseTreeGraphResponse'files + :: !(Data.Vector.Vector ParseTreeFileGraph), + _ParseTreeGraphResponse'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeGraphResponse where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeGraphResponse + "files" + ([ParseTreeFileGraph]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeGraphResponse'files + (\ x__ y__ -> x__{_ParseTreeGraphResponse'files = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField ParseTreeGraphResponse + "vec'files" + (Data.Vector.Vector ParseTreeFileGraph) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeGraphResponse'files + (\ x__ y__ -> x__{_ParseTreeGraphResponse'files = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message ParseTreeGraphResponse where + messageName _ + = Data.Text.pack "github.semantic.ParseTreeGraphResponse" + fieldsByTag + = let files__field_descriptor + = Data.ProtoLens.FieldDescriptor "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseTreeFileGraph) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"files")) + :: Data.ProtoLens.FieldDescriptor ParseTreeGraphResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseTreeGraphResponse'_unknownFields + (\ x__ y__ -> x__{_ParseTreeGraphResponse'_unknownFields = y__}) + defMessage + = ParseTreeGraphResponse{_ParseTreeGraphResponse'files = + Data.Vector.Generic.empty, + _ParseTreeGraphResponse'_unknownFields = ([])} + parseMessage + = let loop :: + ParseTreeGraphResponse -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + ParseTreeFileGraph + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeGraphResponse + loop x mutable'files + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'files) + 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'files") + frozen'files + 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. "files" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'files + y) + loop x v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'files + in + (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'files) + Data.ProtoLens.Encoding.Bytes. "ParseTreeGraphResponse" + buildMessage + = (\ _x -> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseTreeGraphResponse where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq + (_ParseTreeGraphResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeGraphResponse'files x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.blobs' @:: Lens' ParseTreeRequest [Blob]@ + * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' ParseTreeRequest (Data.Vector.Vector Blob)@ + -} +data ParseTreeRequest = ParseTreeRequest{_ParseTreeRequest'blobs :: + !(Data.Vector.Vector Blob), + _ParseTreeRequest'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeRequest where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeRequest "blobs" + ([Blob]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeRequest'blobs + (\ x__ y__ -> x__{_ParseTreeRequest'blobs = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField ParseTreeRequest "vec'blobs" + (Data.Vector.Vector Blob) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeRequest'blobs + (\ x__ y__ -> x__{_ParseTreeRequest'blobs = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message ParseTreeRequest where + messageName _ = Data.Text.pack "github.semantic.ParseTreeRequest" + fieldsByTag + = let blobs__field_descriptor + = Data.ProtoLens.FieldDescriptor "blobs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"blobs")) + :: Data.ProtoLens.FieldDescriptor ParseTreeRequest + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, blobs__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _ParseTreeRequest'_unknownFields + (\ x__ y__ -> x__{_ParseTreeRequest'_unknownFields = y__}) + defMessage + = ParseTreeRequest{_ParseTreeRequest'blobs = + Data.Vector.Generic.empty, + _ParseTreeRequest'_unknownFields = ([])} + parseMessage + = let loop :: + ParseTreeRequest -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + Blob + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeRequest + loop x mutable'blobs + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'blobs) + 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'blobs") + frozen'blobs + 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. "blobs" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'blobs + y) + loop x v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'blobs + in + (do mutable'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'blobs) + Data.ProtoLens.Encoding.Bytes. "ParseTreeRequest" + buildMessage + = (\ _x -> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'blobs") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseTreeRequest where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_ParseTreeRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeRequest'blobs x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' ParseTreeSymbolResponse [File]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' ParseTreeSymbolResponse (Data.Vector.Vector File)@ + -} +data ParseTreeSymbolResponse = ParseTreeSymbolResponse{_ParseTreeSymbolResponse'files + :: !(Data.Vector.Vector File), + _ParseTreeSymbolResponse'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeSymbolResponse where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeSymbolResponse + "files" + ([File]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeSymbolResponse'files + (\ x__ y__ -> x__{_ParseTreeSymbolResponse'files = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField ParseTreeSymbolResponse + "vec'files" + (Data.Vector.Vector File) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ParseTreeSymbolResponse'files + (\ x__ y__ -> x__{_ParseTreeSymbolResponse'files = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message ParseTreeSymbolResponse where + messageName _ + = Data.Text.pack "github.semantic.ParseTreeSymbolResponse" + fieldsByTag + = let files__field_descriptor + = Data.ProtoLens.FieldDescriptor "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor File) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"files")) + :: Data.ProtoLens.FieldDescriptor ParseTreeSymbolResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseTreeSymbolResponse'_unknownFields + (\ x__ y__ -> x__{_ParseTreeSymbolResponse'_unknownFields = y__}) + defMessage + = ParseTreeSymbolResponse{_ParseTreeSymbolResponse'files = + Data.Vector.Generic.empty, + _ParseTreeSymbolResponse'_unknownFields = ([])} + parseMessage + = let loop :: + ParseTreeSymbolResponse -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + File + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeSymbolResponse + loop x mutable'files + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'files) + 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'files") + frozen'files + 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. "files" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'files + y) + loop x v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'files + in + (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'files) + Data.ProtoLens.Encoding.Bytes. "ParseTreeSymbolResponse" + buildMessage + = (\ _x -> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ParseTreeSymbolResponse where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq + (_ParseTreeSymbolResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeSymbolResponse'files x__) + (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.service' @:: Lens' PingRequest Data.Text.Text@ + -} +data PingRequest = PingRequest{_PingRequest'service :: + !Data.Text.Text, + _PingRequest'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show PingRequest where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField PingRequest "service" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _PingRequest'service + (\ x__ y__ -> x__{_PingRequest'service = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message PingRequest where + messageName _ = Data.Text.pack "github.semantic.PingRequest" + 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 PingRequest + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, service__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _PingRequest'_unknownFields + (\ x__ y__ -> x__{_PingRequest'_unknownFields = y__}) + defMessage + = PingRequest{_PingRequest'service = Data.ProtoLens.fieldDefault, + _PingRequest'_unknownFields = ([])} + parseMessage + = let loop :: + PingRequest -> Data.ProtoLens.Encoding.Bytes.Parser PingRequest + 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. "PingRequest" + 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 PingRequest where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_PingRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_PingRequest'service x__) (()))) +{- | Fields : + + * 'Proto.Semantic_Fields.status' @:: Lens' PingResponse Data.Text.Text@ + * 'Proto.Semantic_Fields.hostname' @:: Lens' PingResponse Data.Text.Text@ + * 'Proto.Semantic_Fields.timestamp' @:: Lens' PingResponse Data.Text.Text@ + * 'Proto.Semantic_Fields.sha' @:: Lens' PingResponse Data.Text.Text@ + -} +data PingResponse = PingResponse{_PingResponse'status :: + !Data.Text.Text, + _PingResponse'hostname :: !Data.Text.Text, + _PingResponse'timestamp :: !Data.Text.Text, + _PingResponse'sha :: !Data.Text.Text, + _PingResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show PingResponse where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField PingResponse "status" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _PingResponse'status + (\ x__ y__ -> x__{_PingResponse'status = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField PingResponse "hostname" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _PingResponse'hostname + (\ x__ y__ -> x__{_PingResponse'hostname = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField PingResponse "timestamp" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _PingResponse'timestamp + (\ x__ y__ -> x__{_PingResponse'timestamp = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField PingResponse "sha" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _PingResponse'sha + (\ x__ y__ -> x__{_PingResponse'sha = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message PingResponse where + messageName _ = Data.Text.pack "github.semantic.PingResponse" + 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 PingResponse + hostname__field_descriptor + = Data.ProtoLens.FieldDescriptor "hostname" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"hostname")) + :: Data.ProtoLens.FieldDescriptor PingResponse + timestamp__field_descriptor + = Data.ProtoLens.FieldDescriptor "timestamp" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"timestamp")) + :: Data.ProtoLens.FieldDescriptor PingResponse + sha__field_descriptor + = Data.ProtoLens.FieldDescriptor "sha" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"sha")) + :: Data.ProtoLens.FieldDescriptor PingResponse + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, status__field_descriptor), + (Data.ProtoLens.Tag 2, hostname__field_descriptor), + (Data.ProtoLens.Tag 3, timestamp__field_descriptor), + (Data.ProtoLens.Tag 4, sha__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _PingResponse'_unknownFields + (\ x__ y__ -> x__{_PingResponse'_unknownFields = y__}) + defMessage + = PingResponse{_PingResponse'status = Data.ProtoLens.fieldDefault, + _PingResponse'hostname = Data.ProtoLens.fieldDefault, + _PingResponse'timestamp = Data.ProtoLens.fieldDefault, + _PingResponse'sha = Data.ProtoLens.fieldDefault, + _PingResponse'_unknownFields = ([])} + parseMessage + = let loop :: + PingResponse -> Data.ProtoLens.Encoding.Bytes.Parser PingResponse + 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. "status" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"status") + 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. "hostname" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"hostname") + 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. "timestamp" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"timestamp") + 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. "sha" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"sha") 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. "PingResponse" + 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.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"hostname") _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 @"timestamp") _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.<> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"sha") _x + in + if (_v) Prelude.== Data.ProtoLens.fieldDefault then + Data.Monoid.mempty else + (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 PingResponse where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_PingResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_PingResponse'status x__) + (Control.DeepSeq.deepseq (_PingResponse'hostname x__) + (Control.DeepSeq.deepseq (_PingResponse'timestamp x__) + (Control.DeepSeq.deepseq (_PingResponse'sha x__) (())))))) +{- | Fields : + + * 'Proto.Semantic_Fields.line' @:: Lens' Position Data.Int.Int32@ + * 'Proto.Semantic_Fields.column' @:: Lens' Position Data.Int.Int32@ + -} +data Position = Position{_Position'line :: !Data.Int.Int32, + _Position'column :: !Data.Int.Int32, + _Position'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Position where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Position "line" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Position'line + (\ x__ y__ -> x__{_Position'line = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Position "column" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Position'column + (\ x__ y__ -> x__{_Position'column = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message Position where + messageName _ = Data.Text.pack "github.semantic.Position" + fieldsByTag + = let line__field_descriptor + = Data.ProtoLens.FieldDescriptor "line" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"line")) + :: Data.ProtoLens.FieldDescriptor Position + column__field_descriptor + = Data.ProtoLens.FieldDescriptor "column" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"column")) + :: Data.ProtoLens.FieldDescriptor Position + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, line__field_descriptor), + (Data.ProtoLens.Tag 2, column__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _Position'_unknownFields + (\ x__ y__ -> x__{_Position'_unknownFields = y__}) + defMessage + = Position{_Position'line = Data.ProtoLens.fieldDefault, + _Position'column = Data.ProtoLens.fieldDefault, + _Position'_unknownFields = ([])} + parseMessage + = let loop :: + Position -> Data.ProtoLens.Encoding.Bytes.Parser Position + 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. "line" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y + x) + 16 -> do y <- (Prelude.fmap Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + Data.ProtoLens.Encoding.Bytes. "column" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"column") + 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. "Position" + buildMessage + = (\ _x -> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"line") _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 @"column") _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 Position where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_Position'_unknownFields x__) + (Control.DeepSeq.deepseq (_Position'line x__) + (Control.DeepSeq.deepseq (_Position'column x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.beforeTerm' @:: Lens' ReplacedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.beforeSpan' @:: Lens' ReplacedTerm Span@ + * 'Proto.Semantic_Fields.maybe'beforeSpan' @:: Lens' ReplacedTerm (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.afterTerm' @:: Lens' ReplacedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.afterSpan' @:: Lens' ReplacedTerm Span@ + * 'Proto.Semantic_Fields.maybe'afterSpan' @:: Lens' ReplacedTerm (Prelude.Maybe Span)@ + -} +data ReplacedTerm = ReplacedTerm{_ReplacedTerm'beforeTerm :: + !Data.Text.Text, + _ReplacedTerm'beforeSpan :: !(Prelude.Maybe Span), + _ReplacedTerm'afterTerm :: !Data.Text.Text, + _ReplacedTerm'afterSpan :: !(Prelude.Maybe Span), + _ReplacedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ReplacedTerm where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ReplacedTerm "beforeTerm" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ReplacedTerm'beforeTerm + (\ x__ y__ -> x__{_ReplacedTerm'beforeTerm = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ReplacedTerm "beforeSpan" + (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ReplacedTerm'beforeSpan + (\ x__ y__ -> x__{_ReplacedTerm'beforeSpan = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField ReplacedTerm + "maybe'beforeSpan" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ReplacedTerm'beforeSpan + (\ x__ y__ -> x__{_ReplacedTerm'beforeSpan = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ReplacedTerm "afterTerm" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ReplacedTerm'afterTerm + (\ x__ y__ -> x__{_ReplacedTerm'afterTerm = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField ReplacedTerm "afterSpan" + (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ReplacedTerm'afterSpan + (\ x__ y__ -> x__{_ReplacedTerm'afterSpan = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField ReplacedTerm + "maybe'afterSpan" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _ReplacedTerm'afterSpan + (\ x__ y__ -> x__{_ReplacedTerm'afterSpan = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message ReplacedTerm where + messageName _ = Data.Text.pack "github.semantic.ReplacedTerm" + fieldsByTag + = let beforeTerm__field_descriptor + = Data.ProtoLens.FieldDescriptor "before_term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"beforeTerm")) + :: Data.ProtoLens.FieldDescriptor ReplacedTerm + beforeSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor "before_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'beforeSpan")) + :: Data.ProtoLens.FieldDescriptor ReplacedTerm + afterTerm__field_descriptor + = Data.ProtoLens.FieldDescriptor "after_term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"afterTerm")) + :: Data.ProtoLens.FieldDescriptor ReplacedTerm + afterSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor "after_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'afterSpan")) + :: Data.ProtoLens.FieldDescriptor ReplacedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, beforeTerm__field_descriptor), + (Data.ProtoLens.Tag 2, beforeSpan__field_descriptor), + (Data.ProtoLens.Tag 3, afterTerm__field_descriptor), + (Data.ProtoLens.Tag 4, afterSpan__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _ReplacedTerm'_unknownFields + (\ x__ y__ -> x__{_ReplacedTerm'_unknownFields = y__}) + defMessage + = ReplacedTerm{_ReplacedTerm'beforeTerm = + Data.ProtoLens.fieldDefault, + _ReplacedTerm'beforeSpan = Prelude.Nothing, + _ReplacedTerm'afterTerm = Data.ProtoLens.fieldDefault, + _ReplacedTerm'afterSpan = Prelude.Nothing, + _ReplacedTerm'_unknownFields = ([])} + parseMessage + = let loop :: + ReplacedTerm -> Data.ProtoLens.Encoding.Bytes.Parser ReplacedTerm + 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. "before_term" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"beforeTerm") + 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. "before_span" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"beforeSpan") + 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. "after_term" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"afterTerm") + y + x) + 34 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "after_span" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"afterSpan") + 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. "ReplacedTerm" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"beforeTerm") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'beforeSpan") + _x + of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + Data.Monoid.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"afterTerm") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'afterSpan") + _x + of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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.ProtoLens.encodeMessage) + _v) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData ReplacedTerm where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_ReplacedTerm'_unknownFields x__) + (Control.DeepSeq.deepseq (_ReplacedTerm'beforeTerm x__) + (Control.DeepSeq.deepseq (_ReplacedTerm'beforeSpan x__) + (Control.DeepSeq.deepseq (_ReplacedTerm'afterTerm x__) + (Control.DeepSeq.deepseq (_ReplacedTerm'afterSpan x__) (())))))) +{- | Fields : + + * 'Proto.Semantic_Fields.start' @:: Lens' Span Position@ + * 'Proto.Semantic_Fields.maybe'start' @:: Lens' Span (Prelude.Maybe Position)@ + * 'Proto.Semantic_Fields.end' @:: Lens' Span Position@ + * 'Proto.Semantic_Fields.maybe'end' @:: Lens' Span (Prelude.Maybe Position)@ + -} +data Span = Span{_Span'start :: !(Prelude.Maybe Position), + _Span'end :: !(Prelude.Maybe Position), + _Span'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Span where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Span "start" (Position) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Span'start + (\ x__ y__ -> x__{_Span'start = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField Span "maybe'start" + (Prelude.Maybe Position) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Span'start + (\ x__ y__ -> x__{_Span'start = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Span "end" (Position) where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Span'end + (\ x__ y__ -> x__{_Span'end = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField Span "maybe'end" + (Prelude.Maybe Position) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Span'end + (\ x__ y__ -> x__{_Span'end = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message Span where + messageName _ = Data.Text.pack "github.semantic.Span" + fieldsByTag + = let start__field_descriptor + = Data.ProtoLens.FieldDescriptor "start" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Position) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'start")) + :: Data.ProtoLens.FieldDescriptor Span + end__field_descriptor + = Data.ProtoLens.FieldDescriptor "end" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Position) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'end")) + :: Data.ProtoLens.FieldDescriptor Span + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, start__field_descriptor), + (Data.ProtoLens.Tag 2, end__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _Span'_unknownFields + (\ x__ y__ -> x__{_Span'_unknownFields = y__}) + defMessage + = Span{_Span'start = Prelude.Nothing, _Span'end = Prelude.Nothing, + _Span'_unknownFields = ([])} + parseMessage + = let loop :: Span -> Data.ProtoLens.Encoding.Bytes.Parser Span + 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. "start" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"start") 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. "end" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"end") 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. "Span" + buildMessage + = (\ _x -> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'start") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'end") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData Span where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_Span'_unknownFields x__) + (Control.DeepSeq.deepseq (_Span'start x__) + (Control.DeepSeq.deepseq (_Span'end x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.symbol' @:: Lens' Symbol Data.Text.Text@ + * 'Proto.Semantic_Fields.kind' @:: Lens' Symbol Data.Text.Text@ + * 'Proto.Semantic_Fields.line' @:: Lens' Symbol Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' Symbol Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' Symbol (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.docs' @:: Lens' Symbol Docstring@ + * 'Proto.Semantic_Fields.maybe'docs' @:: Lens' Symbol (Prelude.Maybe Docstring)@ + -} +data Symbol = Symbol{_Symbol'symbol :: !Data.Text.Text, + _Symbol'kind :: !Data.Text.Text, _Symbol'line :: !Data.Text.Text, + _Symbol'span :: !(Prelude.Maybe Span), + _Symbol'docs :: !(Prelude.Maybe Docstring), + _Symbol'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show Symbol where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField Symbol "symbol" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'symbol + (\ x__ y__ -> x__{_Symbol'symbol = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "kind" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'kind + (\ x__ y__ -> x__{_Symbol'kind = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "line" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'line + (\ x__ y__ -> x__{_Symbol'line = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "span" (Span) where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'span + (\ x__ y__ -> x__{_Symbol'span = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField Symbol "maybe'span" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'span + (\ x__ y__ -> x__{_Symbol'span = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField Symbol "docs" (Docstring) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'docs + (\ x__ y__ -> x__{_Symbol'docs = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField Symbol "maybe'docs" + (Prelude.Maybe Docstring) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _Symbol'docs + (\ x__ y__ -> x__{_Symbol'docs = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message Symbol where + messageName _ = Data.Text.pack "github.semantic.Symbol" + fieldsByTag + = let symbol__field_descriptor + = Data.ProtoLens.FieldDescriptor "symbol" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"symbol")) + :: Data.ProtoLens.FieldDescriptor Symbol + kind__field_descriptor + = Data.ProtoLens.FieldDescriptor "kind" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"kind")) + :: Data.ProtoLens.FieldDescriptor Symbol + line__field_descriptor + = Data.ProtoLens.FieldDescriptor "line" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"line")) + :: Data.ProtoLens.FieldDescriptor Symbol + span__field_descriptor + = Data.ProtoLens.FieldDescriptor "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) + :: Data.ProtoLens.FieldDescriptor Symbol + docs__field_descriptor + = Data.ProtoLens.FieldDescriptor "docs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Docstring) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'docs")) + :: Data.ProtoLens.FieldDescriptor Symbol + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, symbol__field_descriptor), + (Data.ProtoLens.Tag 2, kind__field_descriptor), + (Data.ProtoLens.Tag 3, line__field_descriptor), + (Data.ProtoLens.Tag 4, span__field_descriptor), + (Data.ProtoLens.Tag 5, docs__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _Symbol'_unknownFields + (\ x__ y__ -> x__{_Symbol'_unknownFields = y__}) + defMessage + = Symbol{_Symbol'symbol = Data.ProtoLens.fieldDefault, + _Symbol'kind = Data.ProtoLens.fieldDefault, + _Symbol'line = Data.ProtoLens.fieldDefault, + _Symbol'span = Prelude.Nothing, _Symbol'docs = Prelude.Nothing, + _Symbol'_unknownFields = ([])} + parseMessage + = let loop :: Symbol -> Data.ProtoLens.Encoding.Bytes.Parser Symbol + 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. "symbol" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"symbol") + 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. "kind" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"kind") 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. "line" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y + x) + 34 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y + x) + 42 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "docs" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"docs") 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. "Symbol" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"symbol") _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.<> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"kind") _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 @"line") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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.ProtoLens.encodeMessage) + _v) + Data.Monoid.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'docs") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 42) + 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 Symbol where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_Symbol'_unknownFields x__) + (Control.DeepSeq.deepseq (_Symbol'symbol x__) + (Control.DeepSeq.deepseq (_Symbol'kind x__) + (Control.DeepSeq.deepseq (_Symbol'line x__) + (Control.DeepSeq.deepseq (_Symbol'span x__) + (Control.DeepSeq.deepseq (_Symbol'docs x__) (()))))))) +{- | Fields : + + * 'Proto.Semantic_Fields.category' @:: Lens' TOCSummaryChange Data.Text.Text@ + * 'Proto.Semantic_Fields.term' @:: Lens' TOCSummaryChange Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' TOCSummaryChange Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TOCSummaryChange (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.changeType' @:: Lens' TOCSummaryChange ChangeType@ + -} +data TOCSummaryChange = TOCSummaryChange{_TOCSummaryChange'category + :: !Data.Text.Text, + _TOCSummaryChange'term :: !Data.Text.Text, + _TOCSummaryChange'span :: !(Prelude.Maybe Span), + _TOCSummaryChange'changeType :: !ChangeType, + _TOCSummaryChange'_unknownFields :: + !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TOCSummaryChange where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TOCSummaryChange "category" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryChange'category + (\ x__ y__ -> x__{_TOCSummaryChange'category = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryChange "term" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryChange'term + (\ x__ y__ -> x__{_TOCSummaryChange'term = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryChange "span" + (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryChange'span + (\ x__ y__ -> x__{_TOCSummaryChange'span = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField TOCSummaryChange + "maybe'span" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryChange'span + (\ x__ y__ -> x__{_TOCSummaryChange'span = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryChange + "changeType" + (ChangeType) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryChange'changeType + (\ x__ y__ -> x__{_TOCSummaryChange'changeType = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message TOCSummaryChange where + messageName _ = Data.Text.pack "github.semantic.TOCSummaryChange" + fieldsByTag + = let category__field_descriptor + = Data.ProtoLens.FieldDescriptor "category" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"category")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryChange + 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 TOCSummaryChange + span__field_descriptor + = Data.ProtoLens.FieldDescriptor "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryChange + 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 TOCSummaryChange + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, category__field_descriptor), + (Data.ProtoLens.Tag 2, term__field_descriptor), + (Data.ProtoLens.Tag 3, span__field_descriptor), + (Data.ProtoLens.Tag 4, changeType__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _TOCSummaryChange'_unknownFields + (\ x__ y__ -> x__{_TOCSummaryChange'_unknownFields = y__}) + defMessage + = TOCSummaryChange{_TOCSummaryChange'category = + Data.ProtoLens.fieldDefault, + _TOCSummaryChange'term = Data.ProtoLens.fieldDefault, + _TOCSummaryChange'span = Prelude.Nothing, + _TOCSummaryChange'changeType = Data.ProtoLens.fieldDefault, + _TOCSummaryChange'_unknownFields = ([])} + parseMessage + = let loop :: + TOCSummaryChange -> + Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryChange + 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. "category" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"category") + 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. "term" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"term") 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. "span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y + x) + 32 -> 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. "TOCSummaryChange" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"category") _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.<> + (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 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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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.<> + (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 32) 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 TOCSummaryChange where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_TOCSummaryChange'_unknownFields x__) + (Control.DeepSeq.deepseq (_TOCSummaryChange'category x__) + (Control.DeepSeq.deepseq (_TOCSummaryChange'term x__) + (Control.DeepSeq.deepseq (_TOCSummaryChange'span x__) + (Control.DeepSeq.deepseq (_TOCSummaryChange'changeType x__) + (())))))) +{- | Fields : + + * 'Proto.Semantic_Fields.error' @:: Lens' TOCSummaryError Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' TOCSummaryError Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TOCSummaryError (Prelude.Maybe Span)@ + -} +data TOCSummaryError = TOCSummaryError{_TOCSummaryError'error :: + !Data.Text.Text, + _TOCSummaryError'span :: !(Prelude.Maybe Span), + _TOCSummaryError'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TOCSummaryError where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TOCSummaryError "error" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryError'error + (\ x__ y__ -> x__{_TOCSummaryError'error = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryError "span" + (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryError'span + (\ x__ y__ -> x__{_TOCSummaryError'span = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField TOCSummaryError "maybe'span" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryError'span + (\ x__ y__ -> x__{_TOCSummaryError'span = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message TOCSummaryError where + messageName _ = Data.Text.pack "github.semantic.TOCSummaryError" + fieldsByTag + = let error__field_descriptor + = Data.ProtoLens.FieldDescriptor "error" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"error")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryError + span__field_descriptor + = Data.ProtoLens.FieldDescriptor "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryError + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, error__field_descriptor), + (Data.ProtoLens.Tag 2, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _TOCSummaryError'_unknownFields + (\ x__ y__ -> x__{_TOCSummaryError'_unknownFields = y__}) + defMessage + = TOCSummaryError{_TOCSummaryError'error = + Data.ProtoLens.fieldDefault, + _TOCSummaryError'span = Prelude.Nothing, + _TOCSummaryError'_unknownFields = ([])} + parseMessage + = let loop :: + TOCSummaryError -> + Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryError + 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. "error" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"error") 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. "span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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. "TOCSummaryError" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"error") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData TOCSummaryError where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_TOCSummaryError'_unknownFields x__) + (Control.DeepSeq.deepseq (_TOCSummaryError'error x__) + (Control.DeepSeq.deepseq (_TOCSummaryError'span x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' TOCSummaryFile Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' TOCSummaryFile Data.Text.Text@ + * 'Proto.Semantic_Fields.changes' @:: Lens' TOCSummaryFile [TOCSummaryChange]@ + * 'Proto.Semantic_Fields.vec'changes' @:: Lens' TOCSummaryFile (Data.Vector.Vector TOCSummaryChange)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' TOCSummaryFile [TOCSummaryError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' TOCSummaryFile (Data.Vector.Vector TOCSummaryError)@ + -} +data TOCSummaryFile = TOCSummaryFile{_TOCSummaryFile'path :: + !Data.Text.Text, + _TOCSummaryFile'language :: !Data.Text.Text, + _TOCSummaryFile'changes :: + !(Data.Vector.Vector TOCSummaryChange), + _TOCSummaryFile'errors :: + !(Data.Vector.Vector TOCSummaryError), + _TOCSummaryFile'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TOCSummaryFile where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TOCSummaryFile "path" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryFile'path + (\ x__ y__ -> x__{_TOCSummaryFile'path = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryFile "language" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryFile'language + (\ x__ y__ -> x__{_TOCSummaryFile'language = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryFile "changes" + ([TOCSummaryChange]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryFile'changes + (\ x__ y__ -> x__{_TOCSummaryFile'changes = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField TOCSummaryFile "vec'changes" + (Data.Vector.Vector TOCSummaryChange) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryFile'changes + (\ x__ y__ -> x__{_TOCSummaryFile'changes = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryFile "errors" + ([TOCSummaryError]) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryFile'errors + (\ x__ y__ -> x__{_TOCSummaryFile'errors = y__})) + Prelude.. + Lens.Family2.Unchecked.lens Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__) +instance Data.ProtoLens.Field.HasField TOCSummaryFile "vec'errors" + (Data.Vector.Vector TOCSummaryError) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TOCSummaryFile'errors + (\ x__ y__ -> x__{_TOCSummaryFile'errors = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message TOCSummaryFile where + messageName _ = Data.Text.pack "github.semantic.TOCSummaryFile" + fieldsByTag + = let path__field_descriptor + = Data.ProtoLens.FieldDescriptor "path" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"path")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryFile + language__field_descriptor + = Data.ProtoLens.FieldDescriptor "language" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"language")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryFile + changes__field_descriptor + = Data.ProtoLens.FieldDescriptor "changes" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TOCSummaryChange) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"changes")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryFile + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TOCSummaryError) + (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"errors")) + :: Data.ProtoLens.FieldDescriptor TOCSummaryFile + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, changes__field_descriptor), + (Data.ProtoLens.Tag 4, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _TOCSummaryFile'_unknownFields + (\ x__ y__ -> x__{_TOCSummaryFile'_unknownFields = y__}) + defMessage + = TOCSummaryFile{_TOCSummaryFile'path = + Data.ProtoLens.fieldDefault, + _TOCSummaryFile'language = Data.ProtoLens.fieldDefault, + _TOCSummaryFile'changes = Data.Vector.Generic.empty, + _TOCSummaryFile'errors = Data.Vector.Generic.empty, + _TOCSummaryFile'_unknownFields = ([])} + parseMessage + = let loop :: + TOCSummaryFile -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + TOCSummaryChange + -> + Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector + Data.ProtoLens.Encoding.Growing.RealWorld + TOCSummaryError + -> Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryFile + loop x mutable'changes mutable'errors + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'changes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'changes) + frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + 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'changes") + frozen'changes + (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + 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. "path" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y + x) + mutable'changes + mutable'errors + 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. "language" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"language") + y + x) + mutable'changes + mutable'errors + 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. "changes" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'changes + y) + loop x v mutable'errors + 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt + Data.ProtoLens.Encoding.Bytes.isolate + (Prelude.fromIntegral len) + Data.ProtoLens.parseMessage) + Data.ProtoLens.Encoding.Bytes. "errors" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append + mutable'errors + y) + loop x mutable'changes v + wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over Data.ProtoLens.unknownFields + (\ !t -> (:) y t) + x) + mutable'changes + mutable'errors + in + (do mutable'changes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'changes mutable'errors) + Data.ProtoLens.Encoding.Bytes. "TOCSummaryFile" + buildMessage + = (\ _x -> + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _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.<> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _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.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'changes") _x)) + Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.foldMapBuilder + (\ _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.ProtoLens.encodeMessage) + _v) + (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) + Data.Monoid.<> + Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)) +instance Control.DeepSeq.NFData TOCSummaryFile where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_TOCSummaryFile'_unknownFields x__) + (Control.DeepSeq.deepseq (_TOCSummaryFile'path x__) + (Control.DeepSeq.deepseq (_TOCSummaryFile'language x__) + (Control.DeepSeq.deepseq (_TOCSummaryFile'changes x__) + (Control.DeepSeq.deepseq (_TOCSummaryFile'errors x__) (())))))) +{- | Fields : + + * 'Proto.Semantic_Fields.source' @:: Lens' TermEdge Data.Int.Int32@ + * 'Proto.Semantic_Fields.target' @:: Lens' TermEdge Data.Int.Int32@ + -} +data TermEdge = TermEdge{_TermEdge'source :: !Data.Int.Int32, + _TermEdge'target :: !Data.Int.Int32, + _TermEdge'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TermEdge where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TermEdge "source" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TermEdge'source + (\ x__ y__ -> x__{_TermEdge'source = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TermEdge "target" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TermEdge'target + (\ x__ y__ -> x__{_TermEdge'target = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message TermEdge where + messageName _ = Data.Text.pack "github.semantic.TermEdge" + fieldsByTag + = let source__field_descriptor + = Data.ProtoLens.FieldDescriptor "source" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"source")) + :: Data.ProtoLens.FieldDescriptor TermEdge + target__field_descriptor + = Data.ProtoLens.FieldDescriptor "target" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"target")) + :: Data.ProtoLens.FieldDescriptor TermEdge + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, source__field_descriptor), + (Data.ProtoLens.Tag 2, target__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _TermEdge'_unknownFields + (\ x__ y__ -> x__{_TermEdge'_unknownFields = y__}) + defMessage + = TermEdge{_TermEdge'source = Data.ProtoLens.fieldDefault, + _TermEdge'target = Data.ProtoLens.fieldDefault, + _TermEdge'_unknownFields = ([])} + parseMessage + = let loop :: + TermEdge -> Data.ProtoLens.Encoding.Bytes.Parser TermEdge + 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. "source" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y + x) + 16 -> do y <- (Prelude.fmap Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + Data.ProtoLens.Encoding.Bytes. "target" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"target") + 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. "TermEdge" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _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 @"target") _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 TermEdge where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_TermEdge'_unknownFields x__) + (Control.DeepSeq.deepseq (_TermEdge'source x__) + (Control.DeepSeq.deepseq (_TermEdge'target x__) (())))) +{- | Fields : + + * 'Proto.Semantic_Fields.vertexId' @:: Lens' TermVertex Data.Int.Int32@ + * 'Proto.Semantic_Fields.term' @:: Lens' TermVertex Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' TermVertex Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TermVertex (Prelude.Maybe Span)@ + -} +data TermVertex = TermVertex{_TermVertex'vertexId :: + !Data.Int.Int32, + _TermVertex'term :: !Data.Text.Text, + _TermVertex'span :: !(Prelude.Maybe Span), + _TermVertex'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TermVertex where + showsPrec _ __x __s + = Prelude.showChar '{' + (Prelude.showString (Data.ProtoLens.showMessageShort __x) + (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TermVertex "vertexId" + (Data.Int.Int32) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TermVertex'vertexId + (\ x__ y__ -> x__{_TermVertex'vertexId = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TermVertex "term" + (Data.Text.Text) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TermVertex'term + (\ x__ y__ -> x__{_TermVertex'term = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Field.HasField TermVertex "span" (Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TermVertex'span + (\ x__ y__ -> x__{_TermVertex'span = y__})) + Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage +instance Data.ProtoLens.Field.HasField TermVertex "maybe'span" + (Prelude.Maybe Span) + where + fieldOf _ + = (Lens.Family2.Unchecked.lens _TermVertex'span + (\ x__ y__ -> x__{_TermVertex'span = y__})) + Prelude.. Prelude.id +instance Data.ProtoLens.Message TermVertex where + messageName _ = Data.Text.pack "github.semantic.TermVertex" + fieldsByTag + = let vertexId__field_descriptor + = Data.ProtoLens.FieldDescriptor "vertex_id" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"vertexId")) + :: Data.ProtoLens.FieldDescriptor TermVertex + 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 TermVertex + span__field_descriptor + = Data.ProtoLens.FieldDescriptor "span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'span")) + :: Data.ProtoLens.FieldDescriptor TermVertex + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, vertexId__field_descriptor), + (Data.ProtoLens.Tag 2, term__field_descriptor), + (Data.ProtoLens.Tag 3, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens _TermVertex'_unknownFields + (\ x__ y__ -> x__{_TermVertex'_unknownFields = y__}) + defMessage + = TermVertex{_TermVertex'vertexId = Data.ProtoLens.fieldDefault, + _TermVertex'term = Data.ProtoLens.fieldDefault, + _TermVertex'span = Prelude.Nothing, + _TermVertex'_unknownFields = ([])} + parseMessage + = let loop :: + TermVertex -> Data.ProtoLens.Encoding.Bytes.Parser TermVertex + 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. "vertex_id" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"vertexId") + 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. "term" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"term") 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. "span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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. "TermVertex" + buildMessage + = (\ _x -> + (let _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"vertexId") _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 @"term") _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.<> + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of + (Prelude.Nothing) -> Data.Monoid.mempty + Prelude.Just _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 TermVertex where + rnf + = (\ x__ -> + Control.DeepSeq.deepseq (_TermVertex'_unknownFields x__) + (Control.DeepSeq.deepseq (_TermVertex'vertexId x__) + (Control.DeepSeq.deepseq (_TermVertex'term x__) + (Control.DeepSeq.deepseq (_TermVertex'span x__) (()))))) \ No newline at end of file diff --git a/src/Proto/Semantic_Fields.hs b/src/Proto/Semantic_Fields.hs new file mode 100644 index 0000000000..bac7dd69c3 --- /dev/null +++ b/src/Proto/Semantic_Fields.hs @@ -0,0 +1,404 @@ +{- This file was auto-generated from semantic.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 -Wno-missing-export-lists #-} -- Manually added for semantic's project settings +{-# OPTIONS_GHC -fno-warn-duplicate-exports#-} +module Proto.Semantic_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 + +after :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "after" a) => + Lens.Family2.LensLike' f s a +after = Data.ProtoLens.Field.field @"after" +afterSpan :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "afterSpan" a) => + Lens.Family2.LensLike' f s a +afterSpan = Data.ProtoLens.Field.field @"afterSpan" +afterTerm :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "afterTerm" a) => + Lens.Family2.LensLike' f s a +afterTerm = Data.ProtoLens.Field.field @"afterTerm" +before :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "before" a) => + Lens.Family2.LensLike' f s a +before = Data.ProtoLens.Field.field @"before" +beforeSpan :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "beforeSpan" a) => + Lens.Family2.LensLike' f s a +beforeSpan = Data.ProtoLens.Field.field @"beforeSpan" +beforeTerm :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "beforeTerm" a) => + Lens.Family2.LensLike' f s a +beforeTerm = Data.ProtoLens.Field.field @"beforeTerm" +blobOid :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "blobOid" a) => + Lens.Family2.LensLike' f s a +blobOid = Data.ProtoLens.Field.field @"blobOid" +blobs :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "blobs" a) => + Lens.Family2.LensLike' f s a +blobs = Data.ProtoLens.Field.field @"blobs" +category :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "category" a) => + Lens.Family2.LensLike' f s a +category = Data.ProtoLens.Field.field @"category" +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" +changes :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "changes" a) => + Lens.Family2.LensLike' f s a +changes = Data.ProtoLens.Field.field @"changes" +column :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "column" a) => + Lens.Family2.LensLike' f s a +column = Data.ProtoLens.Field.field @"column" +content :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "content" a) => + Lens.Family2.LensLike' f s a +content = Data.ProtoLens.Field.field @"content" +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" +docs :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "docs" a) => + Lens.Family2.LensLike' f s a +docs = Data.ProtoLens.Field.field @"docs" +docstring :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "docstring" a) => + Lens.Family2.LensLike' f s a +docstring = Data.ProtoLens.Field.field @"docstring" +edges :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "edges" a) => + Lens.Family2.LensLike' f s a +edges = Data.ProtoLens.Field.field @"edges" +end :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "end" a) => + Lens.Family2.LensLike' f s a +end = Data.ProtoLens.Field.field @"end" +error :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "error" a) => + Lens.Family2.LensLike' f s a +error = Data.ProtoLens.Field.field @"error" +errors :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "errors" a) => + Lens.Family2.LensLike' f s a +errors = Data.ProtoLens.Field.field @"errors" +files :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "files" a) => + Lens.Family2.LensLike' f s a +files = Data.ProtoLens.Field.field @"files" +hostname :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "hostname" a) => + Lens.Family2.LensLike' f s a +hostname = Data.ProtoLens.Field.field @"hostname" +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" +kind :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "kind" a) => + Lens.Family2.LensLike' f s a +kind = Data.ProtoLens.Field.field @"kind" +language :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "language" a) => + Lens.Family2.LensLike' f s a +language = Data.ProtoLens.Field.field @"language" +line :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "line" a) => + Lens.Family2.LensLike' f s a +line = Data.ProtoLens.Field.field @"line" +maybe'after :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'after" a) => + Lens.Family2.LensLike' f s a +maybe'after = Data.ProtoLens.Field.field @"maybe'after" +maybe'afterSpan :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'afterSpan" a) => + Lens.Family2.LensLike' f s a +maybe'afterSpan = Data.ProtoLens.Field.field @"maybe'afterSpan" +maybe'before :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'before" a) => + Lens.Family2.LensLike' f s a +maybe'before = Data.ProtoLens.Field.field @"maybe'before" +maybe'beforeSpan :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'beforeSpan" a) => + Lens.Family2.LensLike' f s a +maybe'beforeSpan = Data.ProtoLens.Field.field @"maybe'beforeSpan" +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'docs :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'docs" a) => + Lens.Family2.LensLike' f s a +maybe'docs = Data.ProtoLens.Field.field @"maybe'docs" +maybe'end :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'end" a) => + Lens.Family2.LensLike' f s a +maybe'end = Data.ProtoLens.Field.field @"maybe'end" +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'merged :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'merged" a) => + Lens.Family2.LensLike' f s a +maybe'merged = Data.ProtoLens.Field.field @"maybe'merged" +maybe'replaced :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'replaced" a) => + Lens.Family2.LensLike' f s a +maybe'replaced = Data.ProtoLens.Field.field @"maybe'replaced" +maybe'span :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'span" a) => + Lens.Family2.LensLike' f s a +maybe'span = Data.ProtoLens.Field.field @"maybe'span" +maybe'start :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'start" a) => + Lens.Family2.LensLike' f s a +maybe'start = Data.ProtoLens.Field.field @"maybe'start" +merged :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "merged" a) => + Lens.Family2.LensLike' f s a +merged = Data.ProtoLens.Field.field @"merged" +path :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "path" a) => + Lens.Family2.LensLike' f s a +path = Data.ProtoLens.Field.field @"path" +replaced :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "replaced" a) => + Lens.Family2.LensLike' f s a +replaced = Data.ProtoLens.Field.field @"replaced" +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" +sha :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "sha" a) => + Lens.Family2.LensLike' f s a +sha = Data.ProtoLens.Field.field @"sha" +source :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "source" a) => + Lens.Family2.LensLike' f s a +source = Data.ProtoLens.Field.field @"source" +span :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "span" a) => + Lens.Family2.LensLike' f s a +span = Data.ProtoLens.Field.field @"span" +start :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "start" a) => + Lens.Family2.LensLike' f s a +start = Data.ProtoLens.Field.field @"start" +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" +symbol :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "symbol" a) => + Lens.Family2.LensLike' f s a +symbol = Data.ProtoLens.Field.field @"symbol" +symbols :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "symbols" a) => + Lens.Family2.LensLike' f s a +symbols = Data.ProtoLens.Field.field @"symbols" +target :: + forall f s a . + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "target" a) => + Lens.Family2.LensLike' f s a +target = Data.ProtoLens.Field.field @"target" +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" +timestamp :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "timestamp" a) => + Lens.Family2.LensLike' f s a +timestamp = Data.ProtoLens.Field.field @"timestamp" +vec'blobs :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'blobs" a) => + Lens.Family2.LensLike' f s a +vec'blobs = Data.ProtoLens.Field.field @"vec'blobs" +vec'changes :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'changes" a) => + Lens.Family2.LensLike' f s a +vec'changes = Data.ProtoLens.Field.field @"vec'changes" +vec'edges :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'edges" a) => + Lens.Family2.LensLike' f s a +vec'edges = Data.ProtoLens.Field.field @"vec'edges" +vec'errors :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'errors" a) => + Lens.Family2.LensLike' f s a +vec'errors = Data.ProtoLens.Field.field @"vec'errors" +vec'files :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'files" a) => + Lens.Family2.LensLike' f s a +vec'files = Data.ProtoLens.Field.field @"vec'files" +vec'symbols :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'symbols" a) => + Lens.Family2.LensLike' f s a +vec'symbols = Data.ProtoLens.Field.field @"vec'symbols" +vec'vertices :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'vertices" a) => + Lens.Family2.LensLike' f s a +vec'vertices = Data.ProtoLens.Field.field @"vec'vertices" +vertexId :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vertexId" a) => + Lens.Family2.LensLike' f s a +vertexId = Data.ProtoLens.Field.field @"vertexId" +vertices :: + forall f s a . + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vertices" a) => + Lens.Family2.LensLike' f s a +vertices = Data.ProtoLens.Field.field @"vertices" diff --git a/src/Proto/Semantic_JSON.hs b/src/Proto/Semantic_JSON.hs new file mode 100644 index 0000000000..dbad1fe80a --- /dev/null +++ b/src/Proto/Semantic_JSON.hs @@ -0,0 +1,842 @@ +-- 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.Semantic_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.Semantic as P +import Proto.Semantic_Fields as P + +instance FromJSONPB PingRequest where + parseJSONPB = withObject "PingRequest" $ \obj -> do + service' <- obj .: "service" + pure $ defMessage + & P.service .~ service' + +instance ToJSONPB PingRequest where + toJSONPB x = object + [ "service" .= (x^.service) + ] + toEncodingPB x = pairs + [ "service" .= (x^.service) + ] + +instance FromJSON PingRequest where + parseJSON = parseJSONPB + +instance ToJSON PingRequest where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB PingResponse where + parseJSONPB = withObject "PingResponse" $ \obj -> do + status' <- obj .: "status" + hostname' <- obj .: "hostname" + timestamp' <- obj .: "timestamp" + sha' <- obj .: "sha" + pure $ defMessage + & P.status .~ status' + & P.hostname .~ hostname' + & P.timestamp .~ timestamp' + & P.sha .~ sha' + +instance ToJSONPB PingResponse where + toJSONPB x = object + [ "status" .= (x^.status) + , "hostname" .= (x^.hostname) + , "timestamp" .= (x^.timestamp) + , "sha" .= (x^.sha) + ] + toEncodingPB x = pairs + [ "status" .= (x^.status) + , "hostname" .= (x^.hostname) + , "timestamp" .= (x^.timestamp) + , "sha" .= (x^.sha) + ] + +instance FromJSON PingResponse where + parseJSON = parseJSONPB + +instance ToJSON PingResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseTreeRequest where + parseJSONPB = withObject "ParseTreeRequest" $ \obj -> do + blobs' <- obj .: "blobs" + pure $ defMessage + & P.blobs .~ blobs' + +instance ToJSONPB ParseTreeRequest where + toJSONPB x = object + [ "blobs" .= (x^.blobs) + ] + toEncodingPB x = pairs + [ "blobs" .= (x^.blobs) + ] + +instance FromJSON ParseTreeRequest where + parseJSON = parseJSONPB + +instance ToJSON ParseTreeRequest where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseTreeSymbolResponse where + parseJSONPB = withObject "ParseTreeSymbolResponse" $ \obj -> do + files' <- obj .: "files" + pure $ defMessage + & P.files .~ files' + +instance ToJSONPB ParseTreeSymbolResponse where + toJSONPB x = object + [ "files" .= (x^.files) + ] + toEncodingPB x = pairs + [ "files" .= (x^.files) + ] + +instance FromJSON ParseTreeSymbolResponse where + parseJSON = parseJSONPB + +instance ToJSON ParseTreeSymbolResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseTreeGraphResponse where + parseJSONPB = withObject "ParseTreeGraphResponse" $ \obj -> do + files' <- obj .: "files" + pure $ defMessage + & P.files .~ files' + +instance ToJSONPB ParseTreeGraphResponse where + toJSONPB x = object + [ "files" .= (x^.files) + ] + toEncodingPB x = pairs + [ "files" .= (x^.files) + ] + +instance FromJSON ParseTreeGraphResponse where + parseJSON = parseJSONPB + +instance ToJSON ParseTreeGraphResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseTreeFileGraph where + parseJSONPB = withObject "ParseTreeFileGraph" $ \obj -> do + path' <- obj .: "path" + language' <- obj .: "language" + vertices' <- obj .: "vertices" + edges' <- obj .: "edges" + errors' <- obj .: "errors" + pure $ defMessage + & P.path .~ path' + & P.language .~ language' + & P.vertices .~ vertices' + & P.edges .~ edges' + & P.errors .~ errors' + +instance ToJSONPB ParseTreeFileGraph where + toJSONPB x = object + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "vertices" .= (x^.vertices) + , "edges" .= (x^.edges) + , "errors" .= (x^.errors) + ] + toEncodingPB x = pairs + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "vertices" .= (x^.vertices) + , "edges" .= (x^.edges) + , "errors" .= (x^.errors) + ] + +instance FromJSON ParseTreeFileGraph where + parseJSON = parseJSONPB + +instance ToJSON ParseTreeFileGraph where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB TermEdge where + parseJSONPB = withObject "TermEdge" $ \obj -> do + source' <- obj .: "source" + target' <- obj .: "target" + pure $ defMessage + & P.source .~ source' + & P.target .~ target' + +instance ToJSONPB TermEdge where + toJSONPB x = object + [ "source" .= (x^.source) + , "target" .= (x^.target) + ] + toEncodingPB x = pairs + [ "source" .= (x^.source) + , "target" .= (x^.target) + ] + +instance FromJSON TermEdge where + parseJSON = parseJSONPB + +instance ToJSON TermEdge where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB TermVertex where + parseJSONPB = withObject "TermVertex" $ \obj -> do + vertexId' <- obj .: "vertexId" + term' <- obj .: "term" + span' <- obj A..:? "span" + pure $ defMessage + & P.vertexId .~ vertexId' + & P.term .~ term' + & P.maybe'span .~ span' + +instance ToJSONPB TermVertex where + toJSONPB x = object + [ "vertexId" .= (x^.vertexId) + , "term" .= (x^.term) + , "span" .= (x^.maybe'span) + ] + toEncodingPB x = pairs + [ "vertexId" .= (x^.vertexId) + , "term" .= (x^.term) + , "span" .= (x^.maybe'span) + ] + +instance FromJSON TermVertex where + parseJSON = parseJSONPB + +instance ToJSON TermVertex where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ParseError where + parseJSONPB = withObject "ParseError" $ \obj -> do + error' <- obj .: "error" + pure $ defMessage + & P.error .~ error' + +instance ToJSONPB ParseError where + toJSONPB x = object + [ "error" .= (x^.error) + ] + toEncodingPB x = pairs + [ "error" .= (x^.error) + ] + +instance FromJSON ParseError where + parseJSON = parseJSONPB + +instance ToJSON ParseError where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB DiffTreeRequest where + parseJSONPB = withObject "DiffTreeRequest" $ \obj -> do + blobs' <- obj .: "blobs" + pure $ defMessage + & P.blobs .~ blobs' + +instance ToJSONPB DiffTreeRequest where + toJSONPB x = object + [ "blobs" .= (x^.blobs) + ] + toEncodingPB x = pairs + [ "blobs" .= (x^.blobs) + ] + +instance FromJSON DiffTreeRequest where + parseJSON = parseJSONPB + +instance ToJSON DiffTreeRequest where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB DiffTreeTOCResponse where + parseJSONPB = withObject "DiffTreeTOCResponse" $ \obj -> do + files' <- obj .: "files" + pure $ defMessage + & P.files .~ files' + +instance ToJSONPB DiffTreeTOCResponse where + toJSONPB x = object + [ "files" .= (x^.files) + ] + toEncodingPB x = pairs + [ "files" .= (x^.files) + ] + +instance FromJSON DiffTreeTOCResponse where + parseJSON = parseJSONPB + +instance ToJSON DiffTreeTOCResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB TOCSummaryFile where + parseJSONPB = withObject "TOCSummaryFile" $ \obj -> do + path' <- obj .: "path" + language' <- obj .: "language" + changes' <- obj .: "changes" + errors' <- obj .: "errors" + pure $ defMessage + & P.path .~ path' + & P.language .~ language' + & P.changes .~ changes' + & P.errors .~ errors' + +instance ToJSONPB TOCSummaryFile where + toJSONPB x = object + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "changes" .= (x^.changes) + , "errors" .= (x^.errors) + ] + toEncodingPB x = pairs + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "changes" .= (x^.changes) + , "errors" .= (x^.errors) + ] + +instance FromJSON TOCSummaryFile where + parseJSON = parseJSONPB + +instance ToJSON TOCSummaryFile where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB TOCSummaryChange where + parseJSONPB = withObject "TOCSummaryChange" $ \obj -> do + category' <- obj .: "category" + term' <- obj .: "term" + span' <- obj A..:? "span" + changeType' <- obj .: "changeType" + pure $ defMessage + & P.category .~ category' + & P.term .~ term' + & P.maybe'span .~ span' + & P.changeType .~ changeType' + +instance ToJSONPB TOCSummaryChange where + toJSONPB x = object + [ "category" .= (x^.category) + , "term" .= (x^.term) + , "span" .= (x^.maybe'span) + , "changeType" .= (x^.changeType) + ] + toEncodingPB x = pairs + [ "category" .= (x^.category) + , "term" .= (x^.term) + , "span" .= (x^.maybe'span) + , "changeType" .= (x^.changeType) + ] + +instance FromJSON TOCSummaryChange where + parseJSON = parseJSONPB + +instance ToJSON TOCSummaryChange where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB TOCSummaryError where + parseJSONPB = withObject "TOCSummaryError" $ \obj -> do + error' <- obj .: "error" + span' <- obj A..:? "span" + pure $ defMessage + & P.error .~ error' + & P.maybe'span .~ span' + +instance ToJSONPB TOCSummaryError where + toJSONPB x = object + [ "error" .= (x^.error) + , "span" .= (x^.maybe'span) + ] + toEncodingPB x = pairs + [ "error" .= (x^.error) + , "span" .= (x^.maybe'span) + ] + +instance FromJSON TOCSummaryError where + parseJSON = parseJSONPB + +instance ToJSON TOCSummaryError where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB DiffTreeGraphResponse where + parseJSONPB = withObject "DiffTreeGraphResponse" $ \obj -> do + files' <- obj .: "files" + pure $ defMessage + & P.files .~ files' + +instance ToJSONPB DiffTreeGraphResponse where + toJSONPB x = object + [ "files" .= (x^.files) + ] + toEncodingPB x = pairs + [ "files" .= (x^.files) + ] + +instance FromJSON DiffTreeGraphResponse where + parseJSON = parseJSONPB + +instance ToJSON DiffTreeGraphResponse where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB DiffTreeFileGraph where + parseJSONPB = withObject "DiffTreeFileGraph" $ \obj -> do + path' <- obj .: "path" + language' <- obj .: "language" + vertices' <- obj .: "vertices" + edges' <- obj .: "edges" + errors' <- obj .: "errors" + pure $ defMessage + & P.path .~ path' + & P.language .~ language' + & P.vertices .~ vertices' + & P.edges .~ edges' + & P.errors .~ errors' + +instance ToJSONPB DiffTreeFileGraph where + toJSONPB x = object + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "vertices" .= (x^.vertices) + , "edges" .= (x^.edges) + , "errors" .= (x^.errors) + ] + toEncodingPB x = pairs + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "vertices" .= (x^.vertices) + , "edges" .= (x^.edges) + , "errors" .= (x^.errors) + ] + +instance FromJSON DiffTreeFileGraph where + parseJSON = parseJSONPB + +instance ToJSON DiffTreeFileGraph where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB DiffTreeEdge where + parseJSONPB = withObject "DiffTreeEdge" $ \obj -> do + source' <- obj .: "source" + target' <- obj .: "target" + pure $ defMessage + & P.source .~ source' + & P.target .~ target' + +instance ToJSONPB DiffTreeEdge where + toJSONPB x = object + [ "source" .= (x^.source) + , "target" .= (x^.target) + ] + toEncodingPB x = pairs + [ "source" .= (x^.source) + , "target" .= (x^.target) + ] + +instance FromJSON DiffTreeEdge where + parseJSON = parseJSONPB + +instance ToJSON DiffTreeEdge 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" + , DiffTreeVertex'Replaced <$> parseField obj "replaced" + , DiffTreeVertex'Merged <$> parseField obj "merged" + ] + +instance ToJSONPB DiffTreeVertex'DiffTerm where + toJSONPB (DiffTreeVertex'Deleted x) = object [ "deleted" .= Just x ] + toJSONPB (DiffTreeVertex'Inserted x) = object [ "inserted" .= Just x ] + toJSONPB (DiffTreeVertex'Replaced x) = object [ "replaced" .= Just x ] + toJSONPB (DiffTreeVertex'Merged x) = object [ "merged" .= Just x ] + toEncodingPB (DiffTreeVertex'Deleted x) = pairs [ "deleted" .= Just x ] + toEncodingPB (DiffTreeVertex'Inserted x) = pairs [ "inserted" .= Just x ] + toEncodingPB (DiffTreeVertex'Replaced x) = pairs [ "replaced" .= Just x ] + toEncodingPB (DiffTreeVertex'Merged x) = pairs [ "merged" .= 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" + span' <- obj A..:? "span" + pure $ defMessage + & P.term .~ term' + & P.maybe'span .~ span' + +instance ToJSONPB DeletedTerm where + toJSONPB x = object + [ "term" .= (x^.term) + , "span" .= (x^.maybe'span) + ] + toEncodingPB x = pairs + [ "term" .= (x^.term) + , "span" .= (x^.maybe'span) + ] + +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" + span' <- obj A..:? "span" + pure $ defMessage + & P.term .~ term' + & P.maybe'span .~ span' + +instance ToJSONPB InsertedTerm where + toJSONPB x = object + [ "term" .= (x^.term) + , "span" .= (x^.maybe'span) + ] + toEncodingPB x = pairs + [ "term" .= (x^.term) + , "span" .= (x^.maybe'span) + ] + +instance FromJSON InsertedTerm where + parseJSON = parseJSONPB + +instance ToJSON InsertedTerm where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ReplacedTerm where + parseJSONPB = withObject "ReplacedTerm" $ \obj -> do + beforeTerm' <- obj .: "beforeTerm" + beforeSpan' <- obj A..:? "beforeSpan" + afterTerm' <- obj .: "afterTerm" + afterSpan' <- obj A..:? "afterSpan" + pure $ defMessage + & P.beforeTerm .~ beforeTerm' + & P.maybe'beforeSpan .~ beforeSpan' + & P.afterTerm .~ afterTerm' + & P.maybe'afterSpan .~ afterSpan' + +instance ToJSONPB ReplacedTerm where + toJSONPB x = object + [ "beforeTerm" .= (x^.beforeTerm) + , "beforeSpan" .= (x^.maybe'beforeSpan) + , "afterTerm" .= (x^.afterTerm) + , "afterSpan" .= (x^.maybe'afterSpan) + ] + toEncodingPB x = pairs + [ "beforeTerm" .= (x^.beforeTerm) + , "beforeSpan" .= (x^.maybe'beforeSpan) + , "afterTerm" .= (x^.afterTerm) + , "afterSpan" .= (x^.maybe'afterSpan) + ] + +instance FromJSON ReplacedTerm where + parseJSON = parseJSONPB + +instance ToJSON ReplacedTerm where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB MergedTerm where + parseJSONPB = withObject "MergedTerm" $ \obj -> do + term' <- obj .: "term" + beforeSpan' <- obj A..:? "beforeSpan" + afterSpan' <- obj A..:? "afterSpan" + pure $ defMessage + & P.term .~ term' + & P.maybe'beforeSpan .~ beforeSpan' + & P.maybe'afterSpan .~ afterSpan' + +instance ToJSONPB MergedTerm where + toJSONPB x = object + [ "term" .= (x^.term) + , "beforeSpan" .= (x^.maybe'beforeSpan) + , "afterSpan" .= (x^.maybe'afterSpan) + ] + toEncodingPB x = pairs + [ "term" .= (x^.term) + , "beforeSpan" .= (x^.maybe'beforeSpan) + , "afterSpan" .= (x^.maybe'afterSpan) + ] + +instance FromJSON MergedTerm where + parseJSON = parseJSONPB + +instance ToJSON MergedTerm where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Blob where + parseJSONPB = withObject "Blob" $ \obj -> do + content' <- obj .: "content" + path' <- obj .: "path" + language' <- obj .: "language" + pure $ defMessage + & P.content .~ content' + & P.path .~ path' + & P.language .~ language' + +instance ToJSONPB Blob where + toJSONPB x = object + [ "content" .= (x^.content) + , "path" .= (x^.path) + , "language" .= (x^.language) + ] + toEncodingPB x = pairs + [ "content" .= (x^.content) + , "path" .= (x^.path) + , "language" .= (x^.language) + ] + +instance FromJSON Blob where + parseJSON = parseJSONPB + +instance ToJSON Blob where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB BlobPair where + parseJSONPB = withObject "BlobPair" $ \obj -> do + before' <- obj A..:? "before" + after' <- obj A..:? "after" + pure $ defMessage + & P.maybe'before .~ before' + & P.maybe'after .~ after' + +instance ToJSONPB BlobPair where + toJSONPB x = object + [ "before" .= (x^.maybe'before) + , "after" .= (x^.maybe'after) + ] + toEncodingPB x = pairs + [ "before" .= (x^.maybe'before) + , "after" .= (x^.maybe'after) + ] + +instance FromJSON BlobPair where + parseJSON = parseJSONPB + +instance ToJSON BlobPair where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB File where + parseJSONPB = withObject "File" $ \obj -> do + path' <- obj .: "path" + language' <- obj .: "language" + symbols' <- obj .: "symbols" + errors' <- obj .: "errors" + blobOid' <- obj .: "blobOid" + pure $ defMessage + & P.path .~ path' + & P.language .~ language' + & P.symbols .~ symbols' + & P.errors .~ errors' + & P.blobOid .~ blobOid' + +instance ToJSONPB File where + toJSONPB x = object + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "symbols" .= (x^.symbols) + , "errors" .= (x^.errors) + , "blobOid" .= (x^.blobOid) + ] + toEncodingPB x = pairs + [ "path" .= (x^.path) + , "language" .= (x^.language) + , "symbols" .= (x^.symbols) + , "errors" .= (x^.errors) + , "blobOid" .= (x^.blobOid) + ] + +instance FromJSON File where + parseJSON = parseJSONPB + +instance ToJSON File where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Symbol where + parseJSONPB = withObject "Symbol" $ \obj -> do + symbol' <- obj .: "symbol" + kind' <- obj .: "kind" + line' <- obj .: "line" + span' <- obj A..:? "span" + docs' <- obj A..:? "docs" + pure $ defMessage + & P.symbol .~ symbol' + & P.kind .~ kind' + & P.line .~ line' + & P.maybe'span .~ span' + & P.maybe'docs .~ docs' + +instance ToJSONPB Symbol where + toJSONPB x = object + [ "symbol" .= (x^.symbol) + , "kind" .= (x^.kind) + , "line" .= (x^.line) + , "span" .= (x^.maybe'span) + , "docs" .= (x^.maybe'docs) + ] + toEncodingPB x = pairs + [ "symbol" .= (x^.symbol) + , "kind" .= (x^.kind) + , "line" .= (x^.line) + , "span" .= (x^.maybe'span) + , "docs" .= (x^.maybe'docs) + ] + +instance FromJSON Symbol where + parseJSON = parseJSONPB + +instance ToJSON Symbol where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Docstring where + parseJSONPB = withObject "Docstring" $ \obj -> do + docstring' <- obj .: "docstring" + pure $ defMessage + & P.docstring .~ docstring' + +instance ToJSONPB Docstring where + toJSONPB x = object + [ "docstring" .= (x^.docstring) + ] + toEncodingPB x = pairs + [ "docstring" .= (x^.docstring) + ] + +instance FromJSON Docstring where + parseJSON = parseJSONPB + +instance ToJSON Docstring where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Position where + parseJSONPB = withObject "Position" $ \obj -> do + line' <- obj .: "line" + column' <- obj .: "column" + pure $ defMessage + & P.line .~ line' + & P.column .~ column' + +instance ToJSONPB Position where + toJSONPB x = object + [ "line" .= (x^.line) + , "column" .= (x^.column) + ] + toEncodingPB x = pairs + [ "line" .= (x^.line) + , "column" .= (x^.column) + ] + +instance FromJSON Position where + parseJSON = parseJSONPB + +instance ToJSON Position where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB Span where + parseJSONPB = withObject "Span" $ \obj -> do + start' <- obj A..:? "start" + end' <- obj A..:? "end" + pure $ defMessage + & P.maybe'start .~ start' + & P.maybe'end .~ end' + +instance ToJSONPB Span where + toJSONPB x = object + [ "start" .= (x^.maybe'start) + , "end" .= (x^.maybe'end) + ] + toEncodingPB x = pairs + [ "start" .= (x^.maybe'start) + , "end" .= (x^.maybe'end) + ] + +instance FromJSON Span where + parseJSON = parseJSONPB + +instance ToJSON Span where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB ChangeType where + parseJSONPB (JSONPB.String "NONE") = pure NONE + parseJSONPB (JSONPB.String "ADDED") = pure ADDED + parseJSONPB (JSONPB.String "REMOVED") = pure REMOVED + parseJSONPB (JSONPB.String "MODIFIED") = pure MODIFIED + 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 diff --git a/src/Rendering/Graph.hs b/src/Rendering/Graph.hs index e151edb6a4..4c92153185 100644 --- a/src/Rendering/Graph.hs +++ b/src/Rendering/Graph.hs @@ -12,14 +12,17 @@ import Control.Effect.Fresh import Control.Effect.Pure import Control.Effect.Reader import Control.Effect.State +import Control.Lens import Data.Diff import Data.Graph import Data.Patch +import Data.ProtoLens (defMessage) import Data.String (IsString (..)) import Data.Term import Prologue import Semantic.Api.Bridge -import Semantic.Proto.SemanticPB +import Proto.Semantic as P +import Proto.Semantic_Fields as P import Source.Loc as Loc import qualified Data.Text as T @@ -39,23 +42,24 @@ runGraph = run . runFresh' . runReader mempty -- | GraphViz styling for terms termStyle :: (IsString string, Monoid string) => String -> Style TermVertex string -termStyle name = (defaultStyle (fromString . show . vertexId)) +termStyle name = (defaultStyle (fromString . show . view vertexId)) { graphName = fromString (quote name) , vertexAttributes = vertexAttributes } where quote a = "\"" <> a <> "\"" - vertexAttributes TermVertex{..} = ["label" := fromString name] + vertexAttributes v = ["label" := fromString (T.unpack (v^.term))] -- | Graphviz styling for diffs diffStyle :: (IsString string, Monoid string) => String -> Style DiffTreeVertex string -diffStyle name = (defaultStyle (fromString . show . diffVertexId)) +diffStyle name = (defaultStyle (fromString . show . view diffVertexId)) { graphName = fromString (quote name) , vertexAttributes = vertexAttributes } where quote a = "\"" <> a <> "\"" - vertexAttributes (DiffTreeVertex _ (Just (Deleted (Just DeletedTerm{..})))) = [ "label" := fromString (T.unpack term), "color" := "red" ] - vertexAttributes (DiffTreeVertex _ (Just (Inserted (Just InsertedTerm{..})))) = [ "label" := fromString (T.unpack term), "color" := "green" ] - vertexAttributes (DiffTreeVertex _ (Just (Replaced (Just ReplacedTerm{..})))) = [ "label" := "Replacement", "color" := "orange", "style" := "dashed" ] - vertexAttributes (DiffTreeVertex _ (Just (Merged (Just MergedTerm{..})))) = [ "label" := fromString (T.unpack term) ] - vertexAttributes _ = [] + vertexAttributes v = case v^.maybe'diffTerm of + Just (DiffTreeVertex'Deleted x) -> [ "label" := fromString (T.unpack (x^.term)), "color" := "red" ] + Just (DiffTreeVertex'Inserted x) -> [ "label" := fromString (T.unpack (x^.term)), "color" := "green" ] + Just (DiffTreeVertex'Replaced _) -> [ "label" := "Replacement", "color" := "orange", "style" := "dashed" ] + Just (DiffTreeVertex'Merged x) -> [ "label" := fromString (T.unpack (x^.term)) ] + _ -> [] class ToTreeGraph vertex t | t -> vertex where toTreeGraph :: (Member Fresh sig, Member (Reader (Graph vertex)) sig, Carrier sig m) => t (m (Graph vertex)) -> m (Graph vertex) @@ -75,23 +79,39 @@ instance (ConstructorName syntax, Foldable syntax) => termAlgebra (In ann syntax) = do i <- fresh parent <- ask - let root = vertex $ TermVertex (fromIntegral i) (T.pack (constructorName syntax)) (converting #? Loc.span ann) + let root = vertex $ defMessage + & P.vertexId .~ fromIntegral i + & P.term .~ T.pack (constructorName syntax) + & P.maybe'span .~ (converting #? Loc.span ann) subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax pure (parent `connect` root `overlay` subGraph) instance (ConstructorName syntax, Foldable syntax) => ToTreeGraph DiffTreeVertex (DiffF syntax Loc Loc) where toTreeGraph d = case d of - Merge t@(In (a1, a2) syntax) -> diffAlgebra t (Merged (Just (MergedTerm (T.pack (constructorName syntax)) (ann a1) (ann a2)))) - Patch (Delete t1@(In a1 syntax)) -> diffAlgebra t1 (Deleted (Just (DeletedTerm (T.pack (constructorName syntax)) (ann a1)))) - Patch (Insert t2@(In a2 syntax)) -> diffAlgebra t2 (Inserted (Just (InsertedTerm (T.pack (constructorName syntax)) (ann a2)))) + Merge t@(In (a1, a2) syntax) -> diffAlgebra t . DiffTreeVertex'Merged $ defMessage + & P.term .~ T.pack (constructorName syntax) + & P.maybe'beforeSpan .~ ann a1 + & P.maybe'afterSpan .~ ann a2 + Patch (Delete t1@(In a1 syntax)) -> diffAlgebra t1 . DiffTreeVertex'Deleted $ defMessage + & P.term .~ T.pack (constructorName syntax) + & P.maybe'span .~ ann a1 + Patch (Insert t2@(In a2 syntax)) -> diffAlgebra t2 . DiffTreeVertex'Inserted $ defMessage + & P.term .~ T.pack (constructorName syntax) + & P.maybe'span .~ ann a2 Patch (Replace t1@(In a1 syntax1) t2@(In a2 syntax2)) -> do i <- fresh parent <- ask let (beforeName, beforeSpan) = (T.pack (constructorName syntax1), ann a1) let (afterName, afterSpan) = (T.pack (constructorName syntax2), ann a2) - let replace = vertex (DiffTreeVertex (fromIntegral i) (Just (Replaced (Just (ReplacedTerm beforeName beforeSpan afterName afterSpan))))) - graph <- local (const replace) (overlay <$> diffAlgebra t1 (Deleted (Just (DeletedTerm beforeName beforeSpan))) <*> diffAlgebra t2 (Inserted (Just (InsertedTerm afterName afterSpan)))) + let replace = vertex $ defMessage + & P.diffVertexId .~ fromIntegral i + & P.maybe'replaced ?~ (defMessage + & P.beforeTerm .~ beforeName + & P.maybe'beforeSpan .~ beforeSpan + & P.afterTerm .~ afterName + & P.maybe'afterSpan .~ afterSpan) + graph <- local (const replace) (overlay <$> diffAlgebra t1 (DiffTreeVertex'Deleted (defMessage & P.term .~ beforeName & P.maybe'span .~ beforeSpan)) <*> diffAlgebra t2 (DiffTreeVertex'Inserted (defMessage & P.term .~ afterName & P.maybe'span .~ afterSpan))) pure (parent `connect` replace `overlay` graph) where ann a = converting #? Loc.span a @@ -100,10 +120,12 @@ instance (ConstructorName syntax, Foldable syntax) => , Member Fresh sig , Member (Reader (Graph DiffTreeVertex)) sig , Carrier sig m - ) => f (m (Graph DiffTreeVertex)) -> DiffTreeVertexDiffTerm -> m (Graph DiffTreeVertex) + ) => f (m (Graph DiffTreeVertex)) -> DiffTreeVertex'DiffTerm -> m (Graph DiffTreeVertex) diffAlgebra syntax a = do i <- fresh parent <- ask - let root = vertex (DiffTreeVertex (fromIntegral i) (Just a)) + let root = vertex $ defMessage + & P.diffVertexId .~ fromIntegral i + & P.maybe'diffTerm ?~ a subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax pure (parent `connect` root `overlay` subGraph) diff --git a/src/Semantic/Api.hs b/src/Semantic/Api.hs index cbdd2432f9..546dcc92e0 100644 --- a/src/Semantic/Api.hs +++ b/src/Semantic/Api.hs @@ -11,4 +11,4 @@ import Semantic.Api.Diffs as DiffsAPI import Semantic.Api.Symbols as SymbolsAPI import Semantic.Api.Terms as TermsAPI import Semantic.Api.TOCSummaries as TOCSummariesAPI -import Semantic.Proto.SemanticPB as Types +import Proto.Semantic as Types diff --git a/src/Semantic/Api/Bridge.hs b/src/Semantic/Api/Bridge.hs index 4ec705d9b1..dee30b8ea7 100644 --- a/src/Semantic/Api/Bridge.hs +++ b/src/Semantic/Api/Bridge.hs @@ -8,9 +8,11 @@ module Semantic.Api.Bridge import Control.Lens import qualified Data.Blob as Data import qualified Data.Language as Data +import Data.ProtoLens (defMessage) import qualified Data.Text as T import qualified Semantic.Api.LegacyTypes as Legacy -import qualified Semantic.Proto.SemanticPB as API +import qualified Proto.Semantic as API +import Proto.Semantic_Fields as P import Source.Source (fromText, toText) import qualified Source.Span as Source @@ -50,13 +52,13 @@ instance APIBridge Legacy.Position Source.Pos where instance APIBridge API.Position Source.Pos where bridging = iso fromAPI toAPI where - toAPI Source.Pos{..} = API.Position (fromIntegral line) (fromIntegral column) - fromAPI API.Position{..} = Source.Pos (fromIntegral line) (fromIntegral column) + toAPI Source.Pos{..} = defMessage & P.line .~ fromIntegral line & P.column .~ fromIntegral column + fromAPI position = Source.Pos (fromIntegral (position^.line)) (fromIntegral (position^.column)) instance APIConvert API.Span Source.Span where converting = prism' toAPI fromAPI where - toAPI Source.Span{..} = API.Span (bridging #? start) (bridging #? end) - fromAPI API.Span{..} = Source.Span <$> (start >>= preview bridging) <*> (end >>= preview bridging) + toAPI Source.Span{..} = defMessage & P.maybe'start .~ (bridging #? start) & P.maybe'end .~ (bridging #? end) + fromAPI span = Source.Span <$> (span^.maybe'start >>= preview bridging) <*> (span^.maybe'end >>= preview bridging) instance APIConvert Legacy.Span Source.Span where converting = prism' toAPI fromAPI where @@ -68,18 +70,19 @@ instance APIBridge T.Text Data.Language where instance APIBridge API.Blob Data.Blob where bridging = iso apiBlobToBlob blobToApiBlob where - blobToApiBlob b = API.Blob (toText (Data.blobSource b)) (T.pack (Data.blobPath b)) (bridging # Data.blobLanguage b) - apiBlobToBlob API.Blob{..} = Data.makeBlob (fromText content) (T.unpack path) (language ^. bridging) mempty + blobToApiBlob b = defMessage & P.content .~ toText (Data.blobSource b) & P.path .~ T.pack (Data.blobPath b) & P.language .~ (bridging # Data.blobLanguage b) + apiBlobToBlob blob = Data.makeBlob (fromText (blob^.content)) (T.unpack (blob^.path)) (blob^.(language . bridging)) mempty instance APIConvert API.BlobPair Data.BlobPair where converting = prism' blobPairToApiBlobPair apiBlobPairToBlobPair where - apiBlobPairToBlobPair (API.BlobPair (Just before) (Just after)) = Just $ Data.Diffing (before^.bridging) (after^.bridging) - apiBlobPairToBlobPair (API.BlobPair (Just before) Nothing) = Just $ Data.Deleting (before^.bridging) - apiBlobPairToBlobPair (API.BlobPair Nothing (Just after)) = Just $ Data.Inserting (after^.bridging) - apiBlobPairToBlobPair _ = Nothing + apiBlobPairToBlobPair blobPair = case (blobPair^.maybe'before, blobPair^.maybe'after) of + (Just before, Just after) -> Just $ Data.Diffing (before^.bridging) (after^.bridging) + (Just before, Nothing) -> Just $ Data.Deleting (before^.bridging) + (Nothing, Just after) -> Just $ Data.Inserting (after^.bridging) + _ -> Nothing - blobPairToApiBlobPair (Data.Diffing before after) = API.BlobPair (bridging #? before) (bridging #? after) - blobPairToApiBlobPair (Data.Inserting after) = API.BlobPair Nothing (bridging #? after) - blobPairToApiBlobPair (Data.Deleting before) = API.BlobPair (bridging #? before) Nothing + blobPairToApiBlobPair (Data.Diffing before after) = defMessage & P.maybe'before .~ (bridging #? before) & P.maybe'after .~ (bridging #? after) + blobPairToApiBlobPair (Data.Inserting after) = defMessage & P.maybe'before .~ Nothing & P.maybe'after .~ (bridging #? after) + blobPairToApiBlobPair (Data.Deleting before) = defMessage & P.maybe'before .~ (bridging #? before) & P.maybe'after .~ Nothing diff --git a/src/Semantic/Api/Diffs.hs b/src/Semantic/Api/Diffs.hs index 3b856e8760..d7602ca861 100644 --- a/src/Semantic/Api/Diffs.hs +++ b/src/Semantic/Api/Diffs.hs @@ -27,20 +27,22 @@ import Data.ByteString.Builder import Data.Graph import Data.JSON.Fields import Data.Language +import Data.ProtoLens (defMessage) import Data.Term import qualified Data.Text as T -import qualified Data.Vector as V import Diffing.Algorithm (Diffable) import Diffing.Interpreter (DiffTerms(..)) import Parsing.Parser import Prologue +import Proto.Semantic as P hiding (Blob, BlobPair) +import Proto.Semantic_Fields as P +import Proto.Semantic_JSON() import Rendering.Graph import Rendering.JSON hiding (JSON) import qualified Rendering.JSON import Rendering.TOC import Semantic.Api.Bridge import Semantic.Config -import Semantic.Proto.SemanticPB hiding (Blob, BlobPair) import Semantic.Task as Task import Semantic.Telemetry as Stat import Serializing.Format hiding (JSON) @@ -69,12 +71,19 @@ jsonError :: Applicative m => BlobPair -> SomeException -> m (Rendering.JSON.JSO jsonError blobPair (SomeException e) = pure $ renderJSONDiffError blobPair (show e) diffGraph :: (Traversable t, DiffEffects sig m) => t BlobPair -> m DiffTreeGraphResponse -diffGraph blobs = DiffTreeGraphResponse . V.fromList . toList <$> distributeFor blobs go +diffGraph blobs = do + graph <- distributeFor blobs go + pure $ defMessage & P.files .~ toList graph where go :: DiffEffects sig m => BlobPair -> m DiffTreeFileGraph go blobPair = diffWith jsonGraphDiffParsers (pure . jsonGraphDiff blobPair) blobPair `catchError` \(SomeException e) -> - pure (DiffTreeFileGraph path lang mempty mempty (V.fromList [ParseError (T.pack (show e))])) + pure $ defMessage + & P.path .~ path + & P.language .~ lang + & P.vertices .~ mempty + & P.edges .~ mempty + & P.errors .~ [defMessage & P.error .~ T.pack (show e)] where path = T.pack $ pathForBlobPair blobPair lang = bridging # languageForBlobPair blobPair @@ -101,10 +110,15 @@ class DiffTerms term => JSONGraphDiff term where instance (ConstructorName syntax, Diffable syntax, Eq1 syntax, Hashable1 syntax, Traversable syntax) => JSONGraphDiff (Term syntax) where jsonGraphDiff blobPair diff = let graph = renderTreeGraph diff - toEdge (Edge (a, b)) = DiffTreeEdge (diffVertexId a) (diffVertexId b) - in DiffTreeFileGraph path lang (V.fromList (vertexList graph)) (V.fromList (fmap toEdge (edgeList graph))) mempty where - path = T.pack $ pathForBlobPair blobPair - lang = bridging # languageForBlobPair blobPair + toEdge (Edge (a, b)) = defMessage & P.source .~ a^.diffVertexId & P.target .~ b^.diffVertexId + path = T.pack $ pathForBlobPair blobPair + lang = bridging # languageForBlobPair blobPair + in defMessage + & P.path .~ path + & P.language .~ lang + & P.vertices .~ vertexList graph + & P.edges .~ fmap toEdge (edgeList graph) + & P.errors .~ mempty jsonTreeDiffParsers :: Map Language (SomeParser JSONTreeDiff Loc) @@ -158,22 +172,29 @@ class DiffTerms term => SummarizeDiff term where instance (Diffable syntax, Eq1 syntax, HasDeclaration syntax, Hashable1 syntax, Traversable syntax) => SummarizeDiff (Term syntax) where decorateTerm = decoratorWithAlgebra . declarationAlgebra - summarizeDiff blobPair diff = foldr go (TOCSummaryFile path lang mempty mempty) (diffTOC diff) + summarizeDiff blobPair diff = foldr go (defMessage & P.path .~ path & P.language .~ lang) (diffTOC diff) where path = T.pack $ pathKeyForBlobPair blobPair lang = bridging # languageForBlobPair blobPair toChangeType = \case - "added" -> Added - "modified" -> Modified - "removed" -> Removed - _ -> None + "added" -> ADDED + "modified" -> MODIFIED + "removed" -> REMOVED + _ -> NONE go :: TOCSummary -> TOCSummaryFile -> TOCSummaryFile - go TOCSummary{..} TOCSummaryFile{..} - = TOCSummaryFile path language (V.cons (TOCSummaryChange summaryCategoryName summaryTermName (converting #? summarySpan) (toChangeType summaryChangeType)) changes) errors - go ErrorSummary{..} TOCSummaryFile{..} - = TOCSummaryFile path language changes (V.cons (TOCSummaryError errorText (converting #? errorSpan)) errors) + go TOCSummary{..} file = defMessage + & P.path .~ file^.P.path + & P.language .~ file^.P.language + & P.changes .~ (defMessage & P.category .~ summaryCategoryName & P.term .~ summaryTermName & P.maybe'span .~ (converting #? summarySpan) & P.changeType .~ toChangeType summaryChangeType) : file^.P.changes + & P.errors .~ file^.P.errors + + go ErrorSummary{..} file = defMessage + & P.path .~ file^.P.path + & P.language .~ file^.P.language + & P.changes .~ file^.P.changes + & P.errors .~ (defMessage & P.error .~ errorText & P.maybe'span .~ converting #? errorSpan) : file^.P.errors -- | Parse a 'BlobPair' using one of the provided parsers, diff the resulting terms, and run an action on the abstracted diff. diff --git a/src/Semantic/Api/Symbols.hs b/src/Semantic/Api/Symbols.hs index 40ae1ec1bd..e8c36e3fc2 100644 --- a/src/Semantic/Api/Symbols.hs +++ b/src/Semantic/Api/Symbols.hs @@ -13,16 +13,18 @@ import Control.Lens import Data.Blob hiding (File (..)) import Data.ByteString.Builder import Data.Language +import Data.ProtoLens (defMessage) import Data.Term -import qualified Data.Text as T -import qualified Data.Vector as V import Data.Text (pack) +import qualified Data.Text as T import qualified Language.Python as Python import qualified Parsing.Parser as Parser import Prologue +import Proto.Semantic as P hiding (Blob, BlobPair) +import Proto.Semantic_Fields as P +import Proto.Semantic_JSON () import Semantic.Api.Bridge import qualified Semantic.Api.LegacyTypes as Legacy -import Semantic.Proto.SemanticPB hiding (Blob) import Semantic.Config import Semantic.Task import Serializing.Format (Format) @@ -63,7 +65,9 @@ parseSymbolsBuilder :: (Member Distribute sig, Member (Error SomeException) sig, parseSymbolsBuilder format blobs = parseSymbols blobs >>= serialize format parseSymbols :: (Member Distribute sig, Member (Error SomeException) sig, Member (Reader PerLanguageModes) sig, Member Parse sig, Carrier sig m, Traversable t) => t Blob -> m ParseTreeSymbolResponse -parseSymbols blobs = ParseTreeSymbolResponse . V.fromList . toList <$> distributeFor blobs go +parseSymbols blobs = do + terms <- distributeFor blobs go + pure $ defMessage & P.files .~ toList terms where go :: (Member (Error SomeException) sig, Member (Reader PerLanguageModes) sig, Member Parse sig, Carrier sig m) => Blob -> m File go blob@Blob{..} = catching $ asks toTagsParsers >>= \ p -> parseWith p (pure . renderToSymbols) blob @@ -71,27 +75,35 @@ parseSymbols blobs = ParseTreeSymbolResponse . V.fromList . toList <$> distribut catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e)) blobLanguage' = blobLanguage blob blobPath' = pack $ blobPath blob - errorFile e = File blobPath' (bridging # blobLanguage') mempty (V.fromList [ParseError (T.pack e)]) blobOid + errorFile e = defMessage + & P.path .~ blobPath' + & P.language .~ (bridging # blobLanguage') + & P.symbols .~ mempty + & P.errors .~ [defMessage & P.error .~ T.pack e] + & P.blobOid .~ blobOid renderToSymbols :: ToTags t => t Loc -> File renderToSymbols term = tagsToFile (tags (blobLanguage blob) symbolsToSummarize blobSource term) tagsToFile :: [Tag] -> File - tagsToFile tags = File blobPath' (bridging # blobLanguage') (V.fromList (fmap tagToSymbol tags)) mempty blobOid + tagsToFile tags = defMessage + & P.path .~ blobPath' + & P.language .~ (bridging # blobLanguage') + & P.symbols .~ fmap tagToSymbol tags + & P.errors .~ mempty + & P.blobOid .~ blobOid + + tagToSymbol :: Tag -> Symbol + tagToSymbol Tag{..} = defMessage + & P.symbol .~ name + & P.kind .~ pack (show kind) + & P.line .~ line + & P.maybe'span .~ converting #? span + & P.maybe'docs .~ fmap (flip (set P.docstring) defMessage) docs symbolsToSummarize :: [Text] symbolsToSummarize = ["Function", "Method", "Class", "Module", "Call", "Send"] -tagToSymbol :: Tag -> Symbol -tagToSymbol Tag{..} = Symbol - { symbol = name - , kind = pack (show kind) - , line = line - , span = converting #? span - , docs = fmap Docstring docs - } - - class ToTags t where tags :: Language -> [Text] -> Source -> t Loc -> [Tag] diff --git a/src/Semantic/Api/TOCSummaries.hs b/src/Semantic/Api/TOCSummaries.hs index b56330767d..5f71596cee 100644 --- a/src/Semantic/Api/TOCSummaries.hs +++ b/src/Semantic/Api/TOCSummaries.hs @@ -6,13 +6,14 @@ import Data.Aeson import Data.Blob import Data.ByteString.Builder import qualified Data.Map.Monoidal as Map -import qualified Data.Text as T -import qualified Data.Vector as V +import Data.ProtoLens (defMessage) import Data.Semilattice.Lower +import qualified Data.Text as T +import Proto.Semantic as P hiding (Blob, BlobPair) +import Proto.Semantic_Fields as P import Rendering.TOC -import Semantic.Api.Diffs import Semantic.Api.Bridge -import Semantic.Proto.SemanticPB hiding (Blob, BlobPair) +import Semantic.Api.Diffs import Semantic.Task as Task import Serializing.Format @@ -31,11 +32,17 @@ legacyDiffSummary = distributeFoldMap go diffSummary :: DiffEffects sig m => [BlobPair] -> m DiffTreeTOCResponse -diffSummary blobs = DiffTreeTOCResponse . V.fromList <$> distributeFor blobs go +diffSummary blobs = do + diff <- distributeFor blobs go + pure $ defMessage & P.files .~ diff where go :: DiffEffects sig m => BlobPair -> m TOCSummaryFile go blobPair = decoratingDiffWith summarizeDiffParsers decorateTerm (pure . summarizeDiff blobPair) blobPair `catchError` \(SomeException e) -> - pure $ TOCSummaryFile path lang mempty (V.fromList [TOCSummaryError (T.pack (show e)) Nothing]) + pure $ defMessage + & P.path .~ path + & P.language .~ lang + & P.changes .~ mempty + & P.errors .~ [defMessage & P.error .~ T.pack (show e) & P.maybe'span .~ Nothing] where path = T.pack $ pathKeyForBlobPair blobPair lang = bridging # languageForBlobPair blobPair diff --git a/src/Semantic/Api/Terms.hs b/src/Semantic/Api/Terms.hs index d1bf5323d8..37d2a19d3c 100644 --- a/src/Semantic/Api/Terms.hs +++ b/src/Semantic/Api/Terms.hs @@ -18,18 +18,20 @@ import Data.Either import Data.Graph import Data.JSON.Fields import Data.Language +import Data.ProtoLens (defMessage) import Data.Quieterm import Data.Term import qualified Data.Text as T -import qualified Data.Vector as V import Parsing.Parser import Prologue +import Proto.Semantic as P hiding (Blob) +import Proto.Semantic_Fields as P +import Proto.Semantic_JSON() import Rendering.Graph import Rendering.JSON hiding (JSON) import qualified Rendering.JSON import Semantic.Api.Bridge import Semantic.Config -import Semantic.Proto.SemanticPB hiding (Blob) import Semantic.Task import Serializing.Format hiding (JSON) import qualified Serializing.Format as Format @@ -37,18 +39,26 @@ import Source.Loc import qualified Language.Python as Py + termGraph :: (Traversable t, Member Distribute sig, ParseEffects sig m) => t Blob -> m ParseTreeGraphResponse -termGraph blobs = ParseTreeGraphResponse . V.fromList . toList <$> distributeFor blobs go +termGraph blobs = do + terms <- distributeFor blobs go + pure $ defMessage + & P.files .~ toList terms where go :: ParseEffects sig m => Blob -> m ParseTreeFileGraph go blob = parseWith jsonGraphTermParsers (pure . jsonGraphTerm blob) blob `catchError` \(SomeException e) -> - pure (ParseTreeFileGraph path lang mempty mempty (V.fromList [ParseError (T.pack (show e))])) + pure $ defMessage + & P.path .~ path + & P.language .~ lang + & P.vertices .~ mempty + & P.edges .~ mempty + & P.errors .~ [defMessage & P.error .~ T.pack (show e)] where path = T.pack $ blobPath blob lang = bridging # blobLanguage blob - data TermOutputFormat = TermJSONTree | TermJSONGraph @@ -137,7 +147,12 @@ class JSONGraphTerm term where instance (Foldable syntax, Functor syntax, ConstructorName syntax) => JSONGraphTerm (Term syntax) where jsonGraphTerm blob t = let graph = renderTreeGraph t - toEdge (Edge (a, b)) = TermEdge (vertexId a) (vertexId b) - in ParseTreeFileGraph path lang (V.fromList (vertexList graph)) (V.fromList (fmap toEdge (edgeList graph))) mempty where - path = T.pack $ blobPath blob - lang = bridging # blobLanguage blob + toEdge (Edge (a, b)) = defMessage & P.source .~ a^.vertexId & P.target .~ b^.vertexId + path = T.pack $ blobPath blob + lang = bridging # blobLanguage blob + in defMessage + & P.path .~ path + & P.language .~ lang + & P.vertices .~ vertexList graph + & P.edges .~ fmap toEdge (edgeList graph) + & P.errors .~ mempty diff --git a/src/Semantic/CLI.hs b/src/Semantic/CLI.hs index 85fbe4c88e..0c0247f1a8 100644 --- a/src/Semantic/CLI.hs +++ b/src/Semantic/CLI.hs @@ -33,6 +33,7 @@ import Control.Exception (Exception(..), throwTo) import Data.Typeable (Typeable) import System.Posix.Signals import System.Mem.Weak (deRefWeak) +import Proto.Semantic_JSON() newtype SignalException = SignalException Signal deriving (Show, Typeable) diff --git a/src/Semantic/Proto/SemanticPB.hs b/src/Semantic/Proto/SemanticPB.hs deleted file mode 100644 index 0a5106eddd..0000000000 --- a/src/Semantic/Proto/SemanticPB.hs +++ /dev/null @@ -1,1368 +0,0 @@ --- Code generated by protoc-gen-haskell 0.1.0, DO NOT EDIT. -{-# LANGUAGE DerivingVia, DeriveAnyClass, DuplicateRecordFields #-} -{-# OPTIONS_GHC -Wno-unused-imports -Wno-missing-export-lists #-} -module Semantic.Proto.SemanticPB where - -import Control.DeepSeq -import Control.Monad (msum) -import qualified Data.Aeson as A -import qualified Data.Aeson.Encoding as E -import Data.ByteString (ByteString) -import Data.Int -import Data.Text (Text) -import qualified Data.Text as T -import Data.Vector (Vector) -import Data.Word -import GHC.Generics -import Proto3.Suite (decodeMessageField, encodeMessageField, nestedvec, packedvec) -import qualified Proto3.Suite as Proto3 -import Proto3.Suite.JSONPB as JSONPB -import Proto3.Wire (at, oneof) - -data PingRequest = PingRequest - { service :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB PingRequest where - parseJSONPB = A.withObject "PingRequest" $ \obj -> PingRequest - <$> obj .: "service" - -instance ToJSONPB PingRequest where - toJSONPB PingRequest{..} = object - [ - "service" .= service - ] - toEncodingPB PingRequest{..} = pairs - [ - "service" .= service - ] - -instance FromJSON PingRequest where - parseJSON = parseJSONPB - -instance ToJSON PingRequest where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message PingRequest where - encodeMessage _ PingRequest{..} = mconcat - [ - encodeMessageField 1 service - ] - decodeMessage _ = PingRequest - <$> at decodeMessageField 1 - dotProto = undefined - -data PingResponse = PingResponse - { status :: Text - , hostname :: Text - , timestamp :: Text - , sha :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB PingResponse where - parseJSONPB = A.withObject "PingResponse" $ \obj -> PingResponse - <$> obj .: "status" - <*> obj .: "hostname" - <*> obj .: "timestamp" - <*> obj .: "sha" - -instance ToJSONPB PingResponse where - toJSONPB PingResponse{..} = object - [ - "status" .= status - , "hostname" .= hostname - , "timestamp" .= timestamp - , "sha" .= sha - ] - toEncodingPB PingResponse{..} = pairs - [ - "status" .= status - , "hostname" .= hostname - , "timestamp" .= timestamp - , "sha" .= sha - ] - -instance FromJSON PingResponse where - parseJSON = parseJSONPB - -instance ToJSON PingResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message PingResponse where - encodeMessage _ PingResponse{..} = mconcat - [ - encodeMessageField 1 status - , encodeMessageField 2 hostname - , encodeMessageField 3 timestamp - , encodeMessageField 4 sha - ] - decodeMessage _ = PingResponse - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - dotProto = undefined - -data ParseTreeRequest = ParseTreeRequest - { blobs :: Vector Blob - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeRequest where - parseJSONPB = A.withObject "ParseTreeRequest" $ \obj -> ParseTreeRequest - <$> obj .: "blobs" - -instance ToJSONPB ParseTreeRequest where - toJSONPB ParseTreeRequest{..} = object - [ - "blobs" .= blobs - ] - toEncodingPB ParseTreeRequest{..} = pairs - [ - "blobs" .= blobs - ] - -instance FromJSON ParseTreeRequest where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeRequest where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeRequest where - encodeMessage _ ParseTreeRequest{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec blobs) - ] - decodeMessage _ = ParseTreeRequest - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data ParseTreeSymbolResponse = ParseTreeSymbolResponse - { files :: Vector File - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeSymbolResponse where - parseJSONPB = A.withObject "ParseTreeSymbolResponse" $ \obj -> ParseTreeSymbolResponse - <$> obj .: "files" - -instance ToJSONPB ParseTreeSymbolResponse where - toJSONPB ParseTreeSymbolResponse{..} = object - [ - "files" .= files - ] - toEncodingPB ParseTreeSymbolResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON ParseTreeSymbolResponse where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeSymbolResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeSymbolResponse where - encodeMessage _ ParseTreeSymbolResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = ParseTreeSymbolResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data ParseTreeGraphResponse = ParseTreeGraphResponse - { files :: Vector ParseTreeFileGraph - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeGraphResponse where - parseJSONPB = A.withObject "ParseTreeGraphResponse" $ \obj -> ParseTreeGraphResponse - <$> obj .: "files" - -instance ToJSONPB ParseTreeGraphResponse where - toJSONPB ParseTreeGraphResponse{..} = object - [ - "files" .= files - ] - toEncodingPB ParseTreeGraphResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON ParseTreeGraphResponse where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeGraphResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeGraphResponse where - encodeMessage _ ParseTreeGraphResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = ParseTreeGraphResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data ParseTreeFileGraph = ParseTreeFileGraph - { path :: Text - , language :: Text - , vertices :: Vector TermVertex - , edges :: Vector TermEdge - , errors :: Vector ParseError - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseTreeFileGraph where - parseJSONPB = A.withObject "ParseTreeFileGraph" $ \obj -> ParseTreeFileGraph - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "vertices" - <*> obj .: "edges" - <*> obj .: "errors" - -instance ToJSONPB ParseTreeFileGraph where - toJSONPB ParseTreeFileGraph{..} = object - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - toEncodingPB ParseTreeFileGraph{..} = pairs - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - -instance FromJSON ParseTreeFileGraph where - parseJSON = parseJSONPB - -instance ToJSON ParseTreeFileGraph where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseTreeFileGraph where - encodeMessage _ ParseTreeFileGraph{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec vertices) - , encodeMessageField 4 (Proto3.NestedVec edges) - , encodeMessageField 5 (Proto3.NestedVec errors) - ] - decodeMessage _ = ParseTreeFileGraph - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - <*> (nestedvec <$> at decodeMessageField 5) - dotProto = undefined - -data TermEdge = TermEdge - { source :: Int32 - , target :: Int32 - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TermEdge where - parseJSONPB = A.withObject "TermEdge" $ \obj -> TermEdge - <$> obj .: "source" - <*> obj .: "target" - -instance ToJSONPB TermEdge where - toJSONPB TermEdge{..} = object - [ - "source" .= source - , "target" .= target - ] - toEncodingPB TermEdge{..} = pairs - [ - "source" .= source - , "target" .= target - ] - -instance FromJSON TermEdge where - parseJSON = parseJSONPB - -instance ToJSON TermEdge where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TermEdge where - encodeMessage _ TermEdge{..} = mconcat - [ - encodeMessageField 1 source - , encodeMessageField 2 target - ] - decodeMessage _ = TermEdge - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data TermVertex = TermVertex - { vertexId :: Int32 - , term :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TermVertex where - parseJSONPB = A.withObject "TermVertex" $ \obj -> TermVertex - <$> obj .: "vertexId" - <*> obj .: "term" - <*> obj .: "span" - -instance ToJSONPB TermVertex where - toJSONPB TermVertex{..} = object - [ - "vertexId" .= vertexId - , "term" .= term - , "span" .= span - ] - toEncodingPB TermVertex{..} = pairs - [ - "vertexId" .= vertexId - , "term" .= term - , "span" .= span - ] - -instance FromJSON TermVertex where - parseJSON = parseJSONPB - -instance ToJSON TermVertex where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TermVertex where - encodeMessage _ TermVertex{..} = mconcat - [ - encodeMessageField 1 vertexId - , encodeMessageField 2 term - , encodeMessageField 3 (Proto3.Nested span) - ] - decodeMessage _ = TermVertex - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - dotProto = undefined - -data ParseError = ParseError - { error :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ParseError where - parseJSONPB = A.withObject "ParseError" $ \obj -> ParseError - <$> obj .: "error" - -instance ToJSONPB ParseError where - toJSONPB ParseError{..} = object - [ - "error" .= error - ] - toEncodingPB ParseError{..} = pairs - [ - "error" .= error - ] - -instance FromJSON ParseError where - parseJSON = parseJSONPB - -instance ToJSON ParseError where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ParseError where - encodeMessage _ ParseError{..} = mconcat - [ - encodeMessageField 1 error - ] - decodeMessage _ = ParseError - <$> at decodeMessageField 1 - dotProto = undefined - -data DiffTreeRequest = DiffTreeRequest - { blobs :: Vector BlobPair - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeRequest where - parseJSONPB = A.withObject "DiffTreeRequest" $ \obj -> DiffTreeRequest - <$> obj .: "blobs" - -instance ToJSONPB DiffTreeRequest where - toJSONPB DiffTreeRequest{..} = object - [ - "blobs" .= blobs - ] - toEncodingPB DiffTreeRequest{..} = pairs - [ - "blobs" .= blobs - ] - -instance FromJSON DiffTreeRequest where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeRequest where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeRequest where - encodeMessage _ DiffTreeRequest{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec blobs) - ] - decodeMessage _ = DiffTreeRequest - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data DiffTreeTOCResponse = DiffTreeTOCResponse - { files :: Vector TOCSummaryFile - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeTOCResponse where - parseJSONPB = A.withObject "DiffTreeTOCResponse" $ \obj -> DiffTreeTOCResponse - <$> obj .: "files" - -instance ToJSONPB DiffTreeTOCResponse where - toJSONPB DiffTreeTOCResponse{..} = object - [ - "files" .= files - ] - toEncodingPB DiffTreeTOCResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON DiffTreeTOCResponse where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeTOCResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeTOCResponse where - encodeMessage _ DiffTreeTOCResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = DiffTreeTOCResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data TOCSummaryFile = TOCSummaryFile - { path :: Text - , language :: Text - , changes :: Vector TOCSummaryChange - , errors :: Vector TOCSummaryError - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TOCSummaryFile where - parseJSONPB = A.withObject "TOCSummaryFile" $ \obj -> TOCSummaryFile - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "changes" - <*> obj .: "errors" - -instance ToJSONPB TOCSummaryFile where - toJSONPB TOCSummaryFile{..} = object - [ - "path" .= path - , "language" .= language - , "changes" .= changes - , "errors" .= errors - ] - toEncodingPB TOCSummaryFile{..} = pairs - [ - "path" .= path - , "language" .= language - , "changes" .= changes - , "errors" .= errors - ] - -instance FromJSON TOCSummaryFile where - parseJSON = parseJSONPB - -instance ToJSON TOCSummaryFile where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TOCSummaryFile where - encodeMessage _ TOCSummaryFile{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec changes) - , encodeMessageField 4 (Proto3.NestedVec errors) - ] - decodeMessage _ = TOCSummaryFile - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - dotProto = undefined - -data TOCSummaryChange = TOCSummaryChange - { category :: Text - , term :: Text - , span :: Maybe Span - , changeType :: ChangeType - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TOCSummaryChange where - parseJSONPB = A.withObject "TOCSummaryChange" $ \obj -> TOCSummaryChange - <$> obj .: "category" - <*> obj .: "term" - <*> obj .: "span" - <*> obj .: "changeType" - -instance ToJSONPB TOCSummaryChange where - toJSONPB TOCSummaryChange{..} = object - [ - "category" .= category - , "term" .= term - , "span" .= span - , "changeType" .= changeType - ] - toEncodingPB TOCSummaryChange{..} = pairs - [ - "category" .= category - , "term" .= term - , "span" .= span - , "changeType" .= changeType - ] - -instance FromJSON TOCSummaryChange where - parseJSON = parseJSONPB - -instance ToJSON TOCSummaryChange where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TOCSummaryChange where - encodeMessage _ TOCSummaryChange{..} = mconcat - [ - encodeMessageField 1 category - , encodeMessageField 2 term - , encodeMessageField 3 (Proto3.Nested span) - , encodeMessageField 4 changeType - ] - decodeMessage _ = TOCSummaryChange - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - dotProto = undefined - -data TOCSummaryError = TOCSummaryError - { error :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB TOCSummaryError where - parseJSONPB = A.withObject "TOCSummaryError" $ \obj -> TOCSummaryError - <$> obj .: "error" - <*> obj .: "span" - -instance ToJSONPB TOCSummaryError where - toJSONPB TOCSummaryError{..} = object - [ - "error" .= error - , "span" .= span - ] - toEncodingPB TOCSummaryError{..} = pairs - [ - "error" .= error - , "span" .= span - ] - -instance FromJSON TOCSummaryError where - parseJSON = parseJSONPB - -instance ToJSON TOCSummaryError where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message TOCSummaryError where - encodeMessage _ TOCSummaryError{..} = mconcat - [ - encodeMessageField 1 error - , encodeMessageField 2 (Proto3.Nested span) - ] - decodeMessage _ = TOCSummaryError - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data DiffTreeGraphResponse = DiffTreeGraphResponse - { files :: Vector DiffTreeFileGraph - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeGraphResponse where - parseJSONPB = A.withObject "DiffTreeGraphResponse" $ \obj -> DiffTreeGraphResponse - <$> obj .: "files" - -instance ToJSONPB DiffTreeGraphResponse where - toJSONPB DiffTreeGraphResponse{..} = object - [ - "files" .= files - ] - toEncodingPB DiffTreeGraphResponse{..} = pairs - [ - "files" .= files - ] - -instance FromJSON DiffTreeGraphResponse where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeGraphResponse where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeGraphResponse where - encodeMessage _ DiffTreeGraphResponse{..} = mconcat - [ - encodeMessageField 1 (Proto3.NestedVec files) - ] - decodeMessage _ = DiffTreeGraphResponse - <$> (nestedvec <$> at decodeMessageField 1) - dotProto = undefined - -data DiffTreeFileGraph = DiffTreeFileGraph - { path :: Text - , language :: Text - , vertices :: Vector DiffTreeVertex - , edges :: Vector DiffTreeEdge - , errors :: Vector ParseError - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeFileGraph where - parseJSONPB = A.withObject "DiffTreeFileGraph" $ \obj -> DiffTreeFileGraph - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "vertices" - <*> obj .: "edges" - <*> obj .: "errors" - -instance ToJSONPB DiffTreeFileGraph where - toJSONPB DiffTreeFileGraph{..} = object - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - toEncodingPB DiffTreeFileGraph{..} = pairs - [ - "path" .= path - , "language" .= language - , "vertices" .= vertices - , "edges" .= edges - , "errors" .= errors - ] - -instance FromJSON DiffTreeFileGraph where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeFileGraph where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeFileGraph where - encodeMessage _ DiffTreeFileGraph{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec vertices) - , encodeMessageField 4 (Proto3.NestedVec edges) - , encodeMessageField 5 (Proto3.NestedVec errors) - ] - decodeMessage _ = DiffTreeFileGraph - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - <*> (nestedvec <$> at decodeMessageField 5) - dotProto = undefined - -data DiffTreeEdge = DiffTreeEdge - { source :: Int32 - , target :: Int32 - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeEdge where - parseJSONPB = A.withObject "DiffTreeEdge" $ \obj -> DiffTreeEdge - <$> obj .: "source" - <*> obj .: "target" - -instance ToJSONPB DiffTreeEdge where - toJSONPB DiffTreeEdge{..} = object - [ - "source" .= source - , "target" .= target - ] - toEncodingPB DiffTreeEdge{..} = pairs - [ - "source" .= source - , "target" .= target - ] - -instance FromJSON DiffTreeEdge where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeEdge where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeEdge where - encodeMessage _ DiffTreeEdge{..} = mconcat - [ - encodeMessageField 1 source - , encodeMessageField 2 target - ] - decodeMessage _ = DiffTreeEdge - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data DiffTreeVertexDiffTerm - = Deleted (Maybe DeletedTerm) - | Inserted (Maybe InsertedTerm) - | Replaced (Maybe ReplacedTerm) - | Merged (Maybe MergedTerm) - deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Message, Proto3.Named, NFData) - -instance FromJSONPB DiffTreeVertexDiffTerm where - parseJSONPB = A.withObject "DiffTreeVertexDiffTerm" $ \obj -> msum - [ - Deleted <$> parseField obj "deleted" - , Inserted <$> parseField obj "inserted" - , Replaced <$> parseField obj "replaced" - , Merged <$> parseField obj "merged" - ] - -instance ToJSONPB DiffTreeVertexDiffTerm where - toJSONPB (Deleted x) = object [ "deleted" .= x ] - toJSONPB (Inserted x) = object [ "inserted" .= x ] - toJSONPB (Replaced x) = object [ "replaced" .= x ] - toJSONPB (Merged x) = object [ "merged" .= x ] - toEncodingPB (Deleted x) = pairs [ "deleted" .= x ] - toEncodingPB (Inserted x) = pairs [ "inserted" .= x ] - toEncodingPB (Replaced x) = pairs [ "replaced" .= x ] - toEncodingPB (Merged x) = pairs [ "merged" .= x ] - -instance FromJSON DiffTreeVertexDiffTerm where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeVertexDiffTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -data DiffTreeVertex = DiffTreeVertex - { diffVertexId :: Int32 - , diffTerm :: Maybe DiffTreeVertexDiffTerm - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DiffTreeVertex where - parseJSONPB = A.withObject "DiffTreeVertex" $ \obj -> DiffTreeVertex - <$> obj .: "diffVertexId" - <*> obj .: "diffTerm" - -instance ToJSONPB DiffTreeVertex where - toJSONPB DiffTreeVertex{..} = object - [ - "diffVertexId" .= diffVertexId - , "diffTerm" .= diffTerm - ] - toEncodingPB DiffTreeVertex{..} = pairs - [ - "diffVertexId" .= diffVertexId - , "diffTerm" .= diffTerm - ] - -instance FromJSON DiffTreeVertex where - parseJSON = parseJSONPB - -instance ToJSON DiffTreeVertex where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DiffTreeVertex where - encodeMessage _ DiffTreeVertex{..} = mconcat - [ - encodeMessageField 1 diffVertexId - , case diffTerm of - Nothing -> mempty - Just (Deleted deleted) -> encodeMessageField 2 deleted - Just (Inserted inserted) -> encodeMessageField 3 inserted - Just (Replaced replaced) -> encodeMessageField 4 replaced - Just (Merged merged) -> encodeMessageField 5 merged - ] - decodeMessage _ = DiffTreeVertex - <$> at decodeMessageField 1 - <*> oneof - Nothing - [ - (2, Just . Deleted <$> decodeMessageField) - , (3, Just . Inserted <$> decodeMessageField) - , (4, Just . Replaced <$> decodeMessageField) - , (5, Just . Merged <$> decodeMessageField) - ] - dotProto = undefined - -data DeletedTerm = DeletedTerm - { term :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB DeletedTerm where - parseJSONPB = A.withObject "DeletedTerm" $ \obj -> DeletedTerm - <$> obj .: "term" - <*> obj .: "span" - -instance ToJSONPB DeletedTerm where - toJSONPB DeletedTerm{..} = object - [ - "term" .= term - , "span" .= span - ] - toEncodingPB DeletedTerm{..} = pairs - [ - "term" .= term - , "span" .= span - ] - -instance FromJSON DeletedTerm where - parseJSON = parseJSONPB - -instance ToJSON DeletedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message DeletedTerm where - encodeMessage _ DeletedTerm{..} = mconcat - [ - encodeMessageField 1 term - , encodeMessageField 2 (Proto3.Nested span) - ] - decodeMessage _ = DeletedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data InsertedTerm = InsertedTerm - { term :: Text - , span :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB InsertedTerm where - parseJSONPB = A.withObject "InsertedTerm" $ \obj -> InsertedTerm - <$> obj .: "term" - <*> obj .: "span" - -instance ToJSONPB InsertedTerm where - toJSONPB InsertedTerm{..} = object - [ - "term" .= term - , "span" .= span - ] - toEncodingPB InsertedTerm{..} = pairs - [ - "term" .= term - , "span" .= span - ] - -instance FromJSON InsertedTerm where - parseJSON = parseJSONPB - -instance ToJSON InsertedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message InsertedTerm where - encodeMessage _ InsertedTerm{..} = mconcat - [ - encodeMessageField 1 term - , encodeMessageField 2 (Proto3.Nested span) - ] - decodeMessage _ = InsertedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data ReplacedTerm = ReplacedTerm - { beforeTerm :: Text - , beforeSpan :: Maybe Span - , afterTerm :: Text - , afterSpan :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB ReplacedTerm where - parseJSONPB = A.withObject "ReplacedTerm" $ \obj -> ReplacedTerm - <$> obj .: "beforeTerm" - <*> obj .: "beforeSpan" - <*> obj .: "afterTerm" - <*> obj .: "afterSpan" - -instance ToJSONPB ReplacedTerm where - toJSONPB ReplacedTerm{..} = object - [ - "beforeTerm" .= beforeTerm - , "beforeSpan" .= beforeSpan - , "afterTerm" .= afterTerm - , "afterSpan" .= afterSpan - ] - toEncodingPB ReplacedTerm{..} = pairs - [ - "beforeTerm" .= beforeTerm - , "beforeSpan" .= beforeSpan - , "afterTerm" .= afterTerm - , "afterSpan" .= afterSpan - ] - -instance FromJSON ReplacedTerm where - parseJSON = parseJSONPB - -instance ToJSON ReplacedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message ReplacedTerm where - encodeMessage _ ReplacedTerm{..} = mconcat - [ - encodeMessageField 1 beforeTerm - , encodeMessageField 2 (Proto3.Nested beforeSpan) - , encodeMessageField 3 afterTerm - , encodeMessageField 4 (Proto3.Nested afterSpan) - ] - decodeMessage _ = ReplacedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - dotProto = undefined - -data MergedTerm = MergedTerm - { term :: Text - , beforeSpan :: Maybe Span - , afterSpan :: Maybe Span - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB MergedTerm where - parseJSONPB = A.withObject "MergedTerm" $ \obj -> MergedTerm - <$> obj .: "term" - <*> obj .: "beforeSpan" - <*> obj .: "afterSpan" - -instance ToJSONPB MergedTerm where - toJSONPB MergedTerm{..} = object - [ - "term" .= term - , "beforeSpan" .= beforeSpan - , "afterSpan" .= afterSpan - ] - toEncodingPB MergedTerm{..} = pairs - [ - "term" .= term - , "beforeSpan" .= beforeSpan - , "afterSpan" .= afterSpan - ] - -instance FromJSON MergedTerm where - parseJSON = parseJSONPB - -instance ToJSON MergedTerm where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message MergedTerm where - encodeMessage _ MergedTerm{..} = mconcat - [ - encodeMessageField 1 term - , encodeMessageField 2 (Proto3.Nested beforeSpan) - , encodeMessageField 3 (Proto3.Nested afterSpan) - ] - decodeMessage _ = MergedTerm - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - dotProto = undefined - -data Blob = Blob - { content :: Text - , path :: Text - , language :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Blob where - parseJSONPB = A.withObject "Blob" $ \obj -> Blob - <$> obj .: "content" - <*> obj .: "path" - <*> obj .: "language" - -instance ToJSONPB Blob where - toJSONPB Blob{..} = object - [ - "content" .= content - , "path" .= path - , "language" .= language - ] - toEncodingPB Blob{..} = pairs - [ - "content" .= content - , "path" .= path - , "language" .= language - ] - -instance FromJSON Blob where - parseJSON = parseJSONPB - -instance ToJSON Blob where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Blob where - encodeMessage _ Blob{..} = mconcat - [ - encodeMessageField 1 content - , encodeMessageField 2 path - , encodeMessageField 3 language - ] - decodeMessage _ = Blob - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - dotProto = undefined - -data BlobPair = BlobPair - { before :: Maybe Blob - , after :: Maybe Blob - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB BlobPair where - parseJSONPB = A.withObject "BlobPair" $ \obj -> BlobPair - <$> obj .: "before" - <*> obj .: "after" - -instance ToJSONPB BlobPair where - toJSONPB BlobPair{..} = object - [ - "before" .= before - , "after" .= after - ] - toEncodingPB BlobPair{..} = pairs - [ - "before" .= before - , "after" .= after - ] - -instance FromJSON BlobPair where - parseJSON = parseJSONPB - -instance ToJSON BlobPair where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message BlobPair where - encodeMessage _ BlobPair{..} = mconcat - [ - encodeMessageField 1 (Proto3.Nested before) - , encodeMessageField 2 (Proto3.Nested after) - ] - decodeMessage _ = BlobPair - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data File = File - { path :: Text - , language :: Text - , symbols :: Vector Symbol - , errors :: Vector ParseError - , blobOid :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB File where - parseJSONPB = A.withObject "File" $ \obj -> File - <$> obj .: "path" - <*> obj .: "language" - <*> obj .: "symbols" - <*> obj .: "errors" - <*> obj .: "blobOid" - -instance ToJSONPB File where - toJSONPB File{..} = object - [ - "path" .= path - , "language" .= language - , "symbols" .= symbols - , "errors" .= errors - , "blobOid" .= blobOid - ] - toEncodingPB File{..} = pairs - [ - "path" .= path - , "language" .= language - , "symbols" .= symbols - , "errors" .= errors - , "blobOid" .= blobOid - ] - -instance FromJSON File where - parseJSON = parseJSONPB - -instance ToJSON File where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message File where - encodeMessage _ File{..} = mconcat - [ - encodeMessageField 1 path - , encodeMessageField 2 language - , encodeMessageField 3 (Proto3.NestedVec symbols) - , encodeMessageField 4 (Proto3.NestedVec errors) - , encodeMessageField 5 blobOid - ] - decodeMessage _ = File - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> (nestedvec <$> at decodeMessageField 3) - <*> (nestedvec <$> at decodeMessageField 4) - <*> at decodeMessageField 5 - dotProto = undefined - -data Symbol = Symbol - { symbol :: Text - , kind :: Text - , line :: Text - , span :: Maybe Span - , docs :: Maybe Docstring - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Symbol where - parseJSONPB = A.withObject "Symbol" $ \obj -> Symbol - <$> obj .: "symbol" - <*> obj .: "kind" - <*> obj .: "line" - <*> obj .: "span" - <*> obj .: "docs" - -instance ToJSONPB Symbol where - toJSONPB Symbol{..} = object - [ - "symbol" .= symbol - , "kind" .= kind - , "line" .= line - , "span" .= span - , "docs" .= docs - ] - toEncodingPB Symbol{..} = pairs - [ - "symbol" .= symbol - , "kind" .= kind - , "line" .= line - , "span" .= span - , "docs" .= docs - ] - -instance FromJSON Symbol where - parseJSON = parseJSONPB - -instance ToJSON Symbol where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Symbol where - encodeMessage _ Symbol{..} = mconcat - [ - encodeMessageField 1 symbol - , encodeMessageField 2 kind - , encodeMessageField 3 line - , encodeMessageField 4 (Proto3.Nested span) - , encodeMessageField 5 (Proto3.Nested docs) - ] - decodeMessage _ = Symbol - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - <*> at decodeMessageField 3 - <*> at decodeMessageField 4 - <*> at decodeMessageField 5 - dotProto = undefined - -data Docstring = Docstring - { docstring :: Text - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Docstring where - parseJSONPB = A.withObject "Docstring" $ \obj -> Docstring - <$> obj .: "docstring" - -instance ToJSONPB Docstring where - toJSONPB Docstring{..} = object - [ - "docstring" .= docstring - ] - toEncodingPB Docstring{..} = pairs - [ - "docstring" .= docstring - ] - -instance FromJSON Docstring where - parseJSON = parseJSONPB - -instance ToJSON Docstring where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Docstring where - encodeMessage _ Docstring{..} = mconcat - [ - encodeMessageField 1 docstring - ] - decodeMessage _ = Docstring - <$> at decodeMessageField 1 - dotProto = undefined - -data Position = Position - { line :: Int32 - , column :: Int32 - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Position where - parseJSONPB = A.withObject "Position" $ \obj -> Position - <$> obj .: "line" - <*> obj .: "column" - -instance ToJSONPB Position where - toJSONPB Position{..} = object - [ - "line" .= line - , "column" .= column - ] - toEncodingPB Position{..} = pairs - [ - "line" .= line - , "column" .= column - ] - -instance FromJSON Position where - parseJSON = parseJSONPB - -instance ToJSON Position where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Position where - encodeMessage _ Position{..} = mconcat - [ - encodeMessageField 1 line - , encodeMessageField 2 column - ] - decodeMessage _ = Position - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data Span = Span - { start :: Maybe Position - , end :: Maybe Position - } deriving stock (Eq, Ord, Show, Generic) - deriving anyclass (Proto3.Named, NFData) - -instance FromJSONPB Span where - parseJSONPB = A.withObject "Span" $ \obj -> Span - <$> obj .: "start" - <*> obj .: "end" - -instance ToJSONPB Span where - toJSONPB Span{..} = object - [ - "start" .= start - , "end" .= end - ] - toEncodingPB Span{..} = pairs - [ - "start" .= start - , "end" .= end - ] - -instance FromJSON Span where - parseJSON = parseJSONPB - -instance ToJSON Span where - toJSON = toAesonValue - toEncoding = toAesonEncoding - -instance Proto3.Message Span where - encodeMessage _ Span{..} = mconcat - [ - encodeMessageField 1 (Proto3.Nested start) - , encodeMessageField 2 (Proto3.Nested end) - ] - decodeMessage _ = Span - <$> at decodeMessageField 1 - <*> at decodeMessageField 2 - dotProto = undefined - -data ChangeType - = None - | Added - | Removed - | Modified - deriving stock (Eq, Ord, Show, Enum, Bounded, Generic) - deriving anyclass (Proto3.Named, Proto3.MessageField, NFData) - deriving Proto3.Primitive via Proto3.PrimitiveEnum ChangeType - -instance Proto3.HasDefault ChangeType where def = None - -instance FromJSONPB ChangeType where - parseJSONPB (JSONPB.String "NONE") = pure None - parseJSONPB (JSONPB.String "ADDED") = pure Added - parseJSONPB (JSONPB.String "REMOVED") = pure Removed - parseJSONPB (JSONPB.String "MODIFIED") = pure Modified - 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 diff --git a/src/Serializing/Format.hs b/src/Serializing/Format.hs index 8cbaa2157d..45974a5185 100644 --- a/src/Serializing/Format.hs +++ b/src/Serializing/Format.hs @@ -14,7 +14,8 @@ import Data.ByteString.Builder import Language.Haskell.HsColour import Language.Haskell.HsColour.Colourise import Prologue -import Proto3.Suite as Proto3 +import Data.ProtoLens.Encoding as Proto +import Data.ProtoLens.Message (Message) import Serializing.SExpression import Text.Show.Pretty @@ -33,4 +34,4 @@ runSerialize _ JSON = (<> "\n") . fromEncoding . toEncodin runSerialize _ (SExpression opts) = serializeSExpression opts runSerialize Colourful Show = (<> "\n") . stringUtf8 . hscolour TTY defaultColourPrefs False False "" False . ppShow runSerialize Plain Show = (<> "\n") . stringUtf8 . show -runSerialize _ Proto = lazyByteString . Proto3.toLazyByteString +runSerialize _ Proto = Proto.buildMessage diff --git a/test/Graphing/Calls/Spec.hs b/test/Graphing/Calls/Spec.hs index 1cf4cee407..210466ba0c 100644 --- a/test/Graphing/Calls/Spec.hs +++ b/test/Graphing/Calls/Spec.hs @@ -3,7 +3,7 @@ module Graphing.Calls.Spec ( spec ) where import Prelude hiding (readFile) -import SpecHelpers hiding (readFile) +import SpecHelpers import Algebra.Graph diff --git a/test/Semantic/IO/Spec.hs b/test/Semantic/IO/Spec.hs index 35ccc66c55..324fcd46b8 100644 --- a/test/Semantic/IO/Spec.hs +++ b/test/Semantic/IO/Spec.hs @@ -15,7 +15,7 @@ import Data.Blob import Data.Handle import qualified Semantic.Git as Git import Shelly (cd, run_, shelly, silently, touchfile, writefile) -import SpecHelpers hiding (readFile) +import SpecHelpers import System.Path (()) import qualified System.Path as Path