Skip to content

Instantly share code, notes, and snippets.

@lgastako
Created October 9, 2019 19:28
Show Gist options
  • Save lgastako/71bad8ecbedaaa6fbbcb0942773f5e3e to your computer and use it in GitHub Desktop.
Save lgastako/71bad8ecbedaaa6fbbcb0942773f5e3e to your computer and use it in GitHub Desktop.
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module Repro where
import qualified Prelude as Hs
import qualified Proto3.Suite.Class as HsProtobuf
import qualified Proto3.Suite.DotProto as HsProtobuf
import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Suite.Types as HsProtobuf
import qualified Proto3.Wire as HsProtobuf
import qualified Control.Applicative as Hs
import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.DeepSeq as Hs
import qualified Control.Monad as Hs
import qualified Data.ByteString as Hs
import qualified Data.Coerce as Hs
import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.List.NonEmpty as Hs (NonEmpty(..))
import qualified Data.Map as Hs (Map, mapKeysMonotonic)
import qualified Data.Proxy as Proxy
import qualified Data.String as Hs (fromString)
import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.Vector as Hs (Vector)
import qualified Data.Word as Hs (Word16, Word32, Word64)
import qualified GHC.Enum as Hs
import qualified GHC.Generics as Hs
import qualified Unsafe.Coerce as Hs
data Transaction = Transaction{}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Transaction where
nameOf _ = (Hs.fromString "Transaction")
instance HsProtobuf.HasDefault Transaction
instance HsProtobuf.Message Transaction where
encodeMessage _ Transaction{} = (Hs.mconcat [])
decodeMessage _ = (Hs.pure Transaction)
dotProto _ = []
instance HsJSONPB.ToJSONPB Transaction where
toJSONPB (Transaction) = (HsJSONPB.object [])
toEncodingPB (Transaction) = (HsJSONPB.pairs [])
instance HsJSONPB.FromJSONPB Transaction where
parseJSONPB
= (HsJSONPB.withObject "Transaction"
(\ obj -> (Hs.pure Transaction)))
instance HsJSONPB.ToJSON Transaction where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Transaction where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Transaction where
declareNamedSchema _
= do Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Transaction",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList []}})
data Transaction_Query = Transaction_Query{}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Transaction_Query where
nameOf _ = (Hs.fromString "Transaction_Query")
instance HsProtobuf.HasDefault Transaction_Query
instance HsProtobuf.Message Transaction_Query where
encodeMessage _ Transaction_Query{} = (Hs.mconcat [])
decodeMessage _ = (Hs.pure Transaction_Query)
dotProto _ = []
instance HsJSONPB.ToJSONPB Transaction_Query where
toJSONPB (Transaction_Query) = (HsJSONPB.object [])
toEncodingPB (Transaction_Query) = (HsJSONPB.pairs [])
instance HsJSONPB.FromJSONPB Transaction_Query where
parseJSONPB
= (HsJSONPB.withObject "Transaction_Query"
(\ obj -> (Hs.pure Transaction_Query)))
instance HsJSONPB.ToJSON Transaction_Query where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Transaction_Query where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Transaction_Query where
declareNamedSchema _
= do Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Transaction_Query",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList []}})
data Transaction_Query_Req = Transaction_Query_Req{transaction_Query_ReqInfer
:: HsProtobuf.Enumerated Repro.Query_INFER}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Transaction_Query_Req where
nameOf _ = (Hs.fromString "Transaction_Query_Req")
instance HsProtobuf.HasDefault Transaction_Query_Req
instance HsProtobuf.Message Transaction_Query_Req where
encodeMessage _
Transaction_Query_Req{transaction_Query_ReqInfer =
transaction_Query_ReqInfer}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
transaction_Query_ReqInfer)])
decodeMessage _
= (Hs.pure Transaction_Query_Req) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "INFER")))
(HsProtobuf.Single "infer")
[]
"")]
instance HsJSONPB.ToJSONPB Transaction_Query_Req where
toJSONPB (Transaction_Query_Req f1)
= (HsJSONPB.object ["infer" .= f1])
toEncodingPB (Transaction_Query_Req f1)
= (HsJSONPB.pairs ["infer" .= f1])
instance HsJSONPB.FromJSONPB Transaction_Query_Req where
parseJSONPB
= (HsJSONPB.withObject "Transaction_Query_Req"
(\ obj -> (Hs.pure Transaction_Query_Req) <*> obj .: "infer"))
instance HsJSONPB.ToJSON Transaction_Query_Req where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Transaction_Query_Req where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Transaction_Query_Req where
declareNamedSchema _
= do let declare_infer = HsJSONPB.declareSchemaRef
transaction_Query_ReqInfer <- declare_infer Proxy.Proxy
let _ = Hs.pure Transaction_Query_Req <*>
HsJSONPB.asProxy declare_infer
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Transaction_Query_Req",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("infer", transaction_Query_ReqInfer)]}})
data Transaction_Query_INFER = Transaction_Query_INFERTRUE
| Transaction_Query_INFERFALSE
deriving (Hs.Show, Hs.Eq, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Transaction_Query_INFER where
nameOf _ = (Hs.fromString "Transaction_Query_INFER")
instance HsProtobuf.HasDefault Transaction_Query_INFER
instance Hs.Bounded Transaction_Query_INFER where
minBound = Transaction_Query_INFERTRUE
maxBound = Transaction_Query_INFERFALSE
instance Hs.Ord Transaction_Query_INFER where
compare x y
= Hs.compare (HsProtobuf.fromProtoEnum x)
(HsProtobuf.fromProtoEnum y)
instance HsProtobuf.ProtoEnum Transaction_Query_INFER where
toProtoEnumMay 0 = Hs.Just Transaction_Query_INFERTRUE
toProtoEnumMay 1 = Hs.Just Transaction_Query_INFERFALSE
toProtoEnumMay _ = Hs.Nothing
fromProtoEnum (Transaction_Query_INFERTRUE) = 0
fromProtoEnum (Transaction_Query_INFERFALSE) = 1
instance HsJSONPB.ToJSONPB Transaction_Query_INFER where
toJSONPB x _ = HsJSONPB.enumFieldString x
toEncodingPB x _ = HsJSONPB.enumFieldEncoding x
instance HsJSONPB.FromJSONPB Transaction_Query_INFER where
parseJSONPB (HsJSONPB.String "TRUE")
= Hs.pure Transaction_Query_INFERTRUE
parseJSONPB (HsJSONPB.String "FALSE")
= Hs.pure Transaction_Query_INFERFALSE
parseJSONPB v = (HsJSONPB.typeMismatch "Transaction_Query_INFER" v)
instance HsJSONPB.ToJSON Transaction_Query_INFER where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Transaction_Query_INFER where
parseJSON = HsJSONPB.parseJSONPB
instance HsProtobuf.Finite Transaction_Query_INFER
data Query2 = Query2{}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Query2 where
nameOf _ = (Hs.fromString "Query2")
instance HsProtobuf.HasDefault Query2
instance HsProtobuf.Message Query2 where
encodeMessage _ Query2{} = (Hs.mconcat [])
decodeMessage _ = (Hs.pure Query2)
dotProto _ = []
instance HsJSONPB.ToJSONPB Query2 where
toJSONPB (Query2) = (HsJSONPB.object [])
toEncodingPB (Query2) = (HsJSONPB.pairs [])
instance HsJSONPB.FromJSONPB Query2 where
parseJSONPB
= (HsJSONPB.withObject "Query2" (\ obj -> (Hs.pure Query2)))
instance HsJSONPB.ToJSON Query2 where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Query2 where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Query2 where
declareNamedSchema _
= do Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName = Hs.Just "Query2",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList []}})
data Query2_Req2 = Query2_Req2{query2_Req2Infer ::
HsProtobuf.Enumerated Repro.Query2_INFER2}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Query2_Req2 where
nameOf _ = (Hs.fromString "Query2_Req2")
instance HsProtobuf.HasDefault Query2_Req2
instance HsProtobuf.Message Query2_Req2 where
encodeMessage _ Query2_Req2{query2_Req2Infer = query2_Req2Infer}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
query2_Req2Infer)])
decodeMessage _
= (Hs.pure Query2_Req2) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "INFER2")))
(HsProtobuf.Single "infer")
[]
"")]
instance HsJSONPB.ToJSONPB Query2_Req2 where
toJSONPB (Query2_Req2 f1) = (HsJSONPB.object ["infer" .= f1])
toEncodingPB (Query2_Req2 f1) = (HsJSONPB.pairs ["infer" .= f1])
instance HsJSONPB.FromJSONPB Query2_Req2 where
parseJSONPB
= (HsJSONPB.withObject "Query2_Req2"
(\ obj -> (Hs.pure Query2_Req2) <*> obj .: "infer"))
instance HsJSONPB.ToJSON Query2_Req2 where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Query2_Req2 where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Query2_Req2 where
declareNamedSchema _
= do let declare_infer = HsJSONPB.declareSchemaRef
query2_Req2Infer <- declare_infer Proxy.Proxy
let _ = Hs.pure Query2_Req2 <*> HsJSONPB.asProxy declare_infer
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Query2_Req2",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("infer", query2_Req2Infer)]}})
data Query2_INFER2 = Query2_INFER2TRUE
| Query2_INFER2FALSE
deriving (Hs.Show, Hs.Eq, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Query2_INFER2 where
nameOf _ = (Hs.fromString "Query2_INFER2")
instance HsProtobuf.HasDefault Query2_INFER2
instance Hs.Bounded Query2_INFER2 where
minBound = Query2_INFER2TRUE
maxBound = Query2_INFER2FALSE
instance Hs.Ord Query2_INFER2 where
compare x y
= Hs.compare (HsProtobuf.fromProtoEnum x)
(HsProtobuf.fromProtoEnum y)
instance HsProtobuf.ProtoEnum Query2_INFER2 where
toProtoEnumMay 0 = Hs.Just Query2_INFER2TRUE
toProtoEnumMay 1 = Hs.Just Query2_INFER2FALSE
toProtoEnumMay _ = Hs.Nothing
fromProtoEnum (Query2_INFER2TRUE) = 0
fromProtoEnum (Query2_INFER2FALSE) = 1
instance HsJSONPB.ToJSONPB Query2_INFER2 where
toJSONPB x _ = HsJSONPB.enumFieldString x
toEncodingPB x _ = HsJSONPB.enumFieldEncoding x
instance HsJSONPB.FromJSONPB Query2_INFER2 where
parseJSONPB (HsJSONPB.String "TRUE") = Hs.pure Query2_INFER2TRUE
parseJSONPB (HsJSONPB.String "FALSE") = Hs.pure Query2_INFER2FALSE
parseJSONPB v = (HsJSONPB.typeMismatch "Query2_INFER2" v)
instance HsJSONPB.ToJSON Query2_INFER2 where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Query2_INFER2 where
parseJSON = HsJSONPB.parseJSONPB
instance HsProtobuf.Finite Query2_INFER2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment