concrete-haskell 0.1.0.11 → 0.1.0.13
raw patch · 137 files changed
+728/−18412 lines, 137 filesdep +binarydep +concrete-haskell-autogendep +monad-extrasnew-component:exe:fetch_servicenew-component:exe:store_service
Dependencies added: binary, concrete-haskell-autogen, monad-extras, path
Files
- concrete-haskell.cabal +187/−127
- src/Access_Consts.hs +0/−44
- src/Access_Types.hs +0/−113
- src/ActiveLearnerClientService.hs +0/−136
- src/ActiveLearnerClientService_Client.hs +0/−65
- src/ActiveLearnerClientService_Iface.hs +0/−49
- src/ActiveLearnerServerService.hs +0/−302
- src/ActiveLearnerServerService_Client.hs +0/−97
- src/ActiveLearnerServerService_Iface.hs +0/−51
- src/AnnotateCommunicationService.hs +0/−372
- src/AnnotateCommunicationService_Client.hs +0/−113
- src/AnnotateCommunicationService_Iface.hs +0/−58
- src/Annotate_Consts.hs +0/−52
- src/Annotate_Types.hs +0/−51
- src/Audio_Consts.hs +0/−41
- src/Audio_Types.hs +0/−90
- src/Cluster_Consts.hs +0/−44
- src/Cluster_Types.hs +0/−187
- src/Communication_Consts.hs +0/−50
- src/Communication_Types.hs +0/−301
- src/Concrete_Consts.hs +0/−64
- src/Concrete_Types.hs +0/−63
- src/Data/Concrete.hs +1/−70
- src/Data/Concrete/Parsers.hs +52/−51
- src/Data/Concrete/Parsers/CONLL.hs +3/−2
- src/Data/Concrete/Parsers/CSV.hs +3/−3
- src/Data/Concrete/Parsers/Email.hs +3/−2
- src/Data/Concrete/Parsers/HTML.hs +3/−2
- src/Data/Concrete/Parsers/JSON.hs +2/−2
- src/Data/Concrete/Parsers/PTB.hs +5/−5
- src/Data/Concrete/Parsers/Types.hs +2/−1
- src/Data/Concrete/Parsers/Utils.hs +7/−4
- src/Data/Concrete/Parsers/XML.hs +1/−2
- src/Data/Concrete/Services.hs +29/−0
- src/Data/Concrete/Services/ActiveLearnerClientService.hs +0/−136
- src/Data/Concrete/Services/ActiveLearnerClientService_Client.hs +0/−65
- src/Data/Concrete/Services/ActiveLearnerClientService_Iface.hs +0/−49
- src/Data/Concrete/Services/ActiveLearnerServerService.hs +0/−302
- src/Data/Concrete/Services/ActiveLearnerServerService_Client.hs +0/−97
- src/Data/Concrete/Services/ActiveLearnerServerService_Iface.hs +0/−51
- src/Data/Concrete/Services/AnnotateCommunicationService.hs +0/−372
- src/Data/Concrete/Services/AnnotateCommunicationService_Client.hs +0/−113
- src/Data/Concrete/Services/AnnotateCommunicationService_Iface.hs +0/−58
- src/Data/Concrete/Services/FeedbackService.hs +0/−359
- src/Data/Concrete/Services/FeedbackService_Client.hs +0/−103
- src/Data/Concrete/Services/FeedbackService_Iface.hs +0/−54
- src/Data/Concrete/Services/Fetch.hs +97/−0
- src/Data/Concrete/Services/FetchCommunicationService.hs +0/−343
- src/Data/Concrete/Services/FetchCommunicationService_Client.hs +0/−99
- src/Data/Concrete/Services/FetchCommunicationService_Iface.hs +0/−50
- src/Data/Concrete/Services/ResultsServerService.hs +0/−945
- src/Data/Concrete/Services/ResultsServerService_Client.hs +0/−203
- src/Data/Concrete/Services/ResultsServerService_Iface.hs +0/−58
- src/Data/Concrete/Services/SearchProxyService.hs +0/−443
- src/Data/Concrete/Services/SearchProxyService_Client.hs +0/−120
- src/Data/Concrete/Services/SearchProxyService_Iface.hs +0/−55
- src/Data/Concrete/Services/SearchService.hs +0/−335
- src/Data/Concrete/Services/SearchService_Client.hs +0/−103
- src/Data/Concrete/Services/SearchService_Iface.hs +0/−54
- src/Data/Concrete/Services/Service.hs +0/−206
- src/Data/Concrete/Services/Service_Client.hs +0/−78
- src/Data/Concrete/Services/Service_Iface.hs +0/−47
- src/Data/Concrete/Services/Store.hs +104/−0
- src/Data/Concrete/Services/StoreCommunicationService.hs +0/−145
- src/Data/Concrete/Services/StoreCommunicationService_Client.hs +0/−65
- src/Data/Concrete/Services/StoreCommunicationService_Iface.hs +0/−48
- src/Data/Concrete/Services/SummarizationService.hs +0/−243
- src/Data/Concrete/Services/SummarizationService_Client.hs +0/−84
- src/Data/Concrete/Services/SummarizationService_Iface.hs +0/−51
- src/Data/Concrete/Types.hs +0/−33
- src/Data/Concrete/Utils.hs +44/−91
- src/Email_Consts.hs +0/−41
- src/Email_Types.hs +0/−200
- src/Entities_Consts.hs +0/−46
- src/Entities_Types.hs +0/−287
- src/Ex_Consts.hs +0/−41
- src/Ex_Types.hs +0/−79
- src/FeedbackService.hs +0/−359
- src/FeedbackService_Client.hs +0/−103
- src/FeedbackService_Iface.hs +0/−54
- src/FetchCommunicationService.hs +0/−343
- src/FetchCommunicationService_Client.hs +0/−99
- src/FetchCommunicationService_Iface.hs +0/−50
- src/Language_Consts.hs +0/−44
- src/Language_Types.hs +0/−87
- src/Learn_Consts.hs +0/−45
- src/Learn_Types.hs +0/−132
- src/Linking_Consts.hs +0/−44
- src/Linking_Types.hs +0/−169
- src/Metadata_Consts.hs +0/−46
- src/Metadata_Types.hs +0/−329
- src/Nitf_Consts.hs +0/−41
- src/Nitf_Types.hs +0/−330
- src/ResultsServerService.hs +0/−945
- src/ResultsServerService_Client.hs +0/−203
- src/ResultsServerService_Iface.hs +0/−58
- src/Results_Consts.hs +0/−46
- src/Results_Types.hs +0/−45
- src/SearchProxyService.hs +0/−443
- src/SearchProxyService_Client.hs +0/−120
- src/SearchProxyService_Iface.hs +0/−55
- src/SearchService.hs +0/−335
- src/SearchService_Client.hs +0/−103
- src/SearchService_Iface.hs +0/−54
- src/Search_Consts.hs +0/−48
- src/Search_Types.hs +0/−345
- src/Service.hs +0/−206
- src/Service_Client.hs +0/−78
- src/Service_Iface.hs +0/−47
- src/Services_Consts.hs +0/−43
- src/Services_Types.hs +0/−268
- src/Situations_Consts.hs +0/−46
- src/Situations_Types.hs +0/−567
- src/Spans_Consts.hs +0/−41
- src/Spans_Types.hs +0/−116
- src/StoreCommunicationService.hs +0/−145
- src/StoreCommunicationService_Client.hs +0/−65
- src/StoreCommunicationService_Iface.hs +0/−48
- src/Structure_Consts.hs +0/−46
- src/Structure_Types.hs +0/−1006
- src/SummarizationService.hs +0/−243
- src/SummarizationService_Client.hs +0/−84
- src/SummarizationService_Iface.hs +0/−51
- src/Summarization_Consts.hs +0/−46
- src/Summarization_Types.hs +0/−248
- src/Twitter_Consts.hs +0/−41
- src/Twitter_Types.hs +0/−740
- src/Uuid_Consts.hs +0/−41
- src/Uuid_Types.hs +0/−72
- tests/TestIngesters.hs +31/−0
- tests/TestSerialization.hs +22/−0
- tests/UnitTests.hs +0/−30
- utils/FetchService.hs +29/−0
- utils/IngestCommunications.hs +10/−10
- utils/InspectCommunication.hs +0/−43
- utils/InspectCommunications.hs +64/−0
- utils/StoreService.hs +29/−0
concrete-haskell.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.14.1.+-- This file has been generated from package.yaml by hpack version 0.17.1. -- -- see: https://github.com/sol/hpack name: concrete-haskell-version: 0.1.0.11+version: 0.1.0.13 synopsis: Library for the Concrete data format. description: Concrete is a Thrift-based data specification designed for Natural Language Processing (NLP) applications. This library provides a Haskell interface to code generated from the latest release of Concrete. It also has a number of utilities for converting various formats (JSON, CSV, XML, etc) to Concrete Communication objects. category: Data@@ -21,20 +21,24 @@ src default-extensions: RecordWildCards build-depends:- base >=4.6 && <5+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0 , bytestring ==0.10.8.1 , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1 , containers ==0.5.7.1 , directory ==1.3.0.0 , filepath ==1.4.1.1 , hashable ==1.2.6.1 , megaparsec ==5.3.1+ , monad-extras ==0.6.0 , mtl ==2.2.1 , network ==2.6.3.2 , optparse-generic ==1.2.2+ , path ==0.5.13 , path-io ==1.2.2 , process ==1.4.3.0- , QuickCheck ==2.9.2 , scientific ==0.3.5.1 , tar ==0.5.0.3 , text ==1.2.2.2@@ -47,41 +51,10 @@ , zlib ==0.6.1.2 exposed-modules: Data.Concrete- Data.Concrete.Services.ActiveLearnerClientService- Data.Concrete.Services.ActiveLearnerClientService_Client- Data.Concrete.Services.ActiveLearnerClientService_Iface- Data.Concrete.Services.ActiveLearnerServerService- Data.Concrete.Services.ActiveLearnerServerService_Client- Data.Concrete.Services.ActiveLearnerServerService_Iface- Data.Concrete.Services.AnnotateCommunicationService- Data.Concrete.Services.AnnotateCommunicationService_Client- Data.Concrete.Services.AnnotateCommunicationService_Iface- Data.Concrete.Services.FeedbackService- Data.Concrete.Services.FeedbackService_Client- Data.Concrete.Services.FeedbackService_Iface- Data.Concrete.Services.FetchCommunicationService- Data.Concrete.Services.FetchCommunicationService_Client- Data.Concrete.Services.FetchCommunicationService_Iface- Data.Concrete.Services.ResultsServerService- Data.Concrete.Services.ResultsServerService_Client- Data.Concrete.Services.ResultsServerService_Iface- Data.Concrete.Services.SearchProxyService- Data.Concrete.Services.SearchProxyService_Client- Data.Concrete.Services.SearchProxyService_Iface- Data.Concrete.Services.SearchService- Data.Concrete.Services.SearchService_Client- Data.Concrete.Services.SearchService_Iface- Data.Concrete.Services.Service- Data.Concrete.Services.Service_Client- Data.Concrete.Services.Service_Iface- Data.Concrete.Services.StoreCommunicationService- Data.Concrete.Services.StoreCommunicationService_Client- Data.Concrete.Services.StoreCommunicationService_Iface- Data.Concrete.Services.SummarizationService- Data.Concrete.Services.SummarizationService_Client- Data.Concrete.Services.SummarizationService_Iface- Data.Concrete.Types Data.Concrete.Utils+ Data.Concrete.Services+ Data.Concrete.Services.Fetch+ Data.Concrete.Services.Store Data.Concrete.Parsers Data.Concrete.Parsers.Types Data.Concrete.Parsers.Utils@@ -94,107 +67,72 @@ Data.Concrete.Parsers.PTB Data.Concrete.Parsers.RFC2822 other-modules:- Access_Consts- Access_Types- ActiveLearnerClientService- ActiveLearnerClientService_Client- ActiveLearnerClientService_Iface- ActiveLearnerServerService- ActiveLearnerServerService_Client- ActiveLearnerServerService_Iface- Annotate_Consts- Annotate_Types- AnnotateCommunicationService- AnnotateCommunicationService_Client- AnnotateCommunicationService_Iface- Audio_Consts- Audio_Types- Cluster_Consts- Cluster_Types- Communication_Consts- Communication_Types- Concrete_Consts- Concrete_Types- Email_Consts- Email_Types- Entities_Consts- Entities_Types- Ex_Consts- Ex_Types- FeedbackService- FeedbackService_Client- FeedbackService_Iface- FetchCommunicationService- FetchCommunicationService_Client- FetchCommunicationService_Iface- Language_Consts- Language_Types- Learn_Consts- Learn_Types- Linking_Consts- Linking_Types- Metadata_Consts- Metadata_Types- Nitf_Consts- Nitf_Types- Results_Consts- Results_Types- ResultsServerService- ResultsServerService_Client- ResultsServerService_Iface- Search_Consts- Search_Types- SearchProxyService- SearchProxyService_Client- SearchProxyService_Iface- SearchService- SearchService_Client- SearchService_Iface- Service- Service_Client- Service_Iface- Services_Consts- Services_Types- Situations_Consts- Situations_Types- Spans_Consts- Spans_Types- StoreCommunicationService- StoreCommunicationService_Client- StoreCommunicationService_Iface- Structure_Consts- Structure_Types- Summarization_Consts- Summarization_Types- SummarizationService- SummarizationService_Client- SummarizationService_Iface- Twitter_Consts- Twitter_Types- Uuid_Consts- Uuid_Types Paths_concrete_haskell default-language: Haskell2010 +executable fetch_service+ main-is: FetchService.hs+ hs-source-dirs:+ utils+ build-depends:+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0+ , bytestring ==0.10.8.1+ , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1+ , containers ==0.5.7.1+ , directory ==1.3.0.0+ , filepath ==1.4.1.1+ , hashable ==1.2.6.1+ , megaparsec ==5.3.1+ , monad-extras ==0.6.0+ , mtl ==2.2.1+ , network ==2.6.3.2+ , optparse-generic ==1.2.2+ , path ==0.5.13+ , path-io ==1.2.2+ , process ==1.4.3.0+ , scientific ==0.3.5.1+ , tar ==0.5.0.3+ , text ==1.2.2.2+ , thrift ==0.10.0+ , time ==1.6.0.1+ , unordered-containers ==0.2.8.0+ , uuid ==1.3.13+ , vector ==0.10.12.2+ , zip ==0.1.11+ , zlib ==0.6.1.2+ , concrete-haskell+ other-modules:+ IngestCommunications+ InspectCommunications+ StoreService+ default-language: Haskell2010+ executable ingest_communications main-is: IngestCommunications.hs hs-source-dirs: utils build-depends:- base >=4.6 && <5+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0 , bytestring ==0.10.8.1 , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1 , containers ==0.5.7.1 , directory ==1.3.0.0 , filepath ==1.4.1.1 , hashable ==1.2.6.1 , megaparsec ==5.3.1+ , monad-extras ==0.6.0 , mtl ==2.2.1 , network ==2.6.3.2 , optparse-generic ==1.2.2+ , path ==0.5.13 , path-io ==1.2.2 , process ==1.4.3.0- , QuickCheck ==2.9.2 , scientific ==0.3.5.1 , tar ==0.5.0.3 , text ==1.2.2.2@@ -207,29 +145,35 @@ , zlib ==0.6.1.2 , concrete-haskell other-modules:- InspectCommunication+ FetchService+ InspectCommunications+ StoreService default-language: Haskell2010 executable inspect_communications- main-is: InspectCommunication.hs+ main-is: InspectCommunications.hs hs-source-dirs: utils default-extensions: RecordWildCards build-depends:- base >=4.6 && <5+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0 , bytestring ==0.10.8.1 , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1 , containers ==0.5.7.1 , directory ==1.3.0.0 , filepath ==1.4.1.1 , hashable ==1.2.6.1 , megaparsec ==5.3.1+ , monad-extras ==0.6.0 , mtl ==2.2.1 , network ==2.6.3.2 , optparse-generic ==1.2.2+ , path ==0.5.13 , path-io ==1.2.2 , process ==1.4.3.0- , QuickCheck ==2.9.2 , scientific ==0.3.5.1 , tar ==0.5.0.3 , text ==1.2.2.2@@ -242,27 +186,143 @@ , zlib ==0.6.1.2 , concrete-haskell other-modules:+ FetchService IngestCommunications+ StoreService default-language: Haskell2010 -test-suite unit_tests+executable store_service+ main-is: StoreService.hs+ hs-source-dirs:+ utils+ build-depends:+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0+ , bytestring ==0.10.8.1+ , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1+ , containers ==0.5.7.1+ , directory ==1.3.0.0+ , filepath ==1.4.1.1+ , hashable ==1.2.6.1+ , megaparsec ==5.3.1+ , monad-extras ==0.6.0+ , mtl ==2.2.1+ , network ==2.6.3.2+ , optparse-generic ==1.2.2+ , path ==0.5.13+ , path-io ==1.2.2+ , process ==1.4.3.0+ , scientific ==0.3.5.1+ , tar ==0.5.0.3+ , text ==1.2.2.2+ , thrift ==0.10.0+ , time ==1.6.0.1+ , unordered-containers ==0.2.8.0+ , uuid ==1.3.13+ , vector ==0.10.12.2+ , zip ==0.1.11+ , zlib ==0.6.1.2+ , concrete-haskell+ other-modules:+ FetchService+ IngestCommunications+ InspectCommunications+ default-language: Haskell2010++test-suite ingesters type: exitcode-stdio-1.0- main-is: tests/UnitTests.hs+ main-is: tests/TestIngesters.hs build-depends:- base >=4.6 && <5+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0 , bytestring ==0.10.8.1 , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1 , containers ==0.5.7.1 , directory ==1.3.0.0 , filepath ==1.4.1.1 , hashable ==1.2.6.1 , megaparsec ==5.3.1+ , monad-extras ==0.6.0 , mtl ==2.2.1 , network ==2.6.3.2 , optparse-generic ==1.2.2+ , path ==0.5.13 , path-io ==1.2.2 , process ==1.4.3.0- , QuickCheck ==2.9.2+ , scientific ==0.3.5.1+ , tar ==0.5.0.3+ , text ==1.2.2.2+ , thrift ==0.10.0+ , time ==1.6.0.1+ , unordered-containers ==0.2.8.0+ , uuid ==1.3.13+ , vector ==0.10.12.2+ , zip ==0.1.11+ , zlib ==0.6.1.2+ , concrete-haskell+ default-language: Haskell2010++test-suite serialization+ type: exitcode-stdio-1.0+ main-is: tests/TestSerialization.hs+ build-depends:+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0+ , bytestring ==0.10.8.1+ , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1+ , containers ==0.5.7.1+ , directory ==1.3.0.0+ , filepath ==1.4.1.1+ , hashable ==1.2.6.1+ , megaparsec ==5.3.1+ , monad-extras ==0.6.0+ , mtl ==2.2.1+ , network ==2.6.3.2+ , optparse-generic ==1.2.2+ , path ==0.5.13+ , path-io ==1.2.2+ , process ==1.4.3.0+ , scientific ==0.3.5.1+ , tar ==0.5.0.3+ , text ==1.2.2.2+ , thrift ==0.10.0+ , time ==1.6.0.1+ , unordered-containers ==0.2.8.0+ , uuid ==1.3.13+ , vector ==0.10.12.2+ , zip ==0.1.11+ , zlib ==0.6.1.2+ , concrete-haskell+ default-language: Haskell2010++benchmark ingest+ type: exitcode-stdio-1.0+ main-is: tests/TestIngesters.hs+ build-depends:+ QuickCheck ==2.9.2+ , base >=4.6 && <5+ , binary ==0.8.3.0+ , bytestring ==0.10.8.1+ , bzlib ==0.5.0.5+ , concrete-haskell-autogen ==0.0.0.1+ , containers ==0.5.7.1+ , directory ==1.3.0.0+ , filepath ==1.4.1.1+ , hashable ==1.2.6.1+ , megaparsec ==5.3.1+ , monad-extras ==0.6.0+ , mtl ==2.2.1+ , network ==2.6.3.2+ , optparse-generic ==1.2.2+ , path ==0.5.13+ , path-io ==1.2.2+ , process ==1.4.3.0 , scientific ==0.3.5.1 , tar ==0.5.0.3 , text ==1.2.2.2
− src/Access_Consts.hs
@@ -1,44 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Access_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types
− src/Access_Types.hs
@@ -1,113 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Access_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---data FetchResult = FetchResult { fetchResult_communications :: (Vector.Vector Communication_Types.Communication)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable FetchResult where- hashWithSalt salt record = salt `H.hashWithSalt` fetchResult_communications record -instance QC.Arbitrary FetchResult where - arbitrary = M.liftM FetchResult (QC.arbitrary)- shrink obj | obj == default_FetchResult = []- | P.otherwise = M.catMaybes- [ if obj == default_FetchResult{fetchResult_communications = fetchResult_communications obj} then P.Nothing else P.Just $ default_FetchResult{fetchResult_communications = fetchResult_communications obj}- ]-from_FetchResult :: FetchResult -> T.ThriftVal-from_FetchResult record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("communications",T.TList (T.T_STRUCT Communication_Types.typemap_Communication) $ P.map (\_v4 -> Communication_Types.from_Communication _v4) $ Vector.toList _v2))) $ fetchResult_communications record- ]-write_FetchResult :: (T.Protocol p, T.Transport t) => p t -> FetchResult -> P.IO ()-write_FetchResult oprot record = T.writeVal oprot $ from_FetchResult record-encode_FetchResult :: (T.Protocol p, T.Transport t) => p t -> FetchResult -> LBS.ByteString-encode_FetchResult oprot record = T.serializeVal oprot $ from_FetchResult record-to_FetchResult :: T.ThriftVal -> FetchResult-to_FetchResult (T.TStruct fields) = FetchResult{- fetchResult_communications = P.maybe (P.error "Missing required field: communications") (\(_,_val6) -> (case _val6 of {T.TList _ _val7 -> (Vector.fromList $ P.map (\_v8 -> (case _v8 of {T.TStruct _val9 -> (Communication_Types.to_Communication (T.TStruct _val9)); _ -> P.error "wrong type"})) _val7); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_FetchResult _ = P.error "not a struct"-read_FetchResult :: (T.Transport t, T.Protocol p) => p t -> P.IO FetchResult-read_FetchResult iprot = to_FetchResult <$> T.readVal iprot (T.T_STRUCT typemap_FetchResult)-decode_FetchResult :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> FetchResult-decode_FetchResult iprot bs = to_FetchResult $ T.deserializeVal iprot (T.T_STRUCT typemap_FetchResult) bs-typemap_FetchResult :: T.TypeMap-typemap_FetchResult = Map.fromList [(1,("communications",(T.T_LIST (T.T_STRUCT Communication_Types.typemap_Communication))))]-default_FetchResult :: FetchResult-default_FetchResult = FetchResult{- fetchResult_communications = Vector.empty}-data FetchRequest = FetchRequest { fetchRequest_communicationIds :: (Vector.Vector LT.Text)- , fetchRequest_auths :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable FetchRequest where- hashWithSalt salt record = salt `H.hashWithSalt` fetchRequest_communicationIds record `H.hashWithSalt` fetchRequest_auths record -instance QC.Arbitrary FetchRequest where - arbitrary = M.liftM FetchRequest (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_FetchRequest = []- | P.otherwise = M.catMaybes- [ if obj == default_FetchRequest{fetchRequest_communicationIds = fetchRequest_communicationIds obj} then P.Nothing else P.Just $ default_FetchRequest{fetchRequest_communicationIds = fetchRequest_communicationIds obj}- , if obj == default_FetchRequest{fetchRequest_auths = fetchRequest_auths obj} then P.Nothing else P.Just $ default_FetchRequest{fetchRequest_auths = fetchRequest_auths obj}- ]-from_FetchRequest :: FetchRequest -> T.ThriftVal-from_FetchRequest record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v12 -> P.Just (1, ("communicationIds",T.TList T.T_STRING $ P.map (\_v14 -> T.TString $ E.encodeUtf8 _v14) $ Vector.toList _v12))) $ fetchRequest_communicationIds record- , (\_v12 -> (2, ("auths",T.TString $ E.encodeUtf8 _v12))) <$> fetchRequest_auths record- ]-write_FetchRequest :: (T.Protocol p, T.Transport t) => p t -> FetchRequest -> P.IO ()-write_FetchRequest oprot record = T.writeVal oprot $ from_FetchRequest record-encode_FetchRequest :: (T.Protocol p, T.Transport t) => p t -> FetchRequest -> LBS.ByteString-encode_FetchRequest oprot record = T.serializeVal oprot $ from_FetchRequest record-to_FetchRequest :: T.ThriftVal -> FetchRequest-to_FetchRequest (T.TStruct fields) = FetchRequest{- fetchRequest_communicationIds = P.maybe (P.error "Missing required field: communicationIds") (\(_,_val16) -> (case _val16 of {T.TList _ _val17 -> (Vector.fromList $ P.map (\_v18 -> (case _v18 of {T.TString _val19 -> E.decodeUtf8 _val19; _ -> P.error "wrong type"})) _val17); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- fetchRequest_auths = P.maybe (P.Nothing) (\(_,_val16) -> P.Just (case _val16 of {T.TString _val20 -> E.decodeUtf8 _val20; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_FetchRequest _ = P.error "not a struct"-read_FetchRequest :: (T.Transport t, T.Protocol p) => p t -> P.IO FetchRequest-read_FetchRequest iprot = to_FetchRequest <$> T.readVal iprot (T.T_STRUCT typemap_FetchRequest)-decode_FetchRequest :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> FetchRequest-decode_FetchRequest iprot bs = to_FetchRequest $ T.deserializeVal iprot (T.T_STRUCT typemap_FetchRequest) bs-typemap_FetchRequest :: T.TypeMap-typemap_FetchRequest = Map.fromList [(1,("communicationIds",(T.T_LIST T.T_STRING))),(2,("auths",T.T_STRING))]-default_FetchRequest :: FetchRequest-default_FetchRequest = FetchRequest{- fetchRequest_communicationIds = Vector.empty,- fetchRequest_auths = P.Nothing}
− src/ActiveLearnerClientService.hs
@@ -1,136 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ActiveLearnerClientService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import qualified Service-import Learn_Types-import qualified ActiveLearnerClientService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data SubmitSort_args = SubmitSort_args { submitSort_args_sessionId :: Uuid_Types.UUID- , submitSort_args_unitIds :: (Vector.Vector Services_Types.AnnotationUnitIdentifier)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitSort_args where- hashWithSalt salt record = salt `H.hashWithSalt` submitSort_args_sessionId record `H.hashWithSalt` submitSort_args_unitIds record -instance QC.Arbitrary SubmitSort_args where - arbitrary = M.liftM SubmitSort_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SubmitSort_args = []- | P.otherwise = M.catMaybes- [ if obj == default_SubmitSort_args{submitSort_args_sessionId = submitSort_args_sessionId obj} then P.Nothing else P.Just $ default_SubmitSort_args{submitSort_args_sessionId = submitSort_args_sessionId obj}- , if obj == default_SubmitSort_args{submitSort_args_unitIds = submitSort_args_unitIds obj} then P.Nothing else P.Just $ default_SubmitSort_args{submitSort_args_unitIds = submitSort_args_unitIds obj}- ]-from_SubmitSort_args :: SubmitSort_args -> T.ThriftVal-from_SubmitSort_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v63 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v63))) $ submitSort_args_sessionId record- , (\_v63 -> P.Just (2, ("unitIds",T.TList (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier) $ P.map (\_v65 -> Services_Types.from_AnnotationUnitIdentifier _v65) $ Vector.toList _v63))) $ submitSort_args_unitIds record- ]-write_SubmitSort_args :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_args -> P.IO ()-write_SubmitSort_args oprot record = T.writeVal oprot $ from_SubmitSort_args record-encode_SubmitSort_args :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_args -> LBS.ByteString-encode_SubmitSort_args oprot record = T.serializeVal oprot $ from_SubmitSort_args record-to_SubmitSort_args :: T.ThriftVal -> SubmitSort_args-to_SubmitSort_args (T.TStruct fields) = SubmitSort_args{- submitSort_args_sessionId = P.maybe (submitSort_args_sessionId default_SubmitSort_args) (\(_,_val67) -> (case _val67 of {T.TStruct _val68 -> (Uuid_Types.to_UUID (T.TStruct _val68)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- submitSort_args_unitIds = P.maybe (submitSort_args_unitIds default_SubmitSort_args) (\(_,_val67) -> (case _val67 of {T.TList _ _val69 -> (Vector.fromList $ P.map (\_v70 -> (case _v70 of {T.TStruct _val71 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val71)); _ -> P.error "wrong type"})) _val69); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_SubmitSort_args _ = P.error "not a struct"-read_SubmitSort_args :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitSort_args-read_SubmitSort_args iprot = to_SubmitSort_args <$> T.readVal iprot (T.T_STRUCT typemap_SubmitSort_args)-decode_SubmitSort_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitSort_args-decode_SubmitSort_args iprot bs = to_SubmitSort_args $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitSort_args) bs-typemap_SubmitSort_args :: T.TypeMap-typemap_SubmitSort_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("unitIds",(T.T_LIST (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier))))]-default_SubmitSort_args :: SubmitSort_args-default_SubmitSort_args = SubmitSort_args{- submitSort_args_sessionId = Uuid_Types.default_UUID,- submitSort_args_unitIds = Vector.empty}-data SubmitSort_result = SubmitSort_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitSort_result where- hashWithSalt salt record = salt -instance QC.Arbitrary SubmitSort_result where - arbitrary = QC.elements [SubmitSort_result]-from_SubmitSort_result :: SubmitSort_result -> T.ThriftVal-from_SubmitSort_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_SubmitSort_result :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_result -> P.IO ()-write_SubmitSort_result oprot record = T.writeVal oprot $ from_SubmitSort_result record-encode_SubmitSort_result :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_result -> LBS.ByteString-encode_SubmitSort_result oprot record = T.serializeVal oprot $ from_SubmitSort_result record-to_SubmitSort_result :: T.ThriftVal -> SubmitSort_result-to_SubmitSort_result (T.TStruct fields) = SubmitSort_result{-- }-to_SubmitSort_result _ = P.error "not a struct"-read_SubmitSort_result :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitSort_result-read_SubmitSort_result iprot = to_SubmitSort_result <$> T.readVal iprot (T.T_STRUCT typemap_SubmitSort_result)-decode_SubmitSort_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitSort_result-decode_SubmitSort_result iprot bs = to_SubmitSort_result $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitSort_result) bs-typemap_SubmitSort_result :: T.TypeMap-typemap_SubmitSort_result = Map.fromList []-default_SubmitSort_result :: SubmitSort_result-default_SubmitSort_result = SubmitSort_result{-}-process_submitSort (seqid, iprot, oprot, handler) = do- args <- read_SubmitSort_args iprot- (X.catch- (do- Iface.submitSort handler (submitSort_args_sessionId args) (submitSort_args_unitIds args)- let res = default_SubmitSort_result- T.writeMessageBegin oprot ("submitSort", T.M_REPLY, seqid)- write_SubmitSort_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("submitSort", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "submitSort" -> process_submitSort (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/ActiveLearnerClientService_Client.hs
@@ -1,65 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ActiveLearnerClientService_Client(submitSort) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types-import ActiveLearnerClientService-seqid = R.newIORef 0-submitSort (ip,op) arg_sessionId arg_unitIds = do- send_submitSort op arg_sessionId arg_unitIds- recv_submitSort ip-send_submitSort op arg_sessionId arg_unitIds = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("submitSort", T.M_CALL, seqn)- write_SubmitSort_args op (SubmitSort_args{submitSort_args_sessionId=arg_sessionId,submitSort_args_unitIds=arg_unitIds})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_submitSort ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_SubmitSort_result ip- T.readMessageEnd ip- P.return ()
− src/ActiveLearnerClientService_Iface.hs
@@ -1,49 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ActiveLearnerClientService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types--import Service_Iface-class Service_Iface a => ActiveLearnerClientService_Iface a where- submitSort :: a -> Uuid_Types.UUID -> (Vector.Vector Services_Types.AnnotationUnitIdentifier) -> P.IO ()
− src/ActiveLearnerServerService.hs
@@ -1,302 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ActiveLearnerServerService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import qualified Service-import Learn_Types-import qualified ActiveLearnerServerService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Start_args = Start_args { start_args_sessionId :: Uuid_Types.UUID- , start_args_task :: AnnotationTask- , start_args_contact :: Services_Types.AsyncContactInfo- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Start_args where- hashWithSalt salt record = salt `H.hashWithSalt` start_args_sessionId record `H.hashWithSalt` start_args_task record `H.hashWithSalt` start_args_contact record -instance QC.Arbitrary Start_args where - arbitrary = M.liftM Start_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Start_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Start_args{start_args_sessionId = start_args_sessionId obj} then P.Nothing else P.Just $ default_Start_args{start_args_sessionId = start_args_sessionId obj}- , if obj == default_Start_args{start_args_task = start_args_task obj} then P.Nothing else P.Just $ default_Start_args{start_args_task = start_args_task obj}- , if obj == default_Start_args{start_args_contact = start_args_contact obj} then P.Nothing else P.Just $ default_Start_args{start_args_contact = start_args_contact obj}- ]-from_Start_args :: Start_args -> T.ThriftVal-from_Start_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v22 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v22))) $ start_args_sessionId record- , (\_v22 -> P.Just (2, ("task",from_AnnotationTask _v22))) $ start_args_task record- , (\_v22 -> P.Just (3, ("contact",Services_Types.from_AsyncContactInfo _v22))) $ start_args_contact record- ]-write_Start_args :: (T.Protocol p, T.Transport t) => p t -> Start_args -> P.IO ()-write_Start_args oprot record = T.writeVal oprot $ from_Start_args record-encode_Start_args :: (T.Protocol p, T.Transport t) => p t -> Start_args -> LBS.ByteString-encode_Start_args oprot record = T.serializeVal oprot $ from_Start_args record-to_Start_args :: T.ThriftVal -> Start_args-to_Start_args (T.TStruct fields) = Start_args{- start_args_sessionId = P.maybe (start_args_sessionId default_Start_args) (\(_,_val24) -> (case _val24 of {T.TStruct _val25 -> (Uuid_Types.to_UUID (T.TStruct _val25)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- start_args_task = P.maybe (start_args_task default_Start_args) (\(_,_val24) -> (case _val24 of {T.TStruct _val26 -> (to_AnnotationTask (T.TStruct _val26)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- start_args_contact = P.maybe (start_args_contact default_Start_args) (\(_,_val24) -> (case _val24 of {T.TStruct _val27 -> (Services_Types.to_AsyncContactInfo (T.TStruct _val27)); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Start_args _ = P.error "not a struct"-read_Start_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Start_args-read_Start_args iprot = to_Start_args <$> T.readVal iprot (T.T_STRUCT typemap_Start_args)-decode_Start_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Start_args-decode_Start_args iprot bs = to_Start_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Start_args) bs-typemap_Start_args :: T.TypeMap-typemap_Start_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("task",(T.T_STRUCT typemap_AnnotationTask))),(3,("contact",(T.T_STRUCT Services_Types.typemap_AsyncContactInfo)))]-default_Start_args :: Start_args-default_Start_args = Start_args{- start_args_sessionId = Uuid_Types.default_UUID,- start_args_task = default_AnnotationTask,- start_args_contact = Services_Types.default_AsyncContactInfo}-data Start_result = Start_result { start_result_success :: P.Bool- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Start_result where- hashWithSalt salt record = salt `H.hashWithSalt` start_result_success record -instance QC.Arbitrary Start_result where - arbitrary = M.liftM Start_result (QC.arbitrary)- shrink obj | obj == default_Start_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Start_result{start_result_success = start_result_success obj} then P.Nothing else P.Just $ default_Start_result{start_result_success = start_result_success obj}- ]-from_Start_result :: Start_result -> T.ThriftVal-from_Start_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v30 -> P.Just (0, ("success",T.TBool _v30))) $ start_result_success record- ]-write_Start_result :: (T.Protocol p, T.Transport t) => p t -> Start_result -> P.IO ()-write_Start_result oprot record = T.writeVal oprot $ from_Start_result record-encode_Start_result :: (T.Protocol p, T.Transport t) => p t -> Start_result -> LBS.ByteString-encode_Start_result oprot record = T.serializeVal oprot $ from_Start_result record-to_Start_result :: T.ThriftVal -> Start_result-to_Start_result (T.TStruct fields) = Start_result{- start_result_success = P.maybe (start_result_success default_Start_result) (\(_,_val32) -> (case _val32 of {T.TBool _val33 -> _val33; _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_Start_result _ = P.error "not a struct"-read_Start_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Start_result-read_Start_result iprot = to_Start_result <$> T.readVal iprot (T.T_STRUCT typemap_Start_result)-decode_Start_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Start_result-decode_Start_result iprot bs = to_Start_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Start_result) bs-typemap_Start_result :: T.TypeMap-typemap_Start_result = Map.fromList [(0,("success",T.T_BOOL))]-default_Start_result :: Start_result-default_Start_result = Start_result{- start_result_success = P.False}-data Stop_args = Stop_args { stop_args_sessionId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Stop_args where- hashWithSalt salt record = salt `H.hashWithSalt` stop_args_sessionId record -instance QC.Arbitrary Stop_args where - arbitrary = M.liftM Stop_args (QC.arbitrary)- shrink obj | obj == default_Stop_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Stop_args{stop_args_sessionId = stop_args_sessionId obj} then P.Nothing else P.Just $ default_Stop_args{stop_args_sessionId = stop_args_sessionId obj}- ]-from_Stop_args :: Stop_args -> T.ThriftVal-from_Stop_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v36 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v36))) $ stop_args_sessionId record- ]-write_Stop_args :: (T.Protocol p, T.Transport t) => p t -> Stop_args -> P.IO ()-write_Stop_args oprot record = T.writeVal oprot $ from_Stop_args record-encode_Stop_args :: (T.Protocol p, T.Transport t) => p t -> Stop_args -> LBS.ByteString-encode_Stop_args oprot record = T.serializeVal oprot $ from_Stop_args record-to_Stop_args :: T.ThriftVal -> Stop_args-to_Stop_args (T.TStruct fields) = Stop_args{- stop_args_sessionId = P.maybe (stop_args_sessionId default_Stop_args) (\(_,_val38) -> (case _val38 of {T.TStruct _val39 -> (Uuid_Types.to_UUID (T.TStruct _val39)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Stop_args _ = P.error "not a struct"-read_Stop_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Stop_args-read_Stop_args iprot = to_Stop_args <$> T.readVal iprot (T.T_STRUCT typemap_Stop_args)-decode_Stop_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Stop_args-decode_Stop_args iprot bs = to_Stop_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Stop_args) bs-typemap_Stop_args :: T.TypeMap-typemap_Stop_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_Stop_args :: Stop_args-default_Stop_args = Stop_args{- stop_args_sessionId = Uuid_Types.default_UUID}-data Stop_result = Stop_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Stop_result where- hashWithSalt salt record = salt -instance QC.Arbitrary Stop_result where - arbitrary = QC.elements [Stop_result]-from_Stop_result :: Stop_result -> T.ThriftVal-from_Stop_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Stop_result :: (T.Protocol p, T.Transport t) => p t -> Stop_result -> P.IO ()-write_Stop_result oprot record = T.writeVal oprot $ from_Stop_result record-encode_Stop_result :: (T.Protocol p, T.Transport t) => p t -> Stop_result -> LBS.ByteString-encode_Stop_result oprot record = T.serializeVal oprot $ from_Stop_result record-to_Stop_result :: T.ThriftVal -> Stop_result-to_Stop_result (T.TStruct fields) = Stop_result{-- }-to_Stop_result _ = P.error "not a struct"-read_Stop_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Stop_result-read_Stop_result iprot = to_Stop_result <$> T.readVal iprot (T.T_STRUCT typemap_Stop_result)-decode_Stop_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Stop_result-decode_Stop_result iprot bs = to_Stop_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Stop_result) bs-typemap_Stop_result :: T.TypeMap-typemap_Stop_result = Map.fromList []-default_Stop_result :: Stop_result-default_Stop_result = Stop_result{-}-data AddAnnotations_args = AddAnnotations_args { addAnnotations_args_sessionId :: Uuid_Types.UUID- , addAnnotations_args_annotations :: (Vector.Vector Annotation)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddAnnotations_args where- hashWithSalt salt record = salt `H.hashWithSalt` addAnnotations_args_sessionId record `H.hashWithSalt` addAnnotations_args_annotations record -instance QC.Arbitrary AddAnnotations_args where - arbitrary = M.liftM AddAnnotations_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AddAnnotations_args = []- | P.otherwise = M.catMaybes- [ if obj == default_AddAnnotations_args{addAnnotations_args_sessionId = addAnnotations_args_sessionId obj} then P.Nothing else P.Just $ default_AddAnnotations_args{addAnnotations_args_sessionId = addAnnotations_args_sessionId obj}- , if obj == default_AddAnnotations_args{addAnnotations_args_annotations = addAnnotations_args_annotations obj} then P.Nothing else P.Just $ default_AddAnnotations_args{addAnnotations_args_annotations = addAnnotations_args_annotations obj}- ]-from_AddAnnotations_args :: AddAnnotations_args -> T.ThriftVal-from_AddAnnotations_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v47 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v47))) $ addAnnotations_args_sessionId record- , (\_v47 -> P.Just (2, ("annotations",T.TList (T.T_STRUCT typemap_Annotation) $ P.map (\_v49 -> from_Annotation _v49) $ Vector.toList _v47))) $ addAnnotations_args_annotations record- ]-write_AddAnnotations_args :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_args -> P.IO ()-write_AddAnnotations_args oprot record = T.writeVal oprot $ from_AddAnnotations_args record-encode_AddAnnotations_args :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_args -> LBS.ByteString-encode_AddAnnotations_args oprot record = T.serializeVal oprot $ from_AddAnnotations_args record-to_AddAnnotations_args :: T.ThriftVal -> AddAnnotations_args-to_AddAnnotations_args (T.TStruct fields) = AddAnnotations_args{- addAnnotations_args_sessionId = P.maybe (addAnnotations_args_sessionId default_AddAnnotations_args) (\(_,_val51) -> (case _val51 of {T.TStruct _val52 -> (Uuid_Types.to_UUID (T.TStruct _val52)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- addAnnotations_args_annotations = P.maybe (addAnnotations_args_annotations default_AddAnnotations_args) (\(_,_val51) -> (case _val51 of {T.TList _ _val53 -> (Vector.fromList $ P.map (\_v54 -> (case _v54 of {T.TStruct _val55 -> (to_Annotation (T.TStruct _val55)); _ -> P.error "wrong type"})) _val53); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_AddAnnotations_args _ = P.error "not a struct"-read_AddAnnotations_args :: (T.Transport t, T.Protocol p) => p t -> P.IO AddAnnotations_args-read_AddAnnotations_args iprot = to_AddAnnotations_args <$> T.readVal iprot (T.T_STRUCT typemap_AddAnnotations_args)-decode_AddAnnotations_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddAnnotations_args-decode_AddAnnotations_args iprot bs = to_AddAnnotations_args $ T.deserializeVal iprot (T.T_STRUCT typemap_AddAnnotations_args) bs-typemap_AddAnnotations_args :: T.TypeMap-typemap_AddAnnotations_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("annotations",(T.T_LIST (T.T_STRUCT typemap_Annotation))))]-default_AddAnnotations_args :: AddAnnotations_args-default_AddAnnotations_args = AddAnnotations_args{- addAnnotations_args_sessionId = Uuid_Types.default_UUID,- addAnnotations_args_annotations = Vector.empty}-data AddAnnotations_result = AddAnnotations_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddAnnotations_result where- hashWithSalt salt record = salt -instance QC.Arbitrary AddAnnotations_result where - arbitrary = QC.elements [AddAnnotations_result]-from_AddAnnotations_result :: AddAnnotations_result -> T.ThriftVal-from_AddAnnotations_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_AddAnnotations_result :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_result -> P.IO ()-write_AddAnnotations_result oprot record = T.writeVal oprot $ from_AddAnnotations_result record-encode_AddAnnotations_result :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_result -> LBS.ByteString-encode_AddAnnotations_result oprot record = T.serializeVal oprot $ from_AddAnnotations_result record-to_AddAnnotations_result :: T.ThriftVal -> AddAnnotations_result-to_AddAnnotations_result (T.TStruct fields) = AddAnnotations_result{-- }-to_AddAnnotations_result _ = P.error "not a struct"-read_AddAnnotations_result :: (T.Transport t, T.Protocol p) => p t -> P.IO AddAnnotations_result-read_AddAnnotations_result iprot = to_AddAnnotations_result <$> T.readVal iprot (T.T_STRUCT typemap_AddAnnotations_result)-decode_AddAnnotations_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddAnnotations_result-decode_AddAnnotations_result iprot bs = to_AddAnnotations_result $ T.deserializeVal iprot (T.T_STRUCT typemap_AddAnnotations_result) bs-typemap_AddAnnotations_result :: T.TypeMap-typemap_AddAnnotations_result = Map.fromList []-default_AddAnnotations_result :: AddAnnotations_result-default_AddAnnotations_result = AddAnnotations_result{-}-process_start (seqid, iprot, oprot, handler) = do- args <- read_Start_args iprot- (X.catch- (do- val <- Iface.start handler (start_args_sessionId args) (start_args_task args) (start_args_contact args)- let res = default_Start_result{start_result_success = val}- T.writeMessageBegin oprot ("start", T.M_REPLY, seqid)- write_Start_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("start", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_stop (seqid, iprot, oprot, handler) = do- args <- read_Stop_args iprot- (X.catch- (do- Iface.stop handler (stop_args_sessionId args)- let res = default_Stop_result- T.writeMessageBegin oprot ("stop", T.M_REPLY, seqid)- write_Stop_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("stop", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_addAnnotations (seqid, iprot, oprot, handler) = do- args <- read_AddAnnotations_args iprot- (X.catch- (do- Iface.addAnnotations handler (addAnnotations_args_sessionId args) (addAnnotations_args_annotations args)- let res = default_AddAnnotations_result- T.writeMessageBegin oprot ("addAnnotations", T.M_REPLY, seqid)- write_AddAnnotations_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("addAnnotations", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "start" -> process_start (seqid,iprot,oprot,handler)- "stop" -> process_stop (seqid,iprot,oprot,handler)- "addAnnotations" -> process_addAnnotations (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/ActiveLearnerServerService_Client.hs
@@ -1,97 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ActiveLearnerServerService_Client(start,stop,addAnnotations) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types-import ActiveLearnerServerService-seqid = R.newIORef 0-start (ip,op) arg_sessionId arg_task arg_contact = do- send_start op arg_sessionId arg_task arg_contact- recv_start ip-send_start op arg_sessionId arg_task arg_contact = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("start", T.M_CALL, seqn)- write_Start_args op (Start_args{start_args_sessionId=arg_sessionId,start_args_task=arg_task,start_args_contact=arg_contact})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_start ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Start_result ip- T.readMessageEnd ip- P.return $ start_result_success res-stop (ip,op) arg_sessionId = do- send_stop op arg_sessionId- recv_stop ip-send_stop op arg_sessionId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("stop", T.M_CALL, seqn)- write_Stop_args op (Stop_args{stop_args_sessionId=arg_sessionId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_stop ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Stop_result ip- T.readMessageEnd ip- P.return ()-addAnnotations (ip,op) arg_sessionId arg_annotations = do- send_addAnnotations op arg_sessionId arg_annotations- recv_addAnnotations ip-send_addAnnotations op arg_sessionId arg_annotations = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("addAnnotations", T.M_CALL, seqn)- write_AddAnnotations_args op (AddAnnotations_args{addAnnotations_args_sessionId=arg_sessionId,addAnnotations_args_annotations=arg_annotations})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_addAnnotations ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_AddAnnotations_result ip- T.readMessageEnd ip- P.return ()
− src/ActiveLearnerServerService_Iface.hs
@@ -1,51 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ActiveLearnerServerService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types--import Service_Iface-class Service_Iface a => ActiveLearnerServerService_Iface a where- start :: a -> Uuid_Types.UUID -> AnnotationTask -> Services_Types.AsyncContactInfo -> P.IO P.Bool- stop :: a -> Uuid_Types.UUID -> P.IO ()- addAnnotations :: a -> Uuid_Types.UUID -> (Vector.Vector Annotation) -> P.IO ()
− src/AnnotateCommunicationService.hs
@@ -1,372 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module AnnotateCommunicationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types-import qualified AnnotateCommunicationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Annotate_args = Annotate_args { annotate_args_original :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Annotate_args where- hashWithSalt salt record = salt `H.hashWithSalt` annotate_args_original record -instance QC.Arbitrary Annotate_args where - arbitrary = M.liftM Annotate_args (QC.arbitrary)- shrink obj | obj == default_Annotate_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Annotate_args{annotate_args_original = annotate_args_original obj} then P.Nothing else P.Just $ default_Annotate_args{annotate_args_original = annotate_args_original obj}- ]-from_Annotate_args :: Annotate_args -> T.ThriftVal-from_Annotate_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("original",Communication_Types.from_Communication _v2))) $ annotate_args_original record- ]-write_Annotate_args :: (T.Protocol p, T.Transport t) => p t -> Annotate_args -> P.IO ()-write_Annotate_args oprot record = T.writeVal oprot $ from_Annotate_args record-encode_Annotate_args :: (T.Protocol p, T.Transport t) => p t -> Annotate_args -> LBS.ByteString-encode_Annotate_args oprot record = T.serializeVal oprot $ from_Annotate_args record-to_Annotate_args :: T.ThriftVal -> Annotate_args-to_Annotate_args (T.TStruct fields) = Annotate_args{- annotate_args_original = P.maybe (annotate_args_original default_Annotate_args) (\(_,_val4) -> (case _val4 of {T.TStruct _val5 -> (Communication_Types.to_Communication (T.TStruct _val5)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Annotate_args _ = P.error "not a struct"-read_Annotate_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Annotate_args-read_Annotate_args iprot = to_Annotate_args <$> T.readVal iprot (T.T_STRUCT typemap_Annotate_args)-decode_Annotate_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Annotate_args-decode_Annotate_args iprot bs = to_Annotate_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Annotate_args) bs-typemap_Annotate_args :: T.TypeMap-typemap_Annotate_args = Map.fromList [(1,("original",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_Annotate_args :: Annotate_args-default_Annotate_args = Annotate_args{- annotate_args_original = Communication_Types.default_Communication}-data Annotate_result = Annotate_result { annotate_result_success :: Communication_Types.Communication- , annotate_result_ex :: P.Maybe Ex_Types.ConcreteThriftException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Annotate_result where- hashWithSalt salt record = salt `H.hashWithSalt` annotate_result_success record `H.hashWithSalt` annotate_result_ex record -instance QC.Arbitrary Annotate_result where - arbitrary = M.liftM Annotate_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Annotate_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Annotate_result{annotate_result_success = annotate_result_success obj} then P.Nothing else P.Just $ default_Annotate_result{annotate_result_success = annotate_result_success obj}- , if obj == default_Annotate_result{annotate_result_ex = annotate_result_ex obj} then P.Nothing else P.Just $ default_Annotate_result{annotate_result_ex = annotate_result_ex obj}- ]-from_Annotate_result :: Annotate_result -> T.ThriftVal-from_Annotate_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v8 -> (1, ("ex",Ex_Types.from_ConcreteThriftException _v8))) <$> annotate_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v8 -> P.Just (0, ("success",Communication_Types.from_Communication _v8))) $ annotate_result_success record- , (\_v8 -> (1, ("ex",Ex_Types.from_ConcreteThriftException _v8))) <$> annotate_result_ex record- ]- )-write_Annotate_result :: (T.Protocol p, T.Transport t) => p t -> Annotate_result -> P.IO ()-write_Annotate_result oprot record = T.writeVal oprot $ from_Annotate_result record-encode_Annotate_result :: (T.Protocol p, T.Transport t) => p t -> Annotate_result -> LBS.ByteString-encode_Annotate_result oprot record = T.serializeVal oprot $ from_Annotate_result record-to_Annotate_result :: T.ThriftVal -> Annotate_result-to_Annotate_result (T.TStruct fields) = Annotate_result{- annotate_result_success = P.maybe (annotate_result_success default_Annotate_result) (\(_,_val10) -> (case _val10 of {T.TStruct _val11 -> (Communication_Types.to_Communication (T.TStruct _val11)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- annotate_result_ex = P.maybe (P.Nothing) (\(_,_val10) -> P.Just (case _val10 of {T.TStruct _val12 -> (Ex_Types.to_ConcreteThriftException (T.TStruct _val12)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Annotate_result _ = P.error "not a struct"-read_Annotate_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Annotate_result-read_Annotate_result iprot = to_Annotate_result <$> T.readVal iprot (T.T_STRUCT typemap_Annotate_result)-decode_Annotate_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Annotate_result-decode_Annotate_result iprot bs = to_Annotate_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Annotate_result) bs-typemap_Annotate_result :: T.TypeMap-typemap_Annotate_result = Map.fromList [(0,("success",(T.T_STRUCT Communication_Types.typemap_Communication))),(1,("ex",(T.T_STRUCT Ex_Types.typemap_ConcreteThriftException)))]-default_Annotate_result :: Annotate_result-default_Annotate_result = Annotate_result{- annotate_result_success = Communication_Types.default_Communication,- annotate_result_ex = P.Nothing}-data GetMetadata_args = GetMetadata_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetMetadata_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetMetadata_args where - arbitrary = QC.elements [GetMetadata_args]-from_GetMetadata_args :: GetMetadata_args -> T.ThriftVal-from_GetMetadata_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetMetadata_args :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_args -> P.IO ()-write_GetMetadata_args oprot record = T.writeVal oprot $ from_GetMetadata_args record-encode_GetMetadata_args :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_args -> LBS.ByteString-encode_GetMetadata_args oprot record = T.serializeVal oprot $ from_GetMetadata_args record-to_GetMetadata_args :: T.ThriftVal -> GetMetadata_args-to_GetMetadata_args (T.TStruct fields) = GetMetadata_args{-- }-to_GetMetadata_args _ = P.error "not a struct"-read_GetMetadata_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetMetadata_args-read_GetMetadata_args iprot = to_GetMetadata_args <$> T.readVal iprot (T.T_STRUCT typemap_GetMetadata_args)-decode_GetMetadata_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetMetadata_args-decode_GetMetadata_args iprot bs = to_GetMetadata_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetMetadata_args) bs-typemap_GetMetadata_args :: T.TypeMap-typemap_GetMetadata_args = Map.fromList []-default_GetMetadata_args :: GetMetadata_args-default_GetMetadata_args = GetMetadata_args{-}-data GetMetadata_result = GetMetadata_result { getMetadata_result_success :: Metadata_Types.AnnotationMetadata- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetMetadata_result where- hashWithSalt salt record = salt `H.hashWithSalt` getMetadata_result_success record -instance QC.Arbitrary GetMetadata_result where - arbitrary = M.liftM GetMetadata_result (QC.arbitrary)- shrink obj | obj == default_GetMetadata_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetMetadata_result{getMetadata_result_success = getMetadata_result_success obj} then P.Nothing else P.Just $ default_GetMetadata_result{getMetadata_result_success = getMetadata_result_success obj}- ]-from_GetMetadata_result :: GetMetadata_result -> T.ThriftVal-from_GetMetadata_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v20 -> P.Just (0, ("success",Metadata_Types.from_AnnotationMetadata _v20))) $ getMetadata_result_success record- ]-write_GetMetadata_result :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_result -> P.IO ()-write_GetMetadata_result oprot record = T.writeVal oprot $ from_GetMetadata_result record-encode_GetMetadata_result :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_result -> LBS.ByteString-encode_GetMetadata_result oprot record = T.serializeVal oprot $ from_GetMetadata_result record-to_GetMetadata_result :: T.ThriftVal -> GetMetadata_result-to_GetMetadata_result (T.TStruct fields) = GetMetadata_result{- getMetadata_result_success = P.maybe (getMetadata_result_success default_GetMetadata_result) (\(_,_val22) -> (case _val22 of {T.TStruct _val23 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val23)); _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_GetMetadata_result _ = P.error "not a struct"-read_GetMetadata_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetMetadata_result-read_GetMetadata_result iprot = to_GetMetadata_result <$> T.readVal iprot (T.T_STRUCT typemap_GetMetadata_result)-decode_GetMetadata_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetMetadata_result-decode_GetMetadata_result iprot bs = to_GetMetadata_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetMetadata_result) bs-typemap_GetMetadata_result :: T.TypeMap-typemap_GetMetadata_result = Map.fromList [(0,("success",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata)))]-default_GetMetadata_result :: GetMetadata_result-default_GetMetadata_result = GetMetadata_result{- getMetadata_result_success = Metadata_Types.default_AnnotationMetadata}-data GetDocumentation_args = GetDocumentation_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetDocumentation_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetDocumentation_args where - arbitrary = QC.elements [GetDocumentation_args]-from_GetDocumentation_args :: GetDocumentation_args -> T.ThriftVal-from_GetDocumentation_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetDocumentation_args :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_args -> P.IO ()-write_GetDocumentation_args oprot record = T.writeVal oprot $ from_GetDocumentation_args record-encode_GetDocumentation_args :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_args -> LBS.ByteString-encode_GetDocumentation_args oprot record = T.serializeVal oprot $ from_GetDocumentation_args record-to_GetDocumentation_args :: T.ThriftVal -> GetDocumentation_args-to_GetDocumentation_args (T.TStruct fields) = GetDocumentation_args{-- }-to_GetDocumentation_args _ = P.error "not a struct"-read_GetDocumentation_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetDocumentation_args-read_GetDocumentation_args iprot = to_GetDocumentation_args <$> T.readVal iprot (T.T_STRUCT typemap_GetDocumentation_args)-decode_GetDocumentation_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetDocumentation_args-decode_GetDocumentation_args iprot bs = to_GetDocumentation_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetDocumentation_args) bs-typemap_GetDocumentation_args :: T.TypeMap-typemap_GetDocumentation_args = Map.fromList []-default_GetDocumentation_args :: GetDocumentation_args-default_GetDocumentation_args = GetDocumentation_args{-}-data GetDocumentation_result = GetDocumentation_result { getDocumentation_result_success :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetDocumentation_result where- hashWithSalt salt record = salt `H.hashWithSalt` getDocumentation_result_success record -instance QC.Arbitrary GetDocumentation_result where - arbitrary = M.liftM GetDocumentation_result (QC.arbitrary)- shrink obj | obj == default_GetDocumentation_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetDocumentation_result{getDocumentation_result_success = getDocumentation_result_success obj} then P.Nothing else P.Just $ default_GetDocumentation_result{getDocumentation_result_success = getDocumentation_result_success obj}- ]-from_GetDocumentation_result :: GetDocumentation_result -> T.ThriftVal-from_GetDocumentation_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v31 -> P.Just (0, ("success",T.TString $ E.encodeUtf8 _v31))) $ getDocumentation_result_success record- ]-write_GetDocumentation_result :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_result -> P.IO ()-write_GetDocumentation_result oprot record = T.writeVal oprot $ from_GetDocumentation_result record-encode_GetDocumentation_result :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_result -> LBS.ByteString-encode_GetDocumentation_result oprot record = T.serializeVal oprot $ from_GetDocumentation_result record-to_GetDocumentation_result :: T.ThriftVal -> GetDocumentation_result-to_GetDocumentation_result (T.TStruct fields) = GetDocumentation_result{- getDocumentation_result_success = P.maybe (getDocumentation_result_success default_GetDocumentation_result) (\(_,_val33) -> (case _val33 of {T.TString _val34 -> E.decodeUtf8 _val34; _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_GetDocumentation_result _ = P.error "not a struct"-read_GetDocumentation_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetDocumentation_result-read_GetDocumentation_result iprot = to_GetDocumentation_result <$> T.readVal iprot (T.T_STRUCT typemap_GetDocumentation_result)-decode_GetDocumentation_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetDocumentation_result-decode_GetDocumentation_result iprot bs = to_GetDocumentation_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetDocumentation_result) bs-typemap_GetDocumentation_result :: T.TypeMap-typemap_GetDocumentation_result = Map.fromList [(0,("success",T.T_STRING))]-default_GetDocumentation_result :: GetDocumentation_result-default_GetDocumentation_result = GetDocumentation_result{- getDocumentation_result_success = ""}-data Shutdown_args = Shutdown_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Shutdown_args where- hashWithSalt salt record = salt -instance QC.Arbitrary Shutdown_args where - arbitrary = QC.elements [Shutdown_args]-from_Shutdown_args :: Shutdown_args -> T.ThriftVal-from_Shutdown_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Shutdown_args :: (T.Protocol p, T.Transport t) => p t -> Shutdown_args -> P.IO ()-write_Shutdown_args oprot record = T.writeVal oprot $ from_Shutdown_args record-encode_Shutdown_args :: (T.Protocol p, T.Transport t) => p t -> Shutdown_args -> LBS.ByteString-encode_Shutdown_args oprot record = T.serializeVal oprot $ from_Shutdown_args record-to_Shutdown_args :: T.ThriftVal -> Shutdown_args-to_Shutdown_args (T.TStruct fields) = Shutdown_args{-- }-to_Shutdown_args _ = P.error "not a struct"-read_Shutdown_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Shutdown_args-read_Shutdown_args iprot = to_Shutdown_args <$> T.readVal iprot (T.T_STRUCT typemap_Shutdown_args)-decode_Shutdown_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Shutdown_args-decode_Shutdown_args iprot bs = to_Shutdown_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Shutdown_args) bs-typemap_Shutdown_args :: T.TypeMap-typemap_Shutdown_args = Map.fromList []-default_Shutdown_args :: Shutdown_args-default_Shutdown_args = Shutdown_args{-}-data Shutdown_result = Shutdown_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Shutdown_result where- hashWithSalt salt record = salt -instance QC.Arbitrary Shutdown_result where - arbitrary = QC.elements [Shutdown_result]-from_Shutdown_result :: Shutdown_result -> T.ThriftVal-from_Shutdown_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Shutdown_result :: (T.Protocol p, T.Transport t) => p t -> Shutdown_result -> P.IO ()-write_Shutdown_result oprot record = T.writeVal oprot $ from_Shutdown_result record-encode_Shutdown_result :: (T.Protocol p, T.Transport t) => p t -> Shutdown_result -> LBS.ByteString-encode_Shutdown_result oprot record = T.serializeVal oprot $ from_Shutdown_result record-to_Shutdown_result :: T.ThriftVal -> Shutdown_result-to_Shutdown_result (T.TStruct fields) = Shutdown_result{-- }-to_Shutdown_result _ = P.error "not a struct"-read_Shutdown_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Shutdown_result-read_Shutdown_result iprot = to_Shutdown_result <$> T.readVal iprot (T.T_STRUCT typemap_Shutdown_result)-decode_Shutdown_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Shutdown_result-decode_Shutdown_result iprot bs = to_Shutdown_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Shutdown_result) bs-typemap_Shutdown_result :: T.TypeMap-typemap_Shutdown_result = Map.fromList []-default_Shutdown_result :: Shutdown_result-default_Shutdown_result = Shutdown_result{-}-process_annotate (seqid, iprot, oprot, handler) = do- args <- read_Annotate_args iprot- (X.catch- (X.catch- (do- val <- Iface.annotate handler (annotate_args_original args)- let res = default_Annotate_result{annotate_result_success = val}- T.writeMessageBegin oprot ("annotate", T.M_REPLY, seqid)- write_Annotate_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Annotate_result{annotate_result_ex = P.Just e}- T.writeMessageBegin oprot ("annotate", T.M_REPLY, seqid)- write_Annotate_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("annotate", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getMetadata (seqid, iprot, oprot, handler) = do- args <- read_GetMetadata_args iprot- (X.catch- (do- val <- Iface.getMetadata handler- let res = default_GetMetadata_result{getMetadata_result_success = val}- T.writeMessageBegin oprot ("getMetadata", T.M_REPLY, seqid)- write_GetMetadata_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("getMetadata", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getDocumentation (seqid, iprot, oprot, handler) = do- args <- read_GetDocumentation_args iprot- (X.catch- (do- val <- Iface.getDocumentation handler- let res = default_GetDocumentation_result{getDocumentation_result_success = val}- T.writeMessageBegin oprot ("getDocumentation", T.M_REPLY, seqid)- write_GetDocumentation_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("getDocumentation", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_shutdown (seqid, iprot, oprot, handler) = do- args <- read_Shutdown_args iprot- (X.catch- (do- Iface.shutdown handler- P.return ())- ((\_ -> do- P.return ()) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "annotate" -> process_annotate (seqid,iprot,oprot,handler)- "getMetadata" -> process_getMetadata (seqid,iprot,oprot,handler)- "getDocumentation" -> process_getDocumentation (seqid,iprot,oprot,handler)- "shutdown" -> process_shutdown (seqid,iprot,oprot,handler)- _ -> do- _ <- T.readVal iprot (T.T_STRUCT Map.empty)- T.writeMessageBegin oprot (name,T.M_EXCEPTION,seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN_METHOD ("Unknown function " ++ LT.unpack name))- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/AnnotateCommunicationService_Client.hs
@@ -1,113 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module AnnotateCommunicationService_Client(annotate,getMetadata,getDocumentation,shutdown) where-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types-import AnnotateCommunicationService-seqid = R.newIORef 0-annotate (ip,op) arg_original = do- send_annotate op arg_original- recv_annotate ip-send_annotate op arg_original = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("annotate", T.M_CALL, seqn)- write_Annotate_args op (Annotate_args{annotate_args_original=arg_original})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_annotate ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Annotate_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (annotate_result_ex res)- P.return $ annotate_result_success res-getMetadata (ip,op) = do- send_getMetadata op- recv_getMetadata ip-send_getMetadata op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getMetadata", T.M_CALL, seqn)- write_GetMetadata_args op (GetMetadata_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getMetadata ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetMetadata_result ip- T.readMessageEnd ip- P.return $ getMetadata_result_success res-getDocumentation (ip,op) = do- send_getDocumentation op- recv_getDocumentation ip-send_getDocumentation op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getDocumentation", T.M_CALL, seqn)- write_GetDocumentation_args op (GetDocumentation_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getDocumentation ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetDocumentation_result ip- T.readMessageEnd ip- P.return $ getDocumentation_result_success res-shutdown (ip,op) = do- send_shutdown op-send_shutdown op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("shutdown", T.M_ONEWAY, seqn)- write_Shutdown_args op (Shutdown_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)
− src/AnnotateCommunicationService_Iface.hs
@@ -1,58 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module AnnotateCommunicationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types--class AnnotateCommunicationService_Iface a where- annotate :: a -> Communication_Types.Communication -> P.IO Communication_Types.Communication- getMetadata :: a -> P.IO Metadata_Types.AnnotationMetadata- getDocumentation :: a -> P.IO LT.Text- shutdown :: a -> P.IO ()
− src/Annotate_Consts.hs
@@ -1,52 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Annotate_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types
− src/Annotate_Types.hs
@@ -1,51 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Annotate_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types--
− src/Audio_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Audio_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Audio_Types
− src/Audio_Types.hs
@@ -1,90 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Audio_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data Sound = Sound { sound_wav :: P.Maybe LBS.ByteString- , sound_mp3 :: P.Maybe LBS.ByteString- , sound_sph :: P.Maybe LBS.ByteString- , sound_path :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Sound where- hashWithSalt salt record = salt `H.hashWithSalt` sound_wav record `H.hashWithSalt` sound_mp3 record `H.hashWithSalt` sound_sph record `H.hashWithSalt` sound_path record -instance QC.Arbitrary Sound where - arbitrary = M.liftM Sound (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Sound = []- | P.otherwise = M.catMaybes- [ if obj == default_Sound{sound_wav = sound_wav obj} then P.Nothing else P.Just $ default_Sound{sound_wav = sound_wav obj}- , if obj == default_Sound{sound_mp3 = sound_mp3 obj} then P.Nothing else P.Just $ default_Sound{sound_mp3 = sound_mp3 obj}- , if obj == default_Sound{sound_sph = sound_sph obj} then P.Nothing else P.Just $ default_Sound{sound_sph = sound_sph obj}- , if obj == default_Sound{sound_path = sound_path obj} then P.Nothing else P.Just $ default_Sound{sound_path = sound_path obj}- ]-from_Sound :: Sound -> T.ThriftVal-from_Sound record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("wav",T.TBinary _v2))) <$> sound_wav record- , (\_v2 -> (2, ("mp3",T.TBinary _v2))) <$> sound_mp3 record- , (\_v2 -> (3, ("sph",T.TBinary _v2))) <$> sound_sph record- , (\_v2 -> (4, ("path",T.TString $ E.encodeUtf8 _v2))) <$> sound_path record- ]-write_Sound :: (T.Protocol p, T.Transport t) => p t -> Sound -> P.IO ()-write_Sound oprot record = T.writeVal oprot $ from_Sound record-encode_Sound :: (T.Protocol p, T.Transport t) => p t -> Sound -> LBS.ByteString-encode_Sound oprot record = T.serializeVal oprot $ from_Sound record-to_Sound :: T.ThriftVal -> Sound-to_Sound (T.TStruct fields) = Sound{- sound_wav = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBinary _val5 -> _val5; T.TString _val5 -> _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- sound_mp3 = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBinary _val6 -> _val6; T.TString _val6 -> _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- sound_sph = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBinary _val7 -> _val7; T.TString _val7 -> _val7; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- sound_path = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val8 -> E.decodeUtf8 _val8; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_Sound _ = P.error "not a struct"-read_Sound :: (T.Transport t, T.Protocol p) => p t -> P.IO Sound-read_Sound iprot = to_Sound <$> T.readVal iprot (T.T_STRUCT typemap_Sound)-decode_Sound :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Sound-decode_Sound iprot bs = to_Sound $ T.deserializeVal iprot (T.T_STRUCT typemap_Sound) bs-typemap_Sound :: T.TypeMap-typemap_Sound = Map.fromList [(1,("wav",T.T_BINARY)),(2,("mp3",T.T_BINARY)),(3,("sph",T.T_BINARY)),(4,("path",T.T_STRING))]-default_Sound :: Sound-default_Sound = Sound{- sound_wav = P.Nothing,- sound_mp3 = P.Nothing,- sound_sph = P.Nothing,- sound_path = P.Nothing}
− src/Cluster_Consts.hs
@@ -1,44 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Cluster_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Metadata_Types---import Cluster_Types
− src/Cluster_Types.hs
@@ -1,187 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Cluster_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Metadata_Types---data ClusterMember = ClusterMember { clusterMember_communicationId :: Uuid_Types.UUID- , clusterMember_setId :: Uuid_Types.UUID- , clusterMember_elementId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable ClusterMember where- hashWithSalt salt record = salt `H.hashWithSalt` clusterMember_communicationId record `H.hashWithSalt` clusterMember_setId record `H.hashWithSalt` clusterMember_elementId record -instance QC.Arbitrary ClusterMember where - arbitrary = M.liftM ClusterMember (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_ClusterMember = []- | P.otherwise = M.catMaybes- [ if obj == default_ClusterMember{clusterMember_communicationId = clusterMember_communicationId obj} then P.Nothing else P.Just $ default_ClusterMember{clusterMember_communicationId = clusterMember_communicationId obj}- , if obj == default_ClusterMember{clusterMember_setId = clusterMember_setId obj} then P.Nothing else P.Just $ default_ClusterMember{clusterMember_setId = clusterMember_setId obj}- , if obj == default_ClusterMember{clusterMember_elementId = clusterMember_elementId obj} then P.Nothing else P.Just $ default_ClusterMember{clusterMember_elementId = clusterMember_elementId obj}- ]-from_ClusterMember :: ClusterMember -> T.ThriftVal-from_ClusterMember record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("communicationId",Uuid_Types.from_UUID _v2))) $ clusterMember_communicationId record- , (\_v2 -> P.Just (2, ("setId",Uuid_Types.from_UUID _v2))) $ clusterMember_setId record- , (\_v2 -> P.Just (3, ("elementId",Uuid_Types.from_UUID _v2))) $ clusterMember_elementId record- ]-write_ClusterMember :: (T.Protocol p, T.Transport t) => p t -> ClusterMember -> P.IO ()-write_ClusterMember oprot record = T.writeVal oprot $ from_ClusterMember record-encode_ClusterMember :: (T.Protocol p, T.Transport t) => p t -> ClusterMember -> LBS.ByteString-encode_ClusterMember oprot record = T.serializeVal oprot $ from_ClusterMember record-to_ClusterMember :: T.ThriftVal -> ClusterMember-to_ClusterMember (T.TStruct fields) = ClusterMember{- clusterMember_communicationId = P.maybe (P.error "Missing required field: communicationId") (\(_,_val4) -> (case _val4 of {T.TStruct _val5 -> (Uuid_Types.to_UUID (T.TStruct _val5)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- clusterMember_setId = P.maybe (P.error "Missing required field: setId") (\(_,_val4) -> (case _val4 of {T.TStruct _val6 -> (Uuid_Types.to_UUID (T.TStruct _val6)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- clusterMember_elementId = P.maybe (P.error "Missing required field: elementId") (\(_,_val4) -> (case _val4 of {T.TStruct _val7 -> (Uuid_Types.to_UUID (T.TStruct _val7)); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_ClusterMember _ = P.error "not a struct"-read_ClusterMember :: (T.Transport t, T.Protocol p) => p t -> P.IO ClusterMember-read_ClusterMember iprot = to_ClusterMember <$> T.readVal iprot (T.T_STRUCT typemap_ClusterMember)-decode_ClusterMember :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> ClusterMember-decode_ClusterMember iprot bs = to_ClusterMember $ T.deserializeVal iprot (T.T_STRUCT typemap_ClusterMember) bs-typemap_ClusterMember :: T.TypeMap-typemap_ClusterMember = Map.fromList [(1,("communicationId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("setId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("elementId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_ClusterMember :: ClusterMember-default_ClusterMember = ClusterMember{- clusterMember_communicationId = Uuid_Types.default_UUID,- clusterMember_setId = Uuid_Types.default_UUID,- clusterMember_elementId = Uuid_Types.default_UUID}-data Cluster = Cluster { cluster_clusterMemberIndexList :: P.Maybe (Vector.Vector I.Int32)- , cluster_confidenceList :: P.Maybe (Vector.Vector P.Double)- , cluster_childIndexList :: P.Maybe (Vector.Vector I.Int32)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Cluster where- hashWithSalt salt record = salt `H.hashWithSalt` cluster_clusterMemberIndexList record `H.hashWithSalt` cluster_confidenceList record `H.hashWithSalt` cluster_childIndexList record -instance QC.Arbitrary Cluster where - arbitrary = M.liftM Cluster (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Cluster = []- | P.otherwise = M.catMaybes- [ if obj == default_Cluster{cluster_clusterMemberIndexList = cluster_clusterMemberIndexList obj} then P.Nothing else P.Just $ default_Cluster{cluster_clusterMemberIndexList = cluster_clusterMemberIndexList obj}- , if obj == default_Cluster{cluster_confidenceList = cluster_confidenceList obj} then P.Nothing else P.Just $ default_Cluster{cluster_confidenceList = cluster_confidenceList obj}- , if obj == default_Cluster{cluster_childIndexList = cluster_childIndexList obj} then P.Nothing else P.Just $ default_Cluster{cluster_childIndexList = cluster_childIndexList obj}- ]-from_Cluster :: Cluster -> T.ThriftVal-from_Cluster record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v10 -> (1, ("clusterMemberIndexList",T.TList T.T_I32 $ P.map (\_v12 -> T.TI32 _v12) $ Vector.toList _v10))) <$> cluster_clusterMemberIndexList record- , (\_v10 -> (2, ("confidenceList",T.TList T.T_DOUBLE $ P.map (\_v14 -> T.TDouble _v14) $ Vector.toList _v10))) <$> cluster_confidenceList record- , (\_v10 -> (3, ("childIndexList",T.TList T.T_I32 $ P.map (\_v16 -> T.TI32 _v16) $ Vector.toList _v10))) <$> cluster_childIndexList record- ]-write_Cluster :: (T.Protocol p, T.Transport t) => p t -> Cluster -> P.IO ()-write_Cluster oprot record = T.writeVal oprot $ from_Cluster record-encode_Cluster :: (T.Protocol p, T.Transport t) => p t -> Cluster -> LBS.ByteString-encode_Cluster oprot record = T.serializeVal oprot $ from_Cluster record-to_Cluster :: T.ThriftVal -> Cluster-to_Cluster (T.TStruct fields) = Cluster{- cluster_clusterMemberIndexList = P.maybe (P.Nothing) (\(_,_val18) -> P.Just (case _val18 of {T.TList _ _val19 -> (Vector.fromList $ P.map (\_v20 -> (case _v20 of {T.TI32 _val21 -> _val21; _ -> P.error "wrong type"})) _val19); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- cluster_confidenceList = P.maybe (P.Nothing) (\(_,_val18) -> P.Just (case _val18 of {T.TList _ _val22 -> (Vector.fromList $ P.map (\_v23 -> (case _v23 of {T.TDouble _val24 -> _val24; _ -> P.error "wrong type"})) _val22); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- cluster_childIndexList = P.maybe (P.Nothing) (\(_,_val18) -> P.Just (case _val18 of {T.TList _ _val25 -> (Vector.fromList $ P.map (\_v26 -> (case _v26 of {T.TI32 _val27 -> _val27; _ -> P.error "wrong type"})) _val25); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Cluster _ = P.error "not a struct"-read_Cluster :: (T.Transport t, T.Protocol p) => p t -> P.IO Cluster-read_Cluster iprot = to_Cluster <$> T.readVal iprot (T.T_STRUCT typemap_Cluster)-decode_Cluster :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Cluster-decode_Cluster iprot bs = to_Cluster $ T.deserializeVal iprot (T.T_STRUCT typemap_Cluster) bs-typemap_Cluster :: T.TypeMap-typemap_Cluster = Map.fromList [(1,("clusterMemberIndexList",(T.T_LIST T.T_I32))),(2,("confidenceList",(T.T_LIST T.T_DOUBLE))),(3,("childIndexList",(T.T_LIST T.T_I32)))]-default_Cluster :: Cluster-default_Cluster = Cluster{- cluster_clusterMemberIndexList = P.Nothing,- cluster_confidenceList = P.Nothing,- cluster_childIndexList = P.Nothing}-data Clustering = Clustering { clustering_uuid :: Uuid_Types.UUID- , clustering_metadata :: Metadata_Types.AnnotationMetadata- , clustering_clusterMemberList :: P.Maybe (Vector.Vector ClusterMember)- , clustering_clusterList :: P.Maybe (Vector.Vector Cluster)- , clustering_rootClusterIndexList :: P.Maybe (Vector.Vector I.Int32)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Clustering where- hashWithSalt salt record = salt `H.hashWithSalt` clustering_uuid record `H.hashWithSalt` clustering_metadata record `H.hashWithSalt` clustering_clusterMemberList record `H.hashWithSalt` clustering_clusterList record `H.hashWithSalt` clustering_rootClusterIndexList record -instance QC.Arbitrary Clustering where - arbitrary = M.liftM Clustering (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Clustering = []- | P.otherwise = M.catMaybes- [ if obj == default_Clustering{clustering_uuid = clustering_uuid obj} then P.Nothing else P.Just $ default_Clustering{clustering_uuid = clustering_uuid obj}- , if obj == default_Clustering{clustering_metadata = clustering_metadata obj} then P.Nothing else P.Just $ default_Clustering{clustering_metadata = clustering_metadata obj}- , if obj == default_Clustering{clustering_clusterMemberList = clustering_clusterMemberList obj} then P.Nothing else P.Just $ default_Clustering{clustering_clusterMemberList = clustering_clusterMemberList obj}- , if obj == default_Clustering{clustering_clusterList = clustering_clusterList obj} then P.Nothing else P.Just $ default_Clustering{clustering_clusterList = clustering_clusterList obj}- , if obj == default_Clustering{clustering_rootClusterIndexList = clustering_rootClusterIndexList obj} then P.Nothing else P.Just $ default_Clustering{clustering_rootClusterIndexList = clustering_rootClusterIndexList obj}- ]-from_Clustering :: Clustering -> T.ThriftVal-from_Clustering record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v30 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v30))) $ clustering_uuid record- , (\_v30 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v30))) $ clustering_metadata record- , (\_v30 -> (3, ("clusterMemberList",T.TList (T.T_STRUCT typemap_ClusterMember) $ P.map (\_v32 -> from_ClusterMember _v32) $ Vector.toList _v30))) <$> clustering_clusterMemberList record- , (\_v30 -> (4, ("clusterList",T.TList (T.T_STRUCT typemap_Cluster) $ P.map (\_v34 -> from_Cluster _v34) $ Vector.toList _v30))) <$> clustering_clusterList record- , (\_v30 -> (5, ("rootClusterIndexList",T.TList T.T_I32 $ P.map (\_v36 -> T.TI32 _v36) $ Vector.toList _v30))) <$> clustering_rootClusterIndexList record- ]-write_Clustering :: (T.Protocol p, T.Transport t) => p t -> Clustering -> P.IO ()-write_Clustering oprot record = T.writeVal oprot $ from_Clustering record-encode_Clustering :: (T.Protocol p, T.Transport t) => p t -> Clustering -> LBS.ByteString-encode_Clustering oprot record = T.serializeVal oprot $ from_Clustering record-to_Clustering :: T.ThriftVal -> Clustering-to_Clustering (T.TStruct fields) = Clustering{- clustering_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val38) -> (case _val38 of {T.TStruct _val39 -> (Uuid_Types.to_UUID (T.TStruct _val39)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- clustering_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val38) -> (case _val38 of {T.TStruct _val40 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val40)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- clustering_clusterMemberList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val41 -> (Vector.fromList $ P.map (\_v42 -> (case _v42 of {T.TStruct _val43 -> (to_ClusterMember (T.TStruct _val43)); _ -> P.error "wrong type"})) _val41); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- clustering_clusterList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val44 -> (Vector.fromList $ P.map (\_v45 -> (case _v45 of {T.TStruct _val46 -> (to_Cluster (T.TStruct _val46)); _ -> P.error "wrong type"})) _val44); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- clustering_rootClusterIndexList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val47 -> (Vector.fromList $ P.map (\_v48 -> (case _v48 of {T.TI32 _val49 -> _val49; _ -> P.error "wrong type"})) _val47); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_Clustering _ = P.error "not a struct"-read_Clustering :: (T.Transport t, T.Protocol p) => p t -> P.IO Clustering-read_Clustering iprot = to_Clustering <$> T.readVal iprot (T.T_STRUCT typemap_Clustering)-decode_Clustering :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Clustering-decode_Clustering iprot bs = to_Clustering $ T.deserializeVal iprot (T.T_STRUCT typemap_Clustering) bs-typemap_Clustering :: T.TypeMap-typemap_Clustering = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("clusterMemberList",(T.T_LIST (T.T_STRUCT typemap_ClusterMember)))),(4,("clusterList",(T.T_LIST (T.T_STRUCT typemap_Cluster)))),(5,("rootClusterIndexList",(T.T_LIST T.T_I32)))]-default_Clustering :: Clustering-default_Clustering = Clustering{- clustering_uuid = Uuid_Types.default_UUID,- clustering_metadata = Metadata_Types.default_AnnotationMetadata,- clustering_clusterMemberList = P.Nothing,- clustering_clusterList = P.Nothing,- clustering_rootClusterIndexList = P.Nothing}
− src/Communication_Consts.hs
@@ -1,50 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Communication_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Audio_Types-import qualified Metadata_Types-import qualified Cluster_Types---import Communication_Types
− src/Communication_Types.hs
@@ -1,301 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Communication_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Audio_Types-import qualified Metadata_Types-import qualified Cluster_Types---data CommunicationTagging = CommunicationTagging { communicationTagging_uuid :: Uuid_Types.UUID- , communicationTagging_metadata :: Metadata_Types.AnnotationMetadata- , communicationTagging_taggingType :: LT.Text- , communicationTagging_tagList :: P.Maybe (Vector.Vector LT.Text)- , communicationTagging_confidenceList :: P.Maybe (Vector.Vector P.Double)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable CommunicationTagging where- hashWithSalt salt record = salt `H.hashWithSalt` communicationTagging_uuid record `H.hashWithSalt` communicationTagging_metadata record `H.hashWithSalt` communicationTagging_taggingType record `H.hashWithSalt` communicationTagging_tagList record `H.hashWithSalt` communicationTagging_confidenceList record -instance QC.Arbitrary CommunicationTagging where - arbitrary = M.liftM CommunicationTagging (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_CommunicationTagging = []- | P.otherwise = M.catMaybes- [ if obj == default_CommunicationTagging{communicationTagging_uuid = communicationTagging_uuid obj} then P.Nothing else P.Just $ default_CommunicationTagging{communicationTagging_uuid = communicationTagging_uuid obj}- , if obj == default_CommunicationTagging{communicationTagging_metadata = communicationTagging_metadata obj} then P.Nothing else P.Just $ default_CommunicationTagging{communicationTagging_metadata = communicationTagging_metadata obj}- , if obj == default_CommunicationTagging{communicationTagging_taggingType = communicationTagging_taggingType obj} then P.Nothing else P.Just $ default_CommunicationTagging{communicationTagging_taggingType = communicationTagging_taggingType obj}- , if obj == default_CommunicationTagging{communicationTagging_tagList = communicationTagging_tagList obj} then P.Nothing else P.Just $ default_CommunicationTagging{communicationTagging_tagList = communicationTagging_tagList obj}- , if obj == default_CommunicationTagging{communicationTagging_confidenceList = communicationTagging_confidenceList obj} then P.Nothing else P.Just $ default_CommunicationTagging{communicationTagging_confidenceList = communicationTagging_confidenceList obj}- ]-from_CommunicationTagging :: CommunicationTagging -> T.ThriftVal-from_CommunicationTagging record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v2))) $ communicationTagging_uuid record- , (\_v2 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v2))) $ communicationTagging_metadata record- , (\_v2 -> P.Just (3, ("taggingType",T.TString $ E.encodeUtf8 _v2))) $ communicationTagging_taggingType record- , (\_v2 -> (4, ("tagList",T.TList T.T_STRING $ P.map (\_v4 -> T.TString $ E.encodeUtf8 _v4) $ Vector.toList _v2))) <$> communicationTagging_tagList record- , (\_v2 -> (5, ("confidenceList",T.TList T.T_DOUBLE $ P.map (\_v6 -> T.TDouble _v6) $ Vector.toList _v2))) <$> communicationTagging_confidenceList record- ]-write_CommunicationTagging :: (T.Protocol p, T.Transport t) => p t -> CommunicationTagging -> P.IO ()-write_CommunicationTagging oprot record = T.writeVal oprot $ from_CommunicationTagging record-encode_CommunicationTagging :: (T.Protocol p, T.Transport t) => p t -> CommunicationTagging -> LBS.ByteString-encode_CommunicationTagging oprot record = T.serializeVal oprot $ from_CommunicationTagging record-to_CommunicationTagging :: T.ThriftVal -> CommunicationTagging-to_CommunicationTagging (T.TStruct fields) = CommunicationTagging{- communicationTagging_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val8) -> (case _val8 of {T.TStruct _val9 -> (Uuid_Types.to_UUID (T.TStruct _val9)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- communicationTagging_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val8) -> (case _val8 of {T.TStruct _val10 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val10)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- communicationTagging_taggingType = P.maybe (P.error "Missing required field: taggingType") (\(_,_val8) -> (case _val8 of {T.TString _val11 -> E.decodeUtf8 _val11; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- communicationTagging_tagList = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TList _ _val12 -> (Vector.fromList $ P.map (\_v13 -> (case _v13 of {T.TString _val14 -> E.decodeUtf8 _val14; _ -> P.error "wrong type"})) _val12); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- communicationTagging_confidenceList = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TList _ _val15 -> (Vector.fromList $ P.map (\_v16 -> (case _v16 of {T.TDouble _val17 -> _val17; _ -> P.error "wrong type"})) _val15); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_CommunicationTagging _ = P.error "not a struct"-read_CommunicationTagging :: (T.Transport t, T.Protocol p) => p t -> P.IO CommunicationTagging-read_CommunicationTagging iprot = to_CommunicationTagging <$> T.readVal iprot (T.T_STRUCT typemap_CommunicationTagging)-decode_CommunicationTagging :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> CommunicationTagging-decode_CommunicationTagging iprot bs = to_CommunicationTagging $ T.deserializeVal iprot (T.T_STRUCT typemap_CommunicationTagging) bs-typemap_CommunicationTagging :: T.TypeMap-typemap_CommunicationTagging = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("taggingType",T.T_STRING)),(4,("tagList",(T.T_LIST T.T_STRING))),(5,("confidenceList",(T.T_LIST T.T_DOUBLE)))]-default_CommunicationTagging :: CommunicationTagging-default_CommunicationTagging = CommunicationTagging{- communicationTagging_uuid = Uuid_Types.default_UUID,- communicationTagging_metadata = Metadata_Types.default_AnnotationMetadata,- communicationTagging_taggingType = "",- communicationTagging_tagList = P.Nothing,- communicationTagging_confidenceList = P.Nothing}-data Communication = Communication { communication_id :: LT.Text- , communication_uuid :: Uuid_Types.UUID- , communication_type :: LT.Text- , communication_text :: P.Maybe LT.Text- , communication_startTime :: P.Maybe I.Int64- , communication_endTime :: P.Maybe I.Int64- , communication_communicationTaggingList :: P.Maybe (Vector.Vector CommunicationTagging)- , communication_metadata :: Metadata_Types.AnnotationMetadata- , communication_keyValueMap :: P.Maybe (Map.HashMap LT.Text LT.Text)- , communication_lidList :: P.Maybe (Vector.Vector Language_Types.LanguageIdentification)- , communication_sectionList :: P.Maybe (Vector.Vector Structure_Types.Section)- , communication_entityMentionSetList :: P.Maybe (Vector.Vector Entities_Types.EntityMentionSet)- , communication_entitySetList :: P.Maybe (Vector.Vector Entities_Types.EntitySet)- , communication_situationMentionSetList :: P.Maybe (Vector.Vector Situations_Types.SituationMentionSet)- , communication_situationSetList :: P.Maybe (Vector.Vector Situations_Types.SituationSet)- , communication_originalText :: P.Maybe LT.Text- , communication_sound :: P.Maybe Audio_Types.Sound- , communication_communicationMetadata :: P.Maybe Metadata_Types.CommunicationMetadata- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Communication where- hashWithSalt salt record = salt `H.hashWithSalt` communication_id record `H.hashWithSalt` communication_uuid record `H.hashWithSalt` communication_type record `H.hashWithSalt` communication_text record `H.hashWithSalt` communication_startTime record `H.hashWithSalt` communication_endTime record `H.hashWithSalt` communication_communicationTaggingList record `H.hashWithSalt` communication_metadata record `H.hashWithSalt` communication_keyValueMap record `H.hashWithSalt` communication_lidList record `H.hashWithSalt` communication_sectionList record `H.hashWithSalt` communication_entityMentionSetList record `H.hashWithSalt` communication_entitySetList record `H.hashWithSalt` communication_situationMentionSetList record `H.hashWithSalt` communication_situationSetList record `H.hashWithSalt` communication_originalText record `H.hashWithSalt` communication_sound record `H.hashWithSalt` communication_communicationMetadata record -instance QC.Arbitrary Communication where - arbitrary = M.liftM Communication (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Communication = []- | P.otherwise = M.catMaybes- [ if obj == default_Communication{communication_id = communication_id obj} then P.Nothing else P.Just $ default_Communication{communication_id = communication_id obj}- , if obj == default_Communication{communication_uuid = communication_uuid obj} then P.Nothing else P.Just $ default_Communication{communication_uuid = communication_uuid obj}- , if obj == default_Communication{communication_type = communication_type obj} then P.Nothing else P.Just $ default_Communication{communication_type = communication_type obj}- , if obj == default_Communication{communication_text = communication_text obj} then P.Nothing else P.Just $ default_Communication{communication_text = communication_text obj}- , if obj == default_Communication{communication_startTime = communication_startTime obj} then P.Nothing else P.Just $ default_Communication{communication_startTime = communication_startTime obj}- , if obj == default_Communication{communication_endTime = communication_endTime obj} then P.Nothing else P.Just $ default_Communication{communication_endTime = communication_endTime obj}- , if obj == default_Communication{communication_communicationTaggingList = communication_communicationTaggingList obj} then P.Nothing else P.Just $ default_Communication{communication_communicationTaggingList = communication_communicationTaggingList obj}- , if obj == default_Communication{communication_metadata = communication_metadata obj} then P.Nothing else P.Just $ default_Communication{communication_metadata = communication_metadata obj}- , if obj == default_Communication{communication_keyValueMap = communication_keyValueMap obj} then P.Nothing else P.Just $ default_Communication{communication_keyValueMap = communication_keyValueMap obj}- , if obj == default_Communication{communication_lidList = communication_lidList obj} then P.Nothing else P.Just $ default_Communication{communication_lidList = communication_lidList obj}- , if obj == default_Communication{communication_sectionList = communication_sectionList obj} then P.Nothing else P.Just $ default_Communication{communication_sectionList = communication_sectionList obj}- , if obj == default_Communication{communication_entityMentionSetList = communication_entityMentionSetList obj} then P.Nothing else P.Just $ default_Communication{communication_entityMentionSetList = communication_entityMentionSetList obj}- , if obj == default_Communication{communication_entitySetList = communication_entitySetList obj} then P.Nothing else P.Just $ default_Communication{communication_entitySetList = communication_entitySetList obj}- , if obj == default_Communication{communication_situationMentionSetList = communication_situationMentionSetList obj} then P.Nothing else P.Just $ default_Communication{communication_situationMentionSetList = communication_situationMentionSetList obj}- , if obj == default_Communication{communication_situationSetList = communication_situationSetList obj} then P.Nothing else P.Just $ default_Communication{communication_situationSetList = communication_situationSetList obj}- , if obj == default_Communication{communication_originalText = communication_originalText obj} then P.Nothing else P.Just $ default_Communication{communication_originalText = communication_originalText obj}- , if obj == default_Communication{communication_sound = communication_sound obj} then P.Nothing else P.Just $ default_Communication{communication_sound = communication_sound obj}- , if obj == default_Communication{communication_communicationMetadata = communication_communicationMetadata obj} then P.Nothing else P.Just $ default_Communication{communication_communicationMetadata = communication_communicationMetadata obj}- ]-from_Communication :: Communication -> T.ThriftVal-from_Communication record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v20 -> P.Just (1, ("id",T.TString $ E.encodeUtf8 _v20))) $ communication_id record- , (\_v20 -> P.Just (2, ("uuid",Uuid_Types.from_UUID _v20))) $ communication_uuid record- , (\_v20 -> P.Just (3, ("type",T.TString $ E.encodeUtf8 _v20))) $ communication_type record- , (\_v20 -> (4, ("text",T.TString $ E.encodeUtf8 _v20))) <$> communication_text record- , (\_v20 -> (5, ("startTime",T.TI64 _v20))) <$> communication_startTime record- , (\_v20 -> (6, ("endTime",T.TI64 _v20))) <$> communication_endTime record- , (\_v20 -> (7, ("communicationTaggingList",T.TList (T.T_STRUCT typemap_CommunicationTagging) $ P.map (\_v22 -> from_CommunicationTagging _v22) $ Vector.toList _v20))) <$> communication_communicationTaggingList record- , (\_v20 -> P.Just (8, ("metadata",Metadata_Types.from_AnnotationMetadata _v20))) $ communication_metadata record- , (\_v20 -> (9, ("keyValueMap",T.TMap T.T_STRING T.T_STRING $ P.map (\(_k23,_v24) -> (T.TString $ E.encodeUtf8 _k23, T.TString $ E.encodeUtf8 _v24)) $ Map.toList _v20))) <$> communication_keyValueMap record- , (\_v20 -> (10, ("lidList",T.TList (T.T_STRUCT Language_Types.typemap_LanguageIdentification) $ P.map (\_v26 -> Language_Types.from_LanguageIdentification _v26) $ Vector.toList _v20))) <$> communication_lidList record- , (\_v20 -> (11, ("sectionList",T.TList (T.T_STRUCT Structure_Types.typemap_Section) $ P.map (\_v28 -> Structure_Types.from_Section _v28) $ Vector.toList _v20))) <$> communication_sectionList record- , (\_v20 -> (12, ("entityMentionSetList",T.TList (T.T_STRUCT Entities_Types.typemap_EntityMentionSet) $ P.map (\_v30 -> Entities_Types.from_EntityMentionSet _v30) $ Vector.toList _v20))) <$> communication_entityMentionSetList record- , (\_v20 -> (13, ("entitySetList",T.TList (T.T_STRUCT Entities_Types.typemap_EntitySet) $ P.map (\_v32 -> Entities_Types.from_EntitySet _v32) $ Vector.toList _v20))) <$> communication_entitySetList record- , (\_v20 -> (14, ("situationMentionSetList",T.TList (T.T_STRUCT Situations_Types.typemap_SituationMentionSet) $ P.map (\_v34 -> Situations_Types.from_SituationMentionSet _v34) $ Vector.toList _v20))) <$> communication_situationMentionSetList record- , (\_v20 -> (15, ("situationSetList",T.TList (T.T_STRUCT Situations_Types.typemap_SituationSet) $ P.map (\_v36 -> Situations_Types.from_SituationSet _v36) $ Vector.toList _v20))) <$> communication_situationSetList record- , (\_v20 -> (16, ("originalText",T.TString $ E.encodeUtf8 _v20))) <$> communication_originalText record- , (\_v20 -> (20, ("sound",Audio_Types.from_Sound _v20))) <$> communication_sound record- , (\_v20 -> (21, ("communicationMetadata",Metadata_Types.from_CommunicationMetadata _v20))) <$> communication_communicationMetadata record- ]-write_Communication :: (T.Protocol p, T.Transport t) => p t -> Communication -> P.IO ()-write_Communication oprot record = T.writeVal oprot $ from_Communication record-encode_Communication :: (T.Protocol p, T.Transport t) => p t -> Communication -> LBS.ByteString-encode_Communication oprot record = T.serializeVal oprot $ from_Communication record-to_Communication :: T.ThriftVal -> Communication-to_Communication (T.TStruct fields) = Communication{- communication_id = P.maybe (P.error "Missing required field: id") (\(_,_val38) -> (case _val38 of {T.TString _val39 -> E.decodeUtf8 _val39; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- communication_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val38) -> (case _val38 of {T.TStruct _val40 -> (Uuid_Types.to_UUID (T.TStruct _val40)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- communication_type = P.maybe (P.error "Missing required field: type") (\(_,_val38) -> (case _val38 of {T.TString _val41 -> E.decodeUtf8 _val41; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- communication_text = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val42 -> E.decodeUtf8 _val42; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- communication_startTime = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI64 _val43 -> _val43; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- communication_endTime = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI64 _val44 -> _val44; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- communication_communicationTaggingList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val45 -> (Vector.fromList $ P.map (\_v46 -> (case _v46 of {T.TStruct _val47 -> (to_CommunicationTagging (T.TStruct _val47)); _ -> P.error "wrong type"})) _val45); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- communication_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val38) -> (case _val38 of {T.TStruct _val48 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val48)); _ -> P.error "wrong type"})) (Map.lookup (8) fields),- communication_keyValueMap = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TMap _ _ _val49 -> (Map.fromList $ P.map (\(_k51,_v50) -> ((case _k51 of {T.TString _val52 -> E.decodeUtf8 _val52; _ -> P.error "wrong type"}),(case _v50 of {T.TString _val53 -> E.decodeUtf8 _val53; _ -> P.error "wrong type"}))) _val49); _ -> P.error "wrong type"})) (Map.lookup (9) fields),- communication_lidList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val54 -> (Vector.fromList $ P.map (\_v55 -> (case _v55 of {T.TStruct _val56 -> (Language_Types.to_LanguageIdentification (T.TStruct _val56)); _ -> P.error "wrong type"})) _val54); _ -> P.error "wrong type"})) (Map.lookup (10) fields),- communication_sectionList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val57 -> (Vector.fromList $ P.map (\_v58 -> (case _v58 of {T.TStruct _val59 -> (Structure_Types.to_Section (T.TStruct _val59)); _ -> P.error "wrong type"})) _val57); _ -> P.error "wrong type"})) (Map.lookup (11) fields),- communication_entityMentionSetList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val60 -> (Vector.fromList $ P.map (\_v61 -> (case _v61 of {T.TStruct _val62 -> (Entities_Types.to_EntityMentionSet (T.TStruct _val62)); _ -> P.error "wrong type"})) _val60); _ -> P.error "wrong type"})) (Map.lookup (12) fields),- communication_entitySetList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val63 -> (Vector.fromList $ P.map (\_v64 -> (case _v64 of {T.TStruct _val65 -> (Entities_Types.to_EntitySet (T.TStruct _val65)); _ -> P.error "wrong type"})) _val63); _ -> P.error "wrong type"})) (Map.lookup (13) fields),- communication_situationMentionSetList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val66 -> (Vector.fromList $ P.map (\_v67 -> (case _v67 of {T.TStruct _val68 -> (Situations_Types.to_SituationMentionSet (T.TStruct _val68)); _ -> P.error "wrong type"})) _val66); _ -> P.error "wrong type"})) (Map.lookup (14) fields),- communication_situationSetList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val69 -> (Vector.fromList $ P.map (\_v70 -> (case _v70 of {T.TStruct _val71 -> (Situations_Types.to_SituationSet (T.TStruct _val71)); _ -> P.error "wrong type"})) _val69); _ -> P.error "wrong type"})) (Map.lookup (15) fields),- communication_originalText = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val72 -> E.decodeUtf8 _val72; _ -> P.error "wrong type"})) (Map.lookup (16) fields),- communication_sound = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TStruct _val73 -> (Audio_Types.to_Sound (T.TStruct _val73)); _ -> P.error "wrong type"})) (Map.lookup (20) fields),- communication_communicationMetadata = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TStruct _val74 -> (Metadata_Types.to_CommunicationMetadata (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (21) fields)- }-to_Communication _ = P.error "not a struct"-read_Communication :: (T.Transport t, T.Protocol p) => p t -> P.IO Communication-read_Communication iprot = to_Communication <$> T.readVal iprot (T.T_STRUCT typemap_Communication)-decode_Communication :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Communication-decode_Communication iprot bs = to_Communication $ T.deserializeVal iprot (T.T_STRUCT typemap_Communication) bs-typemap_Communication :: T.TypeMap-typemap_Communication = Map.fromList [(1,("id",T.T_STRING)),(2,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("type",T.T_STRING)),(4,("text",T.T_STRING)),(5,("startTime",T.T_I64)),(6,("endTime",T.T_I64)),(7,("communicationTaggingList",(T.T_LIST (T.T_STRUCT typemap_CommunicationTagging)))),(8,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(9,("keyValueMap",(T.T_MAP T.T_STRING T.T_STRING))),(10,("lidList",(T.T_LIST (T.T_STRUCT Language_Types.typemap_LanguageIdentification)))),(11,("sectionList",(T.T_LIST (T.T_STRUCT Structure_Types.typemap_Section)))),(12,("entityMentionSetList",(T.T_LIST (T.T_STRUCT Entities_Types.typemap_EntityMentionSet)))),(13,("entitySetList",(T.T_LIST (T.T_STRUCT Entities_Types.typemap_EntitySet)))),(14,("situationMentionSetList",(T.T_LIST (T.T_STRUCT Situations_Types.typemap_SituationMentionSet)))),(15,("situationSetList",(T.T_LIST (T.T_STRUCT Situations_Types.typemap_SituationSet)))),(16,("originalText",T.T_STRING)),(20,("sound",(T.T_STRUCT Audio_Types.typemap_Sound))),(21,("communicationMetadata",(T.T_STRUCT Metadata_Types.typemap_CommunicationMetadata)))]-default_Communication :: Communication-default_Communication = Communication{- communication_id = "",- communication_uuid = Uuid_Types.default_UUID,- communication_type = "",- communication_text = P.Nothing,- communication_startTime = P.Nothing,- communication_endTime = P.Nothing,- communication_communicationTaggingList = P.Nothing,- communication_metadata = Metadata_Types.default_AnnotationMetadata,- communication_keyValueMap = P.Nothing,- communication_lidList = P.Nothing,- communication_sectionList = P.Nothing,- communication_entityMentionSetList = P.Nothing,- communication_entitySetList = P.Nothing,- communication_situationMentionSetList = P.Nothing,- communication_situationSetList = P.Nothing,- communication_originalText = P.Nothing,- communication_sound = P.Nothing,- communication_communicationMetadata = P.Nothing}-data CommunicationSet = CommunicationSet { communicationSet_communicationIdList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , communicationSet_corpus :: P.Maybe LT.Text- , communicationSet_entityMentionClusterList :: P.Maybe (Vector.Vector Cluster_Types.Clustering)- , communicationSet_entityClusterList :: P.Maybe (Vector.Vector Cluster_Types.Clustering)- , communicationSet_situationMentionClusterList :: P.Maybe (Vector.Vector Cluster_Types.Clustering)- , communicationSet_situationClusterList :: P.Maybe (Vector.Vector Cluster_Types.Clustering)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable CommunicationSet where- hashWithSalt salt record = salt `H.hashWithSalt` communicationSet_communicationIdList record `H.hashWithSalt` communicationSet_corpus record `H.hashWithSalt` communicationSet_entityMentionClusterList record `H.hashWithSalt` communicationSet_entityClusterList record `H.hashWithSalt` communicationSet_situationMentionClusterList record `H.hashWithSalt` communicationSet_situationClusterList record -instance QC.Arbitrary CommunicationSet where - arbitrary = M.liftM CommunicationSet (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_CommunicationSet = []- | P.otherwise = M.catMaybes- [ if obj == default_CommunicationSet{communicationSet_communicationIdList = communicationSet_communicationIdList obj} then P.Nothing else P.Just $ default_CommunicationSet{communicationSet_communicationIdList = communicationSet_communicationIdList obj}- , if obj == default_CommunicationSet{communicationSet_corpus = communicationSet_corpus obj} then P.Nothing else P.Just $ default_CommunicationSet{communicationSet_corpus = communicationSet_corpus obj}- , if obj == default_CommunicationSet{communicationSet_entityMentionClusterList = communicationSet_entityMentionClusterList obj} then P.Nothing else P.Just $ default_CommunicationSet{communicationSet_entityMentionClusterList = communicationSet_entityMentionClusterList obj}- , if obj == default_CommunicationSet{communicationSet_entityClusterList = communicationSet_entityClusterList obj} then P.Nothing else P.Just $ default_CommunicationSet{communicationSet_entityClusterList = communicationSet_entityClusterList obj}- , if obj == default_CommunicationSet{communicationSet_situationMentionClusterList = communicationSet_situationMentionClusterList obj} then P.Nothing else P.Just $ default_CommunicationSet{communicationSet_situationMentionClusterList = communicationSet_situationMentionClusterList obj}- , if obj == default_CommunicationSet{communicationSet_situationClusterList = communicationSet_situationClusterList obj} then P.Nothing else P.Just $ default_CommunicationSet{communicationSet_situationClusterList = communicationSet_situationClusterList obj}- ]-from_CommunicationSet :: CommunicationSet -> T.ThriftVal-from_CommunicationSet record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v77 -> (1, ("communicationIdList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v79 -> Uuid_Types.from_UUID _v79) $ Vector.toList _v77))) <$> communicationSet_communicationIdList record- , (\_v77 -> (2, ("corpus",T.TString $ E.encodeUtf8 _v77))) <$> communicationSet_corpus record- , (\_v77 -> (3, ("entityMentionClusterList",T.TList (T.T_STRUCT Cluster_Types.typemap_Clustering) $ P.map (\_v81 -> Cluster_Types.from_Clustering _v81) $ Vector.toList _v77))) <$> communicationSet_entityMentionClusterList record- , (\_v77 -> (4, ("entityClusterList",T.TList (T.T_STRUCT Cluster_Types.typemap_Clustering) $ P.map (\_v83 -> Cluster_Types.from_Clustering _v83) $ Vector.toList _v77))) <$> communicationSet_entityClusterList record- , (\_v77 -> (5, ("situationMentionClusterList",T.TList (T.T_STRUCT Cluster_Types.typemap_Clustering) $ P.map (\_v85 -> Cluster_Types.from_Clustering _v85) $ Vector.toList _v77))) <$> communicationSet_situationMentionClusterList record- , (\_v77 -> (6, ("situationClusterList",T.TList (T.T_STRUCT Cluster_Types.typemap_Clustering) $ P.map (\_v87 -> Cluster_Types.from_Clustering _v87) $ Vector.toList _v77))) <$> communicationSet_situationClusterList record- ]-write_CommunicationSet :: (T.Protocol p, T.Transport t) => p t -> CommunicationSet -> P.IO ()-write_CommunicationSet oprot record = T.writeVal oprot $ from_CommunicationSet record-encode_CommunicationSet :: (T.Protocol p, T.Transport t) => p t -> CommunicationSet -> LBS.ByteString-encode_CommunicationSet oprot record = T.serializeVal oprot $ from_CommunicationSet record-to_CommunicationSet :: T.ThriftVal -> CommunicationSet-to_CommunicationSet (T.TStruct fields) = CommunicationSet{- communicationSet_communicationIdList = P.maybe (P.Nothing) (\(_,_val89) -> P.Just (case _val89 of {T.TList _ _val90 -> (Vector.fromList $ P.map (\_v91 -> (case _v91 of {T.TStruct _val92 -> (Uuid_Types.to_UUID (T.TStruct _val92)); _ -> P.error "wrong type"})) _val90); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- communicationSet_corpus = P.maybe (P.Nothing) (\(_,_val89) -> P.Just (case _val89 of {T.TString _val93 -> E.decodeUtf8 _val93; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- communicationSet_entityMentionClusterList = P.maybe (P.Nothing) (\(_,_val89) -> P.Just (case _val89 of {T.TList _ _val94 -> (Vector.fromList $ P.map (\_v95 -> (case _v95 of {T.TStruct _val96 -> (Cluster_Types.to_Clustering (T.TStruct _val96)); _ -> P.error "wrong type"})) _val94); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- communicationSet_entityClusterList = P.maybe (P.Nothing) (\(_,_val89) -> P.Just (case _val89 of {T.TList _ _val97 -> (Vector.fromList $ P.map (\_v98 -> (case _v98 of {T.TStruct _val99 -> (Cluster_Types.to_Clustering (T.TStruct _val99)); _ -> P.error "wrong type"})) _val97); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- communicationSet_situationMentionClusterList = P.maybe (P.Nothing) (\(_,_val89) -> P.Just (case _val89 of {T.TList _ _val100 -> (Vector.fromList $ P.map (\_v101 -> (case _v101 of {T.TStruct _val102 -> (Cluster_Types.to_Clustering (T.TStruct _val102)); _ -> P.error "wrong type"})) _val100); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- communicationSet_situationClusterList = P.maybe (P.Nothing) (\(_,_val89) -> P.Just (case _val89 of {T.TList _ _val103 -> (Vector.fromList $ P.map (\_v104 -> (case _v104 of {T.TStruct _val105 -> (Cluster_Types.to_Clustering (T.TStruct _val105)); _ -> P.error "wrong type"})) _val103); _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_CommunicationSet _ = P.error "not a struct"-read_CommunicationSet :: (T.Transport t, T.Protocol p) => p t -> P.IO CommunicationSet-read_CommunicationSet iprot = to_CommunicationSet <$> T.readVal iprot (T.T_STRUCT typemap_CommunicationSet)-decode_CommunicationSet :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> CommunicationSet-decode_CommunicationSet iprot bs = to_CommunicationSet $ T.deserializeVal iprot (T.T_STRUCT typemap_CommunicationSet) bs-typemap_CommunicationSet :: T.TypeMap-typemap_CommunicationSet = Map.fromList [(1,("communicationIdList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(2,("corpus",T.T_STRING)),(3,("entityMentionClusterList",(T.T_LIST (T.T_STRUCT Cluster_Types.typemap_Clustering)))),(4,("entityClusterList",(T.T_LIST (T.T_STRUCT Cluster_Types.typemap_Clustering)))),(5,("situationMentionClusterList",(T.T_LIST (T.T_STRUCT Cluster_Types.typemap_Clustering)))),(6,("situationClusterList",(T.T_LIST (T.T_STRUCT Cluster_Types.typemap_Clustering))))]-default_CommunicationSet :: CommunicationSet-default_CommunicationSet = CommunicationSet{- communicationSet_communicationIdList = P.Nothing,- communicationSet_corpus = P.Nothing,- communicationSet_entityMentionClusterList = P.Nothing,- communicationSet_entityClusterList = P.Nothing,- communicationSet_situationMentionClusterList = P.Nothing,- communicationSet_situationClusterList = P.Nothing}
− src/Concrete_Consts.hs
@@ -1,64 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Concrete_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Access_Types-import qualified Annotate_Types-import qualified Audio_Types-import qualified Cluster_Types-import qualified Communication_Types-import qualified Email_Types-import qualified Entities_Types-import qualified Ex_Types-import qualified Language_Types-import qualified Learn_Types-import qualified Linking_Types-import qualified Metadata_Types-import qualified Nitf_Types-import qualified Results_Types-import qualified Search_Types-import qualified Services_Types-import qualified Situations_Types-import qualified Spans_Types-import qualified Structure_Types-import qualified Summarization_Types-import qualified Twitter_Types-import qualified Uuid_Types---import Concrete_Types
− src/Concrete_Types.hs
@@ -1,63 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Concrete_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Access_Types-import qualified Annotate_Types-import qualified Audio_Types-import qualified Cluster_Types-import qualified Communication_Types-import qualified Email_Types-import qualified Entities_Types-import qualified Ex_Types-import qualified Language_Types-import qualified Learn_Types-import qualified Linking_Types-import qualified Metadata_Types-import qualified Nitf_Types-import qualified Results_Types-import qualified Search_Types-import qualified Services_Types-import qualified Situations_Types-import qualified Spans_Types-import qualified Structure_Types-import qualified Summarization_Types-import qualified Twitter_Types-import qualified Uuid_Types--
src/Data/Concrete.hs view
@@ -1,71 +1,2 @@ module Data.Concrete (- module Data.Concrete- , module Data.Concrete.Access_Types- , module Data.Concrete.Annotate_Types- , module Data.Concrete.Audio_Types- , module Data.Concrete.Cluster_Types- , module Data.Concrete.Communication_Types- , module Data.Concrete.Concrete_Types- , module Data.Concrete.Email_Types- , module Data.Concrete.Entities_Types- , module Data.Concrete.Ex_Types- , module Data.Concrete.Language_Types- , module Data.Concrete.Learn_Types- , module Data.Concrete.Linking_Types- , module Data.Concrete.Metadata_Types- , module Data.Concrete.Nitf_Types- , module Data.Concrete.Results_Types- , module Data.Concrete.Search_Types- , module Data.Concrete.Services_Types- , module Data.Concrete.Situations_Types- , module Data.Concrete.Spans_Types- , module Data.Concrete.Structure_Types- , module Data.Concrete.Summarization_Types- , module Data.Concrete.Twitter_Types- , module Data.Concrete.Uuid_Types- ) where-import Access_Types as Data.Concrete.Access_Types-import Annotate_Types as Data.Concrete.Annotate_Types-import Audio_Types as Data.Concrete.Audio_Types-import Cluster_Types as Data.Concrete.Cluster_Types-import Communication_Types as Data.Concrete.Communication_Types-import Concrete_Types as Data.Concrete.Concrete_Types-import Email_Types as Data.Concrete.Email_Types-import Entities_Types as Data.Concrete.Entities_Types-import Ex_Types as Data.Concrete.Ex_Types-import Language_Types as Data.Concrete.Language_Types-import Learn_Types as Data.Concrete.Learn_Types-import Linking_Types as Data.Concrete.Linking_Types-import Metadata_Types as Data.Concrete.Metadata_Types-import Nitf_Types as Data.Concrete.Nitf_Types-import Results_Types as Data.Concrete.Results_Types-import Search_Types as Data.Concrete.Search_Types-import Services_Types as Data.Concrete.Services_Types-import Situations_Types as Data.Concrete.Situations_Types-import Spans_Types as Data.Concrete.Spans_Types-import Structure_Types as Data.Concrete.Structure_Types-import Summarization_Types as Data.Concrete.Summarization_Types-import Twitter_Types as Data.Concrete.Twitter_Types-import Uuid_Types as Data.Concrete.Uuid_Types-import qualified ActiveLearnerClientService_Client as Data.Concrete.ActiveLearnerClientService_Client-import qualified ActiveLearnerServerService_Client as Data.Concrete.ActiveLearnerServerService_Client-import qualified AnnotateCommunicationService_Client as Data.Concrete.AnnotateCommunicationService_Client-import qualified FeedbackService_Client as Data.Concrete.FeedbackService_Client-import qualified FetchCommunicationService_Client as Data.Concrete.FetchCommunicationService_Client-import qualified ResultsServerService_Client as Data.Concrete.ResultsServerService_Client-import qualified SearchProxyService_Client as Data.Concrete.SearchProxyService_Client-import qualified SearchService_Client as Data.Concrete.SearchService_Client-import qualified Service_Client as Data.Concrete.Service_Client-import qualified StoreCommunicationService_Client as Data.Concrete.StoreCommunicationService_Client-import qualified SummarizationService_Client as Data.Concrete.SummarizationService_Client-import qualified ActiveLearnerClientService_Iface as Data.Concrete.ActiveLearnerClientService_Iface-import qualified ActiveLearnerServerService_Iface as Data.Concrete.ActiveLearnerServerService_Iface-import qualified AnnotateCommunicationService_Iface as Data.Concrete.AnnotateCommunicationService_Iface-import qualified FeedbackService_Iface as Data.Concrete.FeedbackService_Iface-import qualified FetchCommunicationService_Iface as Data.Concrete.FetchCommunicationService_Iface-import qualified ResultsServerService_Iface as Data.Concrete.ResultsServerService_Iface-import qualified SearchProxyService_Iface as Data.Concrete.SearchProxyService_Iface-import qualified SearchService_Iface as Data.Concrete.SearchService_Iface-import qualified Service_Iface as Data.Concrete.Service_Iface-import qualified StoreCommunicationService_Iface as Data.Concrete.StoreCommunicationService_Iface-import qualified SummarizationService_Iface as Data.Concrete.SummarizationService_Iface+ ) where
src/Data/Concrete/Parsers.hs view
@@ -17,24 +17,25 @@ import Data.Vector (fromList, Vector) import Data.Map (Map) import Data.Concrete.Utils (createAnnotationMetadata, getUUID, writeCommunication)-import Data.Concrete ( default_Communication- , Communication(..)- , default_Section- , Section(..)- , default_AnnotationMetadata- , AnnotationMetadata(..)- , default_CommunicationMetadata- , CommunicationMetadata(..)- , default_Sentence- , Sentence(..)- , default_TextSpan- , TextSpan(..)- )+-- import Data.Concrete ( default_Communication+-- , Communication(..)+-- , default_Section+-- , Section(..)+-- , default_AnnotationMetadata+-- , AnnotationMetadata(..)+-- , default_CommunicationMetadata+-- , CommunicationMetadata(..)+-- , default_Sentence+-- , Sentence(..)+-- , default_TextSpan+-- , TextSpan(..)+-- ) import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn) import Control.Monad.State (runStateT) import Data.ByteString.Lazy (ByteString) import Data.Text.Lazy (Text, pack)-import Data.Concrete.Types+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+--import Data.Concrete.Types import Data.Concrete.Parsers.Types import Control.Monad.IO.Class (liftIO) import Text.Megaparsec (runParserT', initialPos, State(..), unsafePos, parseErrorPretty, eof, space)@@ -61,8 +62,8 @@ , ( "JSON-LINES" , ( "One JSON object per line" , JSON.lineParser- , [ "catchphrase"- , "relatives.0.name"+ , [ "author"+ , "subreddit" ] , "id_${name}" )@@ -77,41 +78,41 @@ , "id_${county}" ) )- , ( "PTB"- , ( "PENN Treebank format"- , PTB.parser- , []- , "id_${}"- )- )- , ("CONLL-U"- , ( "CONLL-U format"- , CONLL.parser CONLL.ufields- , []- , "id_${}"- )- )- , ("HTML"- , ("HTML format"- , HTML.parser- , []- , "id_${}"- )- )- , ("XML"- , ("XML format"- , XML.parser- , []- , "id_${}"- )- )- , ("Email"- , ("Email format"- , Email.parser- , []- , "id_${}"- )- )+ -- , ( "PTB"+ -- , ( "PENN Treebank format"+ -- , PTB.parser+ -- , []+ -- , "id_${}"+ -- )+ -- )+ -- , ("CONLL-U"+ -- , ( "CONLL-U format"+ -- , CONLL.parser CONLL.ufields+ -- , []+ -- , "id_${}"+ -- )+ -- )+ -- , ("HTML"+ -- , ("HTML format"+ -- , HTML.parser+ -- , []+ -- , "id_${}"+ -- )+ -- )+ -- , ("XML"+ -- , ("XML format"+ -- , XML.parser+ -- , []+ -- , "id_${}"+ -- )+ -- )+ -- , ("Email"+ -- , ("Email format"+ -- , Email.parser+ -- , []+ -- , "id_${}"+ -- )+ -- ) ] ingest :: CommunicationAction -> CommunicationParser a -> Text -> [String] -> String -> String -> IO ()
src/Data/Concrete/Parsers/CONLL.hs view
@@ -47,10 +47,11 @@ ) import Text.Megaparsec.Text.Lazy (Parser)-import Data.Concrete (default_Communication, Communication(..))+--import Data.Concrete (default_Communication, Communication(..))+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..)) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I-import Data.Concrete.Types+--import Data.Concrete.Types import Data.Concrete.Parsers.Utils (communicationRule, sectionRule, pushPathComponent, popPathComponent) ufields = ["ID", "FORM", "LEMMA", "UPOSTAG", "XPOSTAG", "FEATS", "HEAD", "DEPREL", "DEPS", "MISC"] :: [Text]
src/Data/Concrete/Parsers/CSV.hs view
@@ -42,12 +42,12 @@ , eof , many )-+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..)) import Text.Megaparsec.Text.Lazy (Parser)-import Data.Concrete (default_Communication, Communication(..))+--import Data.Concrete (default_Communication, Communication(..)) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I-import Data.Concrete.Types+--import Data.Concrete.Types import Data.Concrete.Parsers.Utils (communicationRule, sectionRule, pushPathComponent, popPathComponent) parser :: Bool -> Char -> CommunicationParser ()
src/Data/Concrete/Parsers/Email.hs view
@@ -37,10 +37,11 @@ ) import Text.Megaparsec.Text.Lazy (Parser)-import Data.Concrete (default_Communication, Communication(..))+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+--import Data.Concrete (default_Communication, Communication(..)) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I-import Data.Concrete.Types+--import Data.Concrete.Types import Data.Concrete.Parsers.Utils (communicationRule, sectionRule) import qualified Data.Concrete.Parsers.RFC2822 as R
src/Data/Concrete/Parsers/HTML.hs view
@@ -38,10 +38,11 @@ ) import Text.Megaparsec.Text.Lazy (Parser)-import Data.Concrete (default_Communication, Communication(..), Section(..), TextSpan(..))+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+--import Data.Concrete (default_Communication, Communication(..), Section(..), TextSpan(..)) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I-import Data.Concrete.Types+--import Data.Concrete.Types import Data.Concrete.Parsers.Utils (communicationRule, sectionRule) parser :: CommunicationParser ()
src/Data/Concrete/Parsers/JSON.hs view
@@ -43,8 +43,8 @@ import Text.Megaparsec.Text.Lazy (Parser) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I--import Data.Concrete (default_Communication, Communication(..), Section(..), TextSpan(..))+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+--import Data.Concrete (default_Communication, Communication(..), Section(..), TextSpan(..)) import Data.Concrete.Parsers.Types (Bookkeeper(..), CommunicationParser) import Data.Concrete.Parsers.Utils ( communicationRule , sectionRule
src/Data/Concrete/Parsers/PTB.hs view
@@ -44,10 +44,10 @@ import Control.Monad.IO.Class (liftIO) import Text.Megaparsec.Text.Lazy (Parser)-import Data.Concrete (default_Communication, Communication(..))+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..)) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I-import Data.Concrete.Types+--import Data.Concrete.Types import Data.Concrete.Parsers.Utils (communicationRule, sectionRule) parser :: CommunicationParser ()@@ -58,9 +58,9 @@ eof return () -type CS = CommunicationParser String-type CSS = CommunicationParser [String]-type CC = CommunicationParser Char+-- type CS = CommunicationParser String+-- type CSS = CommunicationParser [String]+-- type CC = CommunicationParser Char document :: CommunicationParser () document = lexeme' $ communicationRule id (parens (some sentence)) >> return ()
src/Data/Concrete/Parsers/Types.hs view
@@ -7,7 +7,8 @@ ) where import Data.Text.Lazy (Text)-import Data.Concrete (Communication, Section)+import Data.Concrete.Autogen.Communication_Types (Communication)+import Data.Concrete.Autogen.Structure_Types (Section, Sentence) import Text.Megaparsec (ParsecT) import Text.Megaparsec.Error (Dec) import Data.Map (Map)
src/Data/Concrete/Parsers/Utils.hs view
@@ -8,7 +8,7 @@ , pushPathComponent , popPathComponent , modifyPathComponent- , incrementPathComponent+ , incrementPathComponent , Located(..) ) where @@ -21,8 +21,10 @@ import Data.Map (Map) import qualified Data.Map as Map import Control.Monad.State (State, get, put, modify, modify')-import Data.Concrete (default_Communication, Communication(..), default_Section, Section(..), default_TextSpan, TextSpan(..))-import Data.Concrete.Utils (getUUID, createAnnotationMetadata)+import Data.Concrete.Autogen.Communication_Types (Communication(..), default_Communication)+import Data.Concrete.Autogen.Structure_Types (Section(..), default_Section)+import Data.Concrete.Autogen.Spans_Types (TextSpan(..), default_TextSpan)+import Data.Concrete.Utils (getUUID, createAnnotationMetadata, incrementUUID) import Control.Monad.IO.Class (liftIO) import Data.Vector (Vector, fromList, snoc, empty, cons, toList) import Data.Maybe (fromJust)@@ -35,7 +37,8 @@ (t, o) <- match p bs@(Bookkeeper {..}) <- get let sections = (toList . fromJust) (communication_sectionList communication)- (u:us) <- liftIO $ sequence (replicate (length sections + 1) getUUID)+ u <- liftIO getUUID+ let us = iterate incrementUUID u m <- liftIO $ createAnnotationMetadata "concrete-haskell ingester" let sections' = [s { section_uuid=u' , section_kind=if elem ((unpack . fromJust) section_label) contentSections then "content" else "metadata"
src/Data/Concrete/Parsers/XML.hs view
@@ -38,10 +38,9 @@ ) import Text.Megaparsec.Text.Lazy (Parser)-import Data.Concrete (default_Communication, Communication(..))+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..)) import qualified Control.Monad.State as S import qualified Control.Monad.Identity as I-import Data.Concrete.Types import Data.Concrete.Parsers.Utils (communicationRule, sectionRule) parser :: CommunicationParser ()
+ src/Data/Concrete/Services.hs view
@@ -0,0 +1,29 @@+module Data.Concrete.Services ( runConcreteService+ , connectToService+ , Compression(..)+ ) where++import Thrift.Transport.Handle hiding (HandleSource)+import Thrift.Transport.Framed (FramedTransport, openFramedTransport)+import Thrift.Protocol.Compact (CompactProtocol(..))+import Thrift.Server (runThreadedServer)+import System.IO (Handle)+import Network (PortID(..), accept)++data Compression = BZip | GZip++runConcreteService :: Int -> h -> (h -> (CompactProtocol (FramedTransport Handle), CompactProtocol (FramedTransport Handle)) -> IO Bool) -> IO ()+runConcreteService port handler processor= runThreadedServer acceptor handler processor port'+ where+ port' = (PortNumber ((read . show) port))+ acceptor s = do+ (h, _, _) <- accept s+ t <- openFramedTransport h+ return (CompactProtocol t, CompactProtocol t)++connectToService :: String -> Int -> IO (CompactProtocol (FramedTransport Handle), CompactProtocol (FramedTransport Handle))+connectToService h p = do+ transport <- hOpen (h, PortNumber $ fromIntegral p)+ transport' <- openFramedTransport transport+ let protocol = CompactProtocol transport'+ return (protocol, protocol)
− src/Data/Concrete/Services/ActiveLearnerClientService.hs
@@ -1,136 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ActiveLearnerClientService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import qualified Service-import Learn_Types-import qualified ActiveLearnerClientService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data SubmitSort_args = SubmitSort_args { submitSort_args_sessionId :: Uuid_Types.UUID- , submitSort_args_unitIds :: (Vector.Vector Services_Types.AnnotationUnitIdentifier)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitSort_args where- hashWithSalt salt record = salt `H.hashWithSalt` submitSort_args_sessionId record `H.hashWithSalt` submitSort_args_unitIds record -instance QC.Arbitrary SubmitSort_args where - arbitrary = M.liftM SubmitSort_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SubmitSort_args = []- | P.otherwise = M.catMaybes- [ if obj == default_SubmitSort_args{submitSort_args_sessionId = submitSort_args_sessionId obj} then P.Nothing else P.Just $ default_SubmitSort_args{submitSort_args_sessionId = submitSort_args_sessionId obj}- , if obj == default_SubmitSort_args{submitSort_args_unitIds = submitSort_args_unitIds obj} then P.Nothing else P.Just $ default_SubmitSort_args{submitSort_args_unitIds = submitSort_args_unitIds obj}- ]-from_SubmitSort_args :: SubmitSort_args -> T.ThriftVal-from_SubmitSort_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v63 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v63))) $ submitSort_args_sessionId record- , (\_v63 -> P.Just (2, ("unitIds",T.TList (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier) $ P.map (\_v65 -> Services_Types.from_AnnotationUnitIdentifier _v65) $ Vector.toList _v63))) $ submitSort_args_unitIds record- ]-write_SubmitSort_args :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_args -> P.IO ()-write_SubmitSort_args oprot record = T.writeVal oprot $ from_SubmitSort_args record-encode_SubmitSort_args :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_args -> LBS.ByteString-encode_SubmitSort_args oprot record = T.serializeVal oprot $ from_SubmitSort_args record-to_SubmitSort_args :: T.ThriftVal -> SubmitSort_args-to_SubmitSort_args (T.TStruct fields) = SubmitSort_args{- submitSort_args_sessionId = P.maybe (submitSort_args_sessionId default_SubmitSort_args) (\(_,_val67) -> (case _val67 of {T.TStruct _val68 -> (Uuid_Types.to_UUID (T.TStruct _val68)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- submitSort_args_unitIds = P.maybe (submitSort_args_unitIds default_SubmitSort_args) (\(_,_val67) -> (case _val67 of {T.TList _ _val69 -> (Vector.fromList $ P.map (\_v70 -> (case _v70 of {T.TStruct _val71 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val71)); _ -> P.error "wrong type"})) _val69); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_SubmitSort_args _ = P.error "not a struct"-read_SubmitSort_args :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitSort_args-read_SubmitSort_args iprot = to_SubmitSort_args <$> T.readVal iprot (T.T_STRUCT typemap_SubmitSort_args)-decode_SubmitSort_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitSort_args-decode_SubmitSort_args iprot bs = to_SubmitSort_args $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitSort_args) bs-typemap_SubmitSort_args :: T.TypeMap-typemap_SubmitSort_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("unitIds",(T.T_LIST (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier))))]-default_SubmitSort_args :: SubmitSort_args-default_SubmitSort_args = SubmitSort_args{- submitSort_args_sessionId = Uuid_Types.default_UUID,- submitSort_args_unitIds = Vector.empty}-data SubmitSort_result = SubmitSort_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitSort_result where- hashWithSalt salt record = salt -instance QC.Arbitrary SubmitSort_result where - arbitrary = QC.elements [SubmitSort_result]-from_SubmitSort_result :: SubmitSort_result -> T.ThriftVal-from_SubmitSort_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_SubmitSort_result :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_result -> P.IO ()-write_SubmitSort_result oprot record = T.writeVal oprot $ from_SubmitSort_result record-encode_SubmitSort_result :: (T.Protocol p, T.Transport t) => p t -> SubmitSort_result -> LBS.ByteString-encode_SubmitSort_result oprot record = T.serializeVal oprot $ from_SubmitSort_result record-to_SubmitSort_result :: T.ThriftVal -> SubmitSort_result-to_SubmitSort_result (T.TStruct fields) = SubmitSort_result{-- }-to_SubmitSort_result _ = P.error "not a struct"-read_SubmitSort_result :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitSort_result-read_SubmitSort_result iprot = to_SubmitSort_result <$> T.readVal iprot (T.T_STRUCT typemap_SubmitSort_result)-decode_SubmitSort_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitSort_result-decode_SubmitSort_result iprot bs = to_SubmitSort_result $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitSort_result) bs-typemap_SubmitSort_result :: T.TypeMap-typemap_SubmitSort_result = Map.fromList []-default_SubmitSort_result :: SubmitSort_result-default_SubmitSort_result = SubmitSort_result{-}-process_submitSort (seqid, iprot, oprot, handler) = do- args <- read_SubmitSort_args iprot- (X.catch- (do- Iface.submitSort handler (submitSort_args_sessionId args) (submitSort_args_unitIds args)- let res = default_SubmitSort_result- T.writeMessageBegin oprot ("submitSort", T.M_REPLY, seqid)- write_SubmitSort_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("submitSort", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "submitSort" -> process_submitSort (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/ActiveLearnerClientService_Client.hs
@@ -1,65 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ActiveLearnerClientService_Client(submitSort) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types-import ActiveLearnerClientService-seqid = R.newIORef 0-submitSort (ip,op) arg_sessionId arg_unitIds = do- send_submitSort op arg_sessionId arg_unitIds- recv_submitSort ip-send_submitSort op arg_sessionId arg_unitIds = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("submitSort", T.M_CALL, seqn)- write_SubmitSort_args op (SubmitSort_args{submitSort_args_sessionId=arg_sessionId,submitSort_args_unitIds=arg_unitIds})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_submitSort ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_SubmitSort_result ip- T.readMessageEnd ip- P.return ()
− src/Data/Concrete/Services/ActiveLearnerClientService_Iface.hs
@@ -1,49 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ActiveLearnerClientService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types--import Service_Iface-class Service_Iface a => ActiveLearnerClientService_Iface a where- submitSort :: a -> Uuid_Types.UUID -> (Vector.Vector Services_Types.AnnotationUnitIdentifier) -> P.IO ()
− src/Data/Concrete/Services/ActiveLearnerServerService.hs
@@ -1,302 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ActiveLearnerServerService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import qualified Service-import Learn_Types-import qualified ActiveLearnerServerService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Start_args = Start_args { start_args_sessionId :: Uuid_Types.UUID- , start_args_task :: AnnotationTask- , start_args_contact :: Services_Types.AsyncContactInfo- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Start_args where- hashWithSalt salt record = salt `H.hashWithSalt` start_args_sessionId record `H.hashWithSalt` start_args_task record `H.hashWithSalt` start_args_contact record -instance QC.Arbitrary Start_args where - arbitrary = M.liftM Start_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Start_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Start_args{start_args_sessionId = start_args_sessionId obj} then P.Nothing else P.Just $ default_Start_args{start_args_sessionId = start_args_sessionId obj}- , if obj == default_Start_args{start_args_task = start_args_task obj} then P.Nothing else P.Just $ default_Start_args{start_args_task = start_args_task obj}- , if obj == default_Start_args{start_args_contact = start_args_contact obj} then P.Nothing else P.Just $ default_Start_args{start_args_contact = start_args_contact obj}- ]-from_Start_args :: Start_args -> T.ThriftVal-from_Start_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v22 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v22))) $ start_args_sessionId record- , (\_v22 -> P.Just (2, ("task",from_AnnotationTask _v22))) $ start_args_task record- , (\_v22 -> P.Just (3, ("contact",Services_Types.from_AsyncContactInfo _v22))) $ start_args_contact record- ]-write_Start_args :: (T.Protocol p, T.Transport t) => p t -> Start_args -> P.IO ()-write_Start_args oprot record = T.writeVal oprot $ from_Start_args record-encode_Start_args :: (T.Protocol p, T.Transport t) => p t -> Start_args -> LBS.ByteString-encode_Start_args oprot record = T.serializeVal oprot $ from_Start_args record-to_Start_args :: T.ThriftVal -> Start_args-to_Start_args (T.TStruct fields) = Start_args{- start_args_sessionId = P.maybe (start_args_sessionId default_Start_args) (\(_,_val24) -> (case _val24 of {T.TStruct _val25 -> (Uuid_Types.to_UUID (T.TStruct _val25)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- start_args_task = P.maybe (start_args_task default_Start_args) (\(_,_val24) -> (case _val24 of {T.TStruct _val26 -> (to_AnnotationTask (T.TStruct _val26)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- start_args_contact = P.maybe (start_args_contact default_Start_args) (\(_,_val24) -> (case _val24 of {T.TStruct _val27 -> (Services_Types.to_AsyncContactInfo (T.TStruct _val27)); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Start_args _ = P.error "not a struct"-read_Start_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Start_args-read_Start_args iprot = to_Start_args <$> T.readVal iprot (T.T_STRUCT typemap_Start_args)-decode_Start_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Start_args-decode_Start_args iprot bs = to_Start_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Start_args) bs-typemap_Start_args :: T.TypeMap-typemap_Start_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("task",(T.T_STRUCT typemap_AnnotationTask))),(3,("contact",(T.T_STRUCT Services_Types.typemap_AsyncContactInfo)))]-default_Start_args :: Start_args-default_Start_args = Start_args{- start_args_sessionId = Uuid_Types.default_UUID,- start_args_task = default_AnnotationTask,- start_args_contact = Services_Types.default_AsyncContactInfo}-data Start_result = Start_result { start_result_success :: P.Bool- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Start_result where- hashWithSalt salt record = salt `H.hashWithSalt` start_result_success record -instance QC.Arbitrary Start_result where - arbitrary = M.liftM Start_result (QC.arbitrary)- shrink obj | obj == default_Start_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Start_result{start_result_success = start_result_success obj} then P.Nothing else P.Just $ default_Start_result{start_result_success = start_result_success obj}- ]-from_Start_result :: Start_result -> T.ThriftVal-from_Start_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v30 -> P.Just (0, ("success",T.TBool _v30))) $ start_result_success record- ]-write_Start_result :: (T.Protocol p, T.Transport t) => p t -> Start_result -> P.IO ()-write_Start_result oprot record = T.writeVal oprot $ from_Start_result record-encode_Start_result :: (T.Protocol p, T.Transport t) => p t -> Start_result -> LBS.ByteString-encode_Start_result oprot record = T.serializeVal oprot $ from_Start_result record-to_Start_result :: T.ThriftVal -> Start_result-to_Start_result (T.TStruct fields) = Start_result{- start_result_success = P.maybe (start_result_success default_Start_result) (\(_,_val32) -> (case _val32 of {T.TBool _val33 -> _val33; _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_Start_result _ = P.error "not a struct"-read_Start_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Start_result-read_Start_result iprot = to_Start_result <$> T.readVal iprot (T.T_STRUCT typemap_Start_result)-decode_Start_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Start_result-decode_Start_result iprot bs = to_Start_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Start_result) bs-typemap_Start_result :: T.TypeMap-typemap_Start_result = Map.fromList [(0,("success",T.T_BOOL))]-default_Start_result :: Start_result-default_Start_result = Start_result{- start_result_success = P.False}-data Stop_args = Stop_args { stop_args_sessionId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Stop_args where- hashWithSalt salt record = salt `H.hashWithSalt` stop_args_sessionId record -instance QC.Arbitrary Stop_args where - arbitrary = M.liftM Stop_args (QC.arbitrary)- shrink obj | obj == default_Stop_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Stop_args{stop_args_sessionId = stop_args_sessionId obj} then P.Nothing else P.Just $ default_Stop_args{stop_args_sessionId = stop_args_sessionId obj}- ]-from_Stop_args :: Stop_args -> T.ThriftVal-from_Stop_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v36 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v36))) $ stop_args_sessionId record- ]-write_Stop_args :: (T.Protocol p, T.Transport t) => p t -> Stop_args -> P.IO ()-write_Stop_args oprot record = T.writeVal oprot $ from_Stop_args record-encode_Stop_args :: (T.Protocol p, T.Transport t) => p t -> Stop_args -> LBS.ByteString-encode_Stop_args oprot record = T.serializeVal oprot $ from_Stop_args record-to_Stop_args :: T.ThriftVal -> Stop_args-to_Stop_args (T.TStruct fields) = Stop_args{- stop_args_sessionId = P.maybe (stop_args_sessionId default_Stop_args) (\(_,_val38) -> (case _val38 of {T.TStruct _val39 -> (Uuid_Types.to_UUID (T.TStruct _val39)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Stop_args _ = P.error "not a struct"-read_Stop_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Stop_args-read_Stop_args iprot = to_Stop_args <$> T.readVal iprot (T.T_STRUCT typemap_Stop_args)-decode_Stop_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Stop_args-decode_Stop_args iprot bs = to_Stop_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Stop_args) bs-typemap_Stop_args :: T.TypeMap-typemap_Stop_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_Stop_args :: Stop_args-default_Stop_args = Stop_args{- stop_args_sessionId = Uuid_Types.default_UUID}-data Stop_result = Stop_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Stop_result where- hashWithSalt salt record = salt -instance QC.Arbitrary Stop_result where - arbitrary = QC.elements [Stop_result]-from_Stop_result :: Stop_result -> T.ThriftVal-from_Stop_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Stop_result :: (T.Protocol p, T.Transport t) => p t -> Stop_result -> P.IO ()-write_Stop_result oprot record = T.writeVal oprot $ from_Stop_result record-encode_Stop_result :: (T.Protocol p, T.Transport t) => p t -> Stop_result -> LBS.ByteString-encode_Stop_result oprot record = T.serializeVal oprot $ from_Stop_result record-to_Stop_result :: T.ThriftVal -> Stop_result-to_Stop_result (T.TStruct fields) = Stop_result{-- }-to_Stop_result _ = P.error "not a struct"-read_Stop_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Stop_result-read_Stop_result iprot = to_Stop_result <$> T.readVal iprot (T.T_STRUCT typemap_Stop_result)-decode_Stop_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Stop_result-decode_Stop_result iprot bs = to_Stop_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Stop_result) bs-typemap_Stop_result :: T.TypeMap-typemap_Stop_result = Map.fromList []-default_Stop_result :: Stop_result-default_Stop_result = Stop_result{-}-data AddAnnotations_args = AddAnnotations_args { addAnnotations_args_sessionId :: Uuid_Types.UUID- , addAnnotations_args_annotations :: (Vector.Vector Annotation)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddAnnotations_args where- hashWithSalt salt record = salt `H.hashWithSalt` addAnnotations_args_sessionId record `H.hashWithSalt` addAnnotations_args_annotations record -instance QC.Arbitrary AddAnnotations_args where - arbitrary = M.liftM AddAnnotations_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AddAnnotations_args = []- | P.otherwise = M.catMaybes- [ if obj == default_AddAnnotations_args{addAnnotations_args_sessionId = addAnnotations_args_sessionId obj} then P.Nothing else P.Just $ default_AddAnnotations_args{addAnnotations_args_sessionId = addAnnotations_args_sessionId obj}- , if obj == default_AddAnnotations_args{addAnnotations_args_annotations = addAnnotations_args_annotations obj} then P.Nothing else P.Just $ default_AddAnnotations_args{addAnnotations_args_annotations = addAnnotations_args_annotations obj}- ]-from_AddAnnotations_args :: AddAnnotations_args -> T.ThriftVal-from_AddAnnotations_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v47 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v47))) $ addAnnotations_args_sessionId record- , (\_v47 -> P.Just (2, ("annotations",T.TList (T.T_STRUCT typemap_Annotation) $ P.map (\_v49 -> from_Annotation _v49) $ Vector.toList _v47))) $ addAnnotations_args_annotations record- ]-write_AddAnnotations_args :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_args -> P.IO ()-write_AddAnnotations_args oprot record = T.writeVal oprot $ from_AddAnnotations_args record-encode_AddAnnotations_args :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_args -> LBS.ByteString-encode_AddAnnotations_args oprot record = T.serializeVal oprot $ from_AddAnnotations_args record-to_AddAnnotations_args :: T.ThriftVal -> AddAnnotations_args-to_AddAnnotations_args (T.TStruct fields) = AddAnnotations_args{- addAnnotations_args_sessionId = P.maybe (addAnnotations_args_sessionId default_AddAnnotations_args) (\(_,_val51) -> (case _val51 of {T.TStruct _val52 -> (Uuid_Types.to_UUID (T.TStruct _val52)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- addAnnotations_args_annotations = P.maybe (addAnnotations_args_annotations default_AddAnnotations_args) (\(_,_val51) -> (case _val51 of {T.TList _ _val53 -> (Vector.fromList $ P.map (\_v54 -> (case _v54 of {T.TStruct _val55 -> (to_Annotation (T.TStruct _val55)); _ -> P.error "wrong type"})) _val53); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_AddAnnotations_args _ = P.error "not a struct"-read_AddAnnotations_args :: (T.Transport t, T.Protocol p) => p t -> P.IO AddAnnotations_args-read_AddAnnotations_args iprot = to_AddAnnotations_args <$> T.readVal iprot (T.T_STRUCT typemap_AddAnnotations_args)-decode_AddAnnotations_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddAnnotations_args-decode_AddAnnotations_args iprot bs = to_AddAnnotations_args $ T.deserializeVal iprot (T.T_STRUCT typemap_AddAnnotations_args) bs-typemap_AddAnnotations_args :: T.TypeMap-typemap_AddAnnotations_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("annotations",(T.T_LIST (T.T_STRUCT typemap_Annotation))))]-default_AddAnnotations_args :: AddAnnotations_args-default_AddAnnotations_args = AddAnnotations_args{- addAnnotations_args_sessionId = Uuid_Types.default_UUID,- addAnnotations_args_annotations = Vector.empty}-data AddAnnotations_result = AddAnnotations_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddAnnotations_result where- hashWithSalt salt record = salt -instance QC.Arbitrary AddAnnotations_result where - arbitrary = QC.elements [AddAnnotations_result]-from_AddAnnotations_result :: AddAnnotations_result -> T.ThriftVal-from_AddAnnotations_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_AddAnnotations_result :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_result -> P.IO ()-write_AddAnnotations_result oprot record = T.writeVal oprot $ from_AddAnnotations_result record-encode_AddAnnotations_result :: (T.Protocol p, T.Transport t) => p t -> AddAnnotations_result -> LBS.ByteString-encode_AddAnnotations_result oprot record = T.serializeVal oprot $ from_AddAnnotations_result record-to_AddAnnotations_result :: T.ThriftVal -> AddAnnotations_result-to_AddAnnotations_result (T.TStruct fields) = AddAnnotations_result{-- }-to_AddAnnotations_result _ = P.error "not a struct"-read_AddAnnotations_result :: (T.Transport t, T.Protocol p) => p t -> P.IO AddAnnotations_result-read_AddAnnotations_result iprot = to_AddAnnotations_result <$> T.readVal iprot (T.T_STRUCT typemap_AddAnnotations_result)-decode_AddAnnotations_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddAnnotations_result-decode_AddAnnotations_result iprot bs = to_AddAnnotations_result $ T.deserializeVal iprot (T.T_STRUCT typemap_AddAnnotations_result) bs-typemap_AddAnnotations_result :: T.TypeMap-typemap_AddAnnotations_result = Map.fromList []-default_AddAnnotations_result :: AddAnnotations_result-default_AddAnnotations_result = AddAnnotations_result{-}-process_start (seqid, iprot, oprot, handler) = do- args <- read_Start_args iprot- (X.catch- (do- val <- Iface.start handler (start_args_sessionId args) (start_args_task args) (start_args_contact args)- let res = default_Start_result{start_result_success = val}- T.writeMessageBegin oprot ("start", T.M_REPLY, seqid)- write_Start_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("start", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_stop (seqid, iprot, oprot, handler) = do- args <- read_Stop_args iprot- (X.catch- (do- Iface.stop handler (stop_args_sessionId args)- let res = default_Stop_result- T.writeMessageBegin oprot ("stop", T.M_REPLY, seqid)- write_Stop_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("stop", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_addAnnotations (seqid, iprot, oprot, handler) = do- args <- read_AddAnnotations_args iprot- (X.catch- (do- Iface.addAnnotations handler (addAnnotations_args_sessionId args) (addAnnotations_args_annotations args)- let res = default_AddAnnotations_result- T.writeMessageBegin oprot ("addAnnotations", T.M_REPLY, seqid)- write_AddAnnotations_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("addAnnotations", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "start" -> process_start (seqid,iprot,oprot,handler)- "stop" -> process_stop (seqid,iprot,oprot,handler)- "addAnnotations" -> process_addAnnotations (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/ActiveLearnerServerService_Client.hs
@@ -1,97 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ActiveLearnerServerService_Client(start,stop,addAnnotations) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types-import ActiveLearnerServerService-seqid = R.newIORef 0-start (ip,op) arg_sessionId arg_task arg_contact = do- send_start op arg_sessionId arg_task arg_contact- recv_start ip-send_start op arg_sessionId arg_task arg_contact = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("start", T.M_CALL, seqn)- write_Start_args op (Start_args{start_args_sessionId=arg_sessionId,start_args_task=arg_task,start_args_contact=arg_contact})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_start ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Start_result ip- T.readMessageEnd ip- P.return $ start_result_success res-stop (ip,op) arg_sessionId = do- send_stop op arg_sessionId- recv_stop ip-send_stop op arg_sessionId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("stop", T.M_CALL, seqn)- write_Stop_args op (Stop_args{stop_args_sessionId=arg_sessionId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_stop ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Stop_result ip- T.readMessageEnd ip- P.return ()-addAnnotations (ip,op) arg_sessionId arg_annotations = do- send_addAnnotations op arg_sessionId arg_annotations- recv_addAnnotations ip-send_addAnnotations op arg_sessionId arg_annotations = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("addAnnotations", T.M_CALL, seqn)- write_AddAnnotations_args op (AddAnnotations_args{addAnnotations_args_sessionId=arg_sessionId,addAnnotations_args_annotations=arg_annotations})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_addAnnotations ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_AddAnnotations_result ip- T.readMessageEnd ip- P.return ()
− src/Data/Concrete/Services/ActiveLearnerServerService_Iface.hs
@@ -1,51 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ActiveLearnerServerService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types--import Service_Iface-class Service_Iface a => ActiveLearnerServerService_Iface a where- start :: a -> Uuid_Types.UUID -> AnnotationTask -> Services_Types.AsyncContactInfo -> P.IO P.Bool- stop :: a -> Uuid_Types.UUID -> P.IO ()- addAnnotations :: a -> Uuid_Types.UUID -> (Vector.Vector Annotation) -> P.IO ()
− src/Data/Concrete/Services/AnnotateCommunicationService.hs
@@ -1,372 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.AnnotateCommunicationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types-import qualified AnnotateCommunicationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Annotate_args = Annotate_args { annotate_args_original :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Annotate_args where- hashWithSalt salt record = salt `H.hashWithSalt` annotate_args_original record -instance QC.Arbitrary Annotate_args where - arbitrary = M.liftM Annotate_args (QC.arbitrary)- shrink obj | obj == default_Annotate_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Annotate_args{annotate_args_original = annotate_args_original obj} then P.Nothing else P.Just $ default_Annotate_args{annotate_args_original = annotate_args_original obj}- ]-from_Annotate_args :: Annotate_args -> T.ThriftVal-from_Annotate_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("original",Communication_Types.from_Communication _v2))) $ annotate_args_original record- ]-write_Annotate_args :: (T.Protocol p, T.Transport t) => p t -> Annotate_args -> P.IO ()-write_Annotate_args oprot record = T.writeVal oprot $ from_Annotate_args record-encode_Annotate_args :: (T.Protocol p, T.Transport t) => p t -> Annotate_args -> LBS.ByteString-encode_Annotate_args oprot record = T.serializeVal oprot $ from_Annotate_args record-to_Annotate_args :: T.ThriftVal -> Annotate_args-to_Annotate_args (T.TStruct fields) = Annotate_args{- annotate_args_original = P.maybe (annotate_args_original default_Annotate_args) (\(_,_val4) -> (case _val4 of {T.TStruct _val5 -> (Communication_Types.to_Communication (T.TStruct _val5)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Annotate_args _ = P.error "not a struct"-read_Annotate_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Annotate_args-read_Annotate_args iprot = to_Annotate_args <$> T.readVal iprot (T.T_STRUCT typemap_Annotate_args)-decode_Annotate_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Annotate_args-decode_Annotate_args iprot bs = to_Annotate_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Annotate_args) bs-typemap_Annotate_args :: T.TypeMap-typemap_Annotate_args = Map.fromList [(1,("original",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_Annotate_args :: Annotate_args-default_Annotate_args = Annotate_args{- annotate_args_original = Communication_Types.default_Communication}-data Annotate_result = Annotate_result { annotate_result_success :: Communication_Types.Communication- , annotate_result_ex :: P.Maybe Ex_Types.ConcreteThriftException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Annotate_result where- hashWithSalt salt record = salt `H.hashWithSalt` annotate_result_success record `H.hashWithSalt` annotate_result_ex record -instance QC.Arbitrary Annotate_result where - arbitrary = M.liftM Annotate_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Annotate_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Annotate_result{annotate_result_success = annotate_result_success obj} then P.Nothing else P.Just $ default_Annotate_result{annotate_result_success = annotate_result_success obj}- , if obj == default_Annotate_result{annotate_result_ex = annotate_result_ex obj} then P.Nothing else P.Just $ default_Annotate_result{annotate_result_ex = annotate_result_ex obj}- ]-from_Annotate_result :: Annotate_result -> T.ThriftVal-from_Annotate_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v8 -> (1, ("ex",Ex_Types.from_ConcreteThriftException _v8))) <$> annotate_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v8 -> P.Just (0, ("success",Communication_Types.from_Communication _v8))) $ annotate_result_success record- , (\_v8 -> (1, ("ex",Ex_Types.from_ConcreteThriftException _v8))) <$> annotate_result_ex record- ]- )-write_Annotate_result :: (T.Protocol p, T.Transport t) => p t -> Annotate_result -> P.IO ()-write_Annotate_result oprot record = T.writeVal oprot $ from_Annotate_result record-encode_Annotate_result :: (T.Protocol p, T.Transport t) => p t -> Annotate_result -> LBS.ByteString-encode_Annotate_result oprot record = T.serializeVal oprot $ from_Annotate_result record-to_Annotate_result :: T.ThriftVal -> Annotate_result-to_Annotate_result (T.TStruct fields) = Annotate_result{- annotate_result_success = P.maybe (annotate_result_success default_Annotate_result) (\(_,_val10) -> (case _val10 of {T.TStruct _val11 -> (Communication_Types.to_Communication (T.TStruct _val11)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- annotate_result_ex = P.maybe (P.Nothing) (\(_,_val10) -> P.Just (case _val10 of {T.TStruct _val12 -> (Ex_Types.to_ConcreteThriftException (T.TStruct _val12)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Annotate_result _ = P.error "not a struct"-read_Annotate_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Annotate_result-read_Annotate_result iprot = to_Annotate_result <$> T.readVal iprot (T.T_STRUCT typemap_Annotate_result)-decode_Annotate_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Annotate_result-decode_Annotate_result iprot bs = to_Annotate_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Annotate_result) bs-typemap_Annotate_result :: T.TypeMap-typemap_Annotate_result = Map.fromList [(0,("success",(T.T_STRUCT Communication_Types.typemap_Communication))),(1,("ex",(T.T_STRUCT Ex_Types.typemap_ConcreteThriftException)))]-default_Annotate_result :: Annotate_result-default_Annotate_result = Annotate_result{- annotate_result_success = Communication_Types.default_Communication,- annotate_result_ex = P.Nothing}-data GetMetadata_args = GetMetadata_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetMetadata_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetMetadata_args where - arbitrary = QC.elements [GetMetadata_args]-from_GetMetadata_args :: GetMetadata_args -> T.ThriftVal-from_GetMetadata_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetMetadata_args :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_args -> P.IO ()-write_GetMetadata_args oprot record = T.writeVal oprot $ from_GetMetadata_args record-encode_GetMetadata_args :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_args -> LBS.ByteString-encode_GetMetadata_args oprot record = T.serializeVal oprot $ from_GetMetadata_args record-to_GetMetadata_args :: T.ThriftVal -> GetMetadata_args-to_GetMetadata_args (T.TStruct fields) = GetMetadata_args{-- }-to_GetMetadata_args _ = P.error "not a struct"-read_GetMetadata_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetMetadata_args-read_GetMetadata_args iprot = to_GetMetadata_args <$> T.readVal iprot (T.T_STRUCT typemap_GetMetadata_args)-decode_GetMetadata_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetMetadata_args-decode_GetMetadata_args iprot bs = to_GetMetadata_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetMetadata_args) bs-typemap_GetMetadata_args :: T.TypeMap-typemap_GetMetadata_args = Map.fromList []-default_GetMetadata_args :: GetMetadata_args-default_GetMetadata_args = GetMetadata_args{-}-data GetMetadata_result = GetMetadata_result { getMetadata_result_success :: Metadata_Types.AnnotationMetadata- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetMetadata_result where- hashWithSalt salt record = salt `H.hashWithSalt` getMetadata_result_success record -instance QC.Arbitrary GetMetadata_result where - arbitrary = M.liftM GetMetadata_result (QC.arbitrary)- shrink obj | obj == default_GetMetadata_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetMetadata_result{getMetadata_result_success = getMetadata_result_success obj} then P.Nothing else P.Just $ default_GetMetadata_result{getMetadata_result_success = getMetadata_result_success obj}- ]-from_GetMetadata_result :: GetMetadata_result -> T.ThriftVal-from_GetMetadata_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v20 -> P.Just (0, ("success",Metadata_Types.from_AnnotationMetadata _v20))) $ getMetadata_result_success record- ]-write_GetMetadata_result :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_result -> P.IO ()-write_GetMetadata_result oprot record = T.writeVal oprot $ from_GetMetadata_result record-encode_GetMetadata_result :: (T.Protocol p, T.Transport t) => p t -> GetMetadata_result -> LBS.ByteString-encode_GetMetadata_result oprot record = T.serializeVal oprot $ from_GetMetadata_result record-to_GetMetadata_result :: T.ThriftVal -> GetMetadata_result-to_GetMetadata_result (T.TStruct fields) = GetMetadata_result{- getMetadata_result_success = P.maybe (getMetadata_result_success default_GetMetadata_result) (\(_,_val22) -> (case _val22 of {T.TStruct _val23 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val23)); _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_GetMetadata_result _ = P.error "not a struct"-read_GetMetadata_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetMetadata_result-read_GetMetadata_result iprot = to_GetMetadata_result <$> T.readVal iprot (T.T_STRUCT typemap_GetMetadata_result)-decode_GetMetadata_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetMetadata_result-decode_GetMetadata_result iprot bs = to_GetMetadata_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetMetadata_result) bs-typemap_GetMetadata_result :: T.TypeMap-typemap_GetMetadata_result = Map.fromList [(0,("success",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata)))]-default_GetMetadata_result :: GetMetadata_result-default_GetMetadata_result = GetMetadata_result{- getMetadata_result_success = Metadata_Types.default_AnnotationMetadata}-data GetDocumentation_args = GetDocumentation_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetDocumentation_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetDocumentation_args where - arbitrary = QC.elements [GetDocumentation_args]-from_GetDocumentation_args :: GetDocumentation_args -> T.ThriftVal-from_GetDocumentation_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetDocumentation_args :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_args -> P.IO ()-write_GetDocumentation_args oprot record = T.writeVal oprot $ from_GetDocumentation_args record-encode_GetDocumentation_args :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_args -> LBS.ByteString-encode_GetDocumentation_args oprot record = T.serializeVal oprot $ from_GetDocumentation_args record-to_GetDocumentation_args :: T.ThriftVal -> GetDocumentation_args-to_GetDocumentation_args (T.TStruct fields) = GetDocumentation_args{-- }-to_GetDocumentation_args _ = P.error "not a struct"-read_GetDocumentation_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetDocumentation_args-read_GetDocumentation_args iprot = to_GetDocumentation_args <$> T.readVal iprot (T.T_STRUCT typemap_GetDocumentation_args)-decode_GetDocumentation_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetDocumentation_args-decode_GetDocumentation_args iprot bs = to_GetDocumentation_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetDocumentation_args) bs-typemap_GetDocumentation_args :: T.TypeMap-typemap_GetDocumentation_args = Map.fromList []-default_GetDocumentation_args :: GetDocumentation_args-default_GetDocumentation_args = GetDocumentation_args{-}-data GetDocumentation_result = GetDocumentation_result { getDocumentation_result_success :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetDocumentation_result where- hashWithSalt salt record = salt `H.hashWithSalt` getDocumentation_result_success record -instance QC.Arbitrary GetDocumentation_result where - arbitrary = M.liftM GetDocumentation_result (QC.arbitrary)- shrink obj | obj == default_GetDocumentation_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetDocumentation_result{getDocumentation_result_success = getDocumentation_result_success obj} then P.Nothing else P.Just $ default_GetDocumentation_result{getDocumentation_result_success = getDocumentation_result_success obj}- ]-from_GetDocumentation_result :: GetDocumentation_result -> T.ThriftVal-from_GetDocumentation_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v31 -> P.Just (0, ("success",T.TString $ E.encodeUtf8 _v31))) $ getDocumentation_result_success record- ]-write_GetDocumentation_result :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_result -> P.IO ()-write_GetDocumentation_result oprot record = T.writeVal oprot $ from_GetDocumentation_result record-encode_GetDocumentation_result :: (T.Protocol p, T.Transport t) => p t -> GetDocumentation_result -> LBS.ByteString-encode_GetDocumentation_result oprot record = T.serializeVal oprot $ from_GetDocumentation_result record-to_GetDocumentation_result :: T.ThriftVal -> GetDocumentation_result-to_GetDocumentation_result (T.TStruct fields) = GetDocumentation_result{- getDocumentation_result_success = P.maybe (getDocumentation_result_success default_GetDocumentation_result) (\(_,_val33) -> (case _val33 of {T.TString _val34 -> E.decodeUtf8 _val34; _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_GetDocumentation_result _ = P.error "not a struct"-read_GetDocumentation_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetDocumentation_result-read_GetDocumentation_result iprot = to_GetDocumentation_result <$> T.readVal iprot (T.T_STRUCT typemap_GetDocumentation_result)-decode_GetDocumentation_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetDocumentation_result-decode_GetDocumentation_result iprot bs = to_GetDocumentation_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetDocumentation_result) bs-typemap_GetDocumentation_result :: T.TypeMap-typemap_GetDocumentation_result = Map.fromList [(0,("success",T.T_STRING))]-default_GetDocumentation_result :: GetDocumentation_result-default_GetDocumentation_result = GetDocumentation_result{- getDocumentation_result_success = ""}-data Shutdown_args = Shutdown_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Shutdown_args where- hashWithSalt salt record = salt -instance QC.Arbitrary Shutdown_args where - arbitrary = QC.elements [Shutdown_args]-from_Shutdown_args :: Shutdown_args -> T.ThriftVal-from_Shutdown_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Shutdown_args :: (T.Protocol p, T.Transport t) => p t -> Shutdown_args -> P.IO ()-write_Shutdown_args oprot record = T.writeVal oprot $ from_Shutdown_args record-encode_Shutdown_args :: (T.Protocol p, T.Transport t) => p t -> Shutdown_args -> LBS.ByteString-encode_Shutdown_args oprot record = T.serializeVal oprot $ from_Shutdown_args record-to_Shutdown_args :: T.ThriftVal -> Shutdown_args-to_Shutdown_args (T.TStruct fields) = Shutdown_args{-- }-to_Shutdown_args _ = P.error "not a struct"-read_Shutdown_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Shutdown_args-read_Shutdown_args iprot = to_Shutdown_args <$> T.readVal iprot (T.T_STRUCT typemap_Shutdown_args)-decode_Shutdown_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Shutdown_args-decode_Shutdown_args iprot bs = to_Shutdown_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Shutdown_args) bs-typemap_Shutdown_args :: T.TypeMap-typemap_Shutdown_args = Map.fromList []-default_Shutdown_args :: Shutdown_args-default_Shutdown_args = Shutdown_args{-}-data Shutdown_result = Shutdown_result deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Shutdown_result where- hashWithSalt salt record = salt -instance QC.Arbitrary Shutdown_result where - arbitrary = QC.elements [Shutdown_result]-from_Shutdown_result :: Shutdown_result -> T.ThriftVal-from_Shutdown_result record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Shutdown_result :: (T.Protocol p, T.Transport t) => p t -> Shutdown_result -> P.IO ()-write_Shutdown_result oprot record = T.writeVal oprot $ from_Shutdown_result record-encode_Shutdown_result :: (T.Protocol p, T.Transport t) => p t -> Shutdown_result -> LBS.ByteString-encode_Shutdown_result oprot record = T.serializeVal oprot $ from_Shutdown_result record-to_Shutdown_result :: T.ThriftVal -> Shutdown_result-to_Shutdown_result (T.TStruct fields) = Shutdown_result{-- }-to_Shutdown_result _ = P.error "not a struct"-read_Shutdown_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Shutdown_result-read_Shutdown_result iprot = to_Shutdown_result <$> T.readVal iprot (T.T_STRUCT typemap_Shutdown_result)-decode_Shutdown_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Shutdown_result-decode_Shutdown_result iprot bs = to_Shutdown_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Shutdown_result) bs-typemap_Shutdown_result :: T.TypeMap-typemap_Shutdown_result = Map.fromList []-default_Shutdown_result :: Shutdown_result-default_Shutdown_result = Shutdown_result{-}-process_annotate (seqid, iprot, oprot, handler) = do- args <- read_Annotate_args iprot- (X.catch- (X.catch- (do- val <- Iface.annotate handler (annotate_args_original args)- let res = default_Annotate_result{annotate_result_success = val}- T.writeMessageBegin oprot ("annotate", T.M_REPLY, seqid)- write_Annotate_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Annotate_result{annotate_result_ex = P.Just e}- T.writeMessageBegin oprot ("annotate", T.M_REPLY, seqid)- write_Annotate_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("annotate", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getMetadata (seqid, iprot, oprot, handler) = do- args <- read_GetMetadata_args iprot- (X.catch- (do- val <- Iface.getMetadata handler- let res = default_GetMetadata_result{getMetadata_result_success = val}- T.writeMessageBegin oprot ("getMetadata", T.M_REPLY, seqid)- write_GetMetadata_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("getMetadata", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getDocumentation (seqid, iprot, oprot, handler) = do- args <- read_GetDocumentation_args iprot- (X.catch- (do- val <- Iface.getDocumentation handler- let res = default_GetDocumentation_result{getDocumentation_result_success = val}- T.writeMessageBegin oprot ("getDocumentation", T.M_REPLY, seqid)- write_GetDocumentation_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("getDocumentation", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_shutdown (seqid, iprot, oprot, handler) = do- args <- read_Shutdown_args iprot- (X.catch- (do- Iface.shutdown handler- P.return ())- ((\_ -> do- P.return ()) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "annotate" -> process_annotate (seqid,iprot,oprot,handler)- "getMetadata" -> process_getMetadata (seqid,iprot,oprot,handler)- "getDocumentation" -> process_getDocumentation (seqid,iprot,oprot,handler)- "shutdown" -> process_shutdown (seqid,iprot,oprot,handler)- _ -> do- _ <- T.readVal iprot (T.T_STRUCT Map.empty)- T.writeMessageBegin oprot (name,T.M_EXCEPTION,seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN_METHOD ("Unknown function " ++ LT.unpack name))- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/AnnotateCommunicationService_Client.hs
@@ -1,113 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.AnnotateCommunicationService_Client(annotate,getMetadata,getDocumentation,shutdown) where-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types-import AnnotateCommunicationService-seqid = R.newIORef 0-annotate (ip,op) arg_original = do- send_annotate op arg_original- recv_annotate ip-send_annotate op arg_original = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("annotate", T.M_CALL, seqn)- write_Annotate_args op (Annotate_args{annotate_args_original=arg_original})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_annotate ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Annotate_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (annotate_result_ex res)- P.return $ annotate_result_success res-getMetadata (ip,op) = do- send_getMetadata op- recv_getMetadata ip-send_getMetadata op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getMetadata", T.M_CALL, seqn)- write_GetMetadata_args op (GetMetadata_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getMetadata ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetMetadata_result ip- T.readMessageEnd ip- P.return $ getMetadata_result_success res-getDocumentation (ip,op) = do- send_getDocumentation op- recv_getDocumentation ip-send_getDocumentation op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getDocumentation", T.M_CALL, seqn)- write_GetDocumentation_args op (GetDocumentation_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getDocumentation ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetDocumentation_result ip- T.readMessageEnd ip- P.return $ getDocumentation_result_success res-shutdown (ip,op) = do- send_shutdown op-send_shutdown op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("shutdown", T.M_ONEWAY, seqn)- write_Shutdown_args op (Shutdown_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)
− src/Data/Concrete/Services/AnnotateCommunicationService_Iface.hs
@@ -1,58 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.AnnotateCommunicationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Language_Types-import qualified Structure_Types-import qualified Entities_Types-import qualified Situations_Types-import qualified Ex_Types-import qualified Email_Types-import qualified Twitter_Types-import qualified Audio_Types-import qualified Communication_Types---import Annotate_Types--class AnnotateCommunicationService_Iface a where- annotate :: a -> Communication_Types.Communication -> P.IO Communication_Types.Communication- getMetadata :: a -> P.IO Metadata_Types.AnnotationMetadata- getDocumentation :: a -> P.IO LT.Text- shutdown :: a -> P.IO ()
− src/Data/Concrete/Services/FeedbackService.hs
@@ -1,359 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.FeedbackService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import qualified Service-import Search_Types-import qualified FeedbackService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data StartFeedback_args = StartFeedback_args { startFeedback_args_results :: SearchResult- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartFeedback_args where- hashWithSalt salt record = salt `H.hashWithSalt` startFeedback_args_results record -instance QC.Arbitrary StartFeedback_args where - arbitrary = M.liftM StartFeedback_args (QC.arbitrary)- shrink obj | obj == default_StartFeedback_args = []- | P.otherwise = M.catMaybes- [ if obj == default_StartFeedback_args{startFeedback_args_results = startFeedback_args_results obj} then P.Nothing else P.Just $ default_StartFeedback_args{startFeedback_args_results = startFeedback_args_results obj}- ]-from_StartFeedback_args :: StartFeedback_args -> T.ThriftVal-from_StartFeedback_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v173 -> P.Just (1, ("results",from_SearchResult _v173))) $ startFeedback_args_results record- ]-write_StartFeedback_args :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_args -> P.IO ()-write_StartFeedback_args oprot record = T.writeVal oprot $ from_StartFeedback_args record-encode_StartFeedback_args :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_args -> LBS.ByteString-encode_StartFeedback_args oprot record = T.serializeVal oprot $ from_StartFeedback_args record-to_StartFeedback_args :: T.ThriftVal -> StartFeedback_args-to_StartFeedback_args (T.TStruct fields) = StartFeedback_args{- startFeedback_args_results = P.maybe (startFeedback_args_results default_StartFeedback_args) (\(_,_val175) -> (case _val175 of {T.TStruct _val176 -> (to_SearchResult (T.TStruct _val176)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StartFeedback_args _ = P.error "not a struct"-read_StartFeedback_args :: (T.Transport t, T.Protocol p) => p t -> P.IO StartFeedback_args-read_StartFeedback_args iprot = to_StartFeedback_args <$> T.readVal iprot (T.T_STRUCT typemap_StartFeedback_args)-decode_StartFeedback_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartFeedback_args-decode_StartFeedback_args iprot bs = to_StartFeedback_args $ T.deserializeVal iprot (T.T_STRUCT typemap_StartFeedback_args) bs-typemap_StartFeedback_args :: T.TypeMap-typemap_StartFeedback_args = Map.fromList [(1,("results",(T.T_STRUCT typemap_SearchResult)))]-default_StartFeedback_args :: StartFeedback_args-default_StartFeedback_args = StartFeedback_args{- startFeedback_args_results = default_SearchResult}-data StartFeedback_result = StartFeedback_result { startFeedback_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartFeedback_result where- hashWithSalt salt record = salt `H.hashWithSalt` startFeedback_result_ex record -instance QC.Arbitrary StartFeedback_result where - arbitrary = M.liftM StartFeedback_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_StartFeedback_result = []- | P.otherwise = M.catMaybes- [ if obj == default_StartFeedback_result{startFeedback_result_ex = startFeedback_result_ex obj} then P.Nothing else P.Just $ default_StartFeedback_result{startFeedback_result_ex = startFeedback_result_ex obj}- ]-from_StartFeedback_result :: StartFeedback_result -> T.ThriftVal-from_StartFeedback_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v179 -> (1, ("ex",Services_Types.from_ServicesException _v179))) <$> startFeedback_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v179 -> (1, ("ex",Services_Types.from_ServicesException _v179))) <$> startFeedback_result_ex record- ]- )-write_StartFeedback_result :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_result -> P.IO ()-write_StartFeedback_result oprot record = T.writeVal oprot $ from_StartFeedback_result record-encode_StartFeedback_result :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_result -> LBS.ByteString-encode_StartFeedback_result oprot record = T.serializeVal oprot $ from_StartFeedback_result record-to_StartFeedback_result :: T.ThriftVal -> StartFeedback_result-to_StartFeedback_result (T.TStruct fields) = StartFeedback_result{- startFeedback_result_ex = P.maybe (P.Nothing) (\(_,_val181) -> P.Just (case _val181 of {T.TStruct _val182 -> (Services_Types.to_ServicesException (T.TStruct _val182)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StartFeedback_result _ = P.error "not a struct"-read_StartFeedback_result :: (T.Transport t, T.Protocol p) => p t -> P.IO StartFeedback_result-read_StartFeedback_result iprot = to_StartFeedback_result <$> T.readVal iprot (T.T_STRUCT typemap_StartFeedback_result)-decode_StartFeedback_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartFeedback_result-decode_StartFeedback_result iprot bs = to_StartFeedback_result $ T.deserializeVal iprot (T.T_STRUCT typemap_StartFeedback_result) bs-typemap_StartFeedback_result :: T.TypeMap-typemap_StartFeedback_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_StartFeedback_result :: StartFeedback_result-default_StartFeedback_result = StartFeedback_result{- startFeedback_result_ex = P.Nothing}-data AddCommunicationFeedback_args = AddCommunicationFeedback_args { addCommunicationFeedback_args_searchResultsId :: Uuid_Types.UUID- , addCommunicationFeedback_args_communicationId :: LT.Text- , addCommunicationFeedback_args_feedback :: SearchFeedback- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddCommunicationFeedback_args where- hashWithSalt salt record = salt `H.hashWithSalt` addCommunicationFeedback_args_searchResultsId record `H.hashWithSalt` addCommunicationFeedback_args_communicationId record `H.hashWithSalt` addCommunicationFeedback_args_feedback record -instance QC.Arbitrary AddCommunicationFeedback_args where - arbitrary = M.liftM AddCommunicationFeedback_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AddCommunicationFeedback_args = []- | P.otherwise = M.catMaybes- [ if obj == default_AddCommunicationFeedback_args{addCommunicationFeedback_args_searchResultsId = addCommunicationFeedback_args_searchResultsId obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_args{addCommunicationFeedback_args_searchResultsId = addCommunicationFeedback_args_searchResultsId obj}- , if obj == default_AddCommunicationFeedback_args{addCommunicationFeedback_args_communicationId = addCommunicationFeedback_args_communicationId obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_args{addCommunicationFeedback_args_communicationId = addCommunicationFeedback_args_communicationId obj}- , if obj == default_AddCommunicationFeedback_args{addCommunicationFeedback_args_feedback = addCommunicationFeedback_args_feedback obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_args{addCommunicationFeedback_args_feedback = addCommunicationFeedback_args_feedback obj}- ]-from_AddCommunicationFeedback_args :: AddCommunicationFeedback_args -> T.ThriftVal-from_AddCommunicationFeedback_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v185 -> P.Just (1, ("searchResultsId",Uuid_Types.from_UUID _v185))) $ addCommunicationFeedback_args_searchResultsId record- , (\_v185 -> P.Just (2, ("communicationId",T.TString $ E.encodeUtf8 _v185))) $ addCommunicationFeedback_args_communicationId record- , (\_v185 -> P.Just (3, ("feedback",T.TI32 $ P.fromIntegral $ P.fromEnum _v185))) $ addCommunicationFeedback_args_feedback record- ]-write_AddCommunicationFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_args -> P.IO ()-write_AddCommunicationFeedback_args oprot record = T.writeVal oprot $ from_AddCommunicationFeedback_args record-encode_AddCommunicationFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_args -> LBS.ByteString-encode_AddCommunicationFeedback_args oprot record = T.serializeVal oprot $ from_AddCommunicationFeedback_args record-to_AddCommunicationFeedback_args :: T.ThriftVal -> AddCommunicationFeedback_args-to_AddCommunicationFeedback_args (T.TStruct fields) = AddCommunicationFeedback_args{- addCommunicationFeedback_args_searchResultsId = P.maybe (addCommunicationFeedback_args_searchResultsId default_AddCommunicationFeedback_args) (\(_,_val187) -> (case _val187 of {T.TStruct _val188 -> (Uuid_Types.to_UUID (T.TStruct _val188)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- addCommunicationFeedback_args_communicationId = P.maybe (addCommunicationFeedback_args_communicationId default_AddCommunicationFeedback_args) (\(_,_val187) -> (case _val187 of {T.TString _val189 -> E.decodeUtf8 _val189; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- addCommunicationFeedback_args_feedback = P.maybe (addCommunicationFeedback_args_feedback default_AddCommunicationFeedback_args) (\(_,_val187) -> (case _val187 of {T.TI32 _val190 -> P.toEnum $ P.fromIntegral _val190; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_AddCommunicationFeedback_args _ = P.error "not a struct"-read_AddCommunicationFeedback_args :: (T.Transport t, T.Protocol p) => p t -> P.IO AddCommunicationFeedback_args-read_AddCommunicationFeedback_args iprot = to_AddCommunicationFeedback_args <$> T.readVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_args)-decode_AddCommunicationFeedback_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddCommunicationFeedback_args-decode_AddCommunicationFeedback_args iprot bs = to_AddCommunicationFeedback_args $ T.deserializeVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_args) bs-typemap_AddCommunicationFeedback_args :: T.TypeMap-typemap_AddCommunicationFeedback_args = Map.fromList [(1,("searchResultsId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("communicationId",T.T_STRING)),(3,("feedback",T.T_I32))]-default_AddCommunicationFeedback_args :: AddCommunicationFeedback_args-default_AddCommunicationFeedback_args = AddCommunicationFeedback_args{- addCommunicationFeedback_args_searchResultsId = Uuid_Types.default_UUID,- addCommunicationFeedback_args_communicationId = "",- addCommunicationFeedback_args_feedback = (P.toEnum 0)}-data AddCommunicationFeedback_result = AddCommunicationFeedback_result { addCommunicationFeedback_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddCommunicationFeedback_result where- hashWithSalt salt record = salt `H.hashWithSalt` addCommunicationFeedback_result_ex record -instance QC.Arbitrary AddCommunicationFeedback_result where - arbitrary = M.liftM AddCommunicationFeedback_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_AddCommunicationFeedback_result = []- | P.otherwise = M.catMaybes- [ if obj == default_AddCommunicationFeedback_result{addCommunicationFeedback_result_ex = addCommunicationFeedback_result_ex obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_result{addCommunicationFeedback_result_ex = addCommunicationFeedback_result_ex obj}- ]-from_AddCommunicationFeedback_result :: AddCommunicationFeedback_result -> T.ThriftVal-from_AddCommunicationFeedback_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v193 -> (1, ("ex",Services_Types.from_ServicesException _v193))) <$> addCommunicationFeedback_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v193 -> (1, ("ex",Services_Types.from_ServicesException _v193))) <$> addCommunicationFeedback_result_ex record- ]- )-write_AddCommunicationFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_result -> P.IO ()-write_AddCommunicationFeedback_result oprot record = T.writeVal oprot $ from_AddCommunicationFeedback_result record-encode_AddCommunicationFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_result -> LBS.ByteString-encode_AddCommunicationFeedback_result oprot record = T.serializeVal oprot $ from_AddCommunicationFeedback_result record-to_AddCommunicationFeedback_result :: T.ThriftVal -> AddCommunicationFeedback_result-to_AddCommunicationFeedback_result (T.TStruct fields) = AddCommunicationFeedback_result{- addCommunicationFeedback_result_ex = P.maybe (P.Nothing) (\(_,_val195) -> P.Just (case _val195 of {T.TStruct _val196 -> (Services_Types.to_ServicesException (T.TStruct _val196)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_AddCommunicationFeedback_result _ = P.error "not a struct"-read_AddCommunicationFeedback_result :: (T.Transport t, T.Protocol p) => p t -> P.IO AddCommunicationFeedback_result-read_AddCommunicationFeedback_result iprot = to_AddCommunicationFeedback_result <$> T.readVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_result)-decode_AddCommunicationFeedback_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddCommunicationFeedback_result-decode_AddCommunicationFeedback_result iprot bs = to_AddCommunicationFeedback_result $ T.deserializeVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_result) bs-typemap_AddCommunicationFeedback_result :: T.TypeMap-typemap_AddCommunicationFeedback_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_AddCommunicationFeedback_result :: AddCommunicationFeedback_result-default_AddCommunicationFeedback_result = AddCommunicationFeedback_result{- addCommunicationFeedback_result_ex = P.Nothing}-data AddSentenceFeedback_args = AddSentenceFeedback_args { addSentenceFeedback_args_searchResultsId :: Uuid_Types.UUID- , addSentenceFeedback_args_communicationId :: LT.Text- , addSentenceFeedback_args_sentenceId :: Uuid_Types.UUID- , addSentenceFeedback_args_feedback :: SearchFeedback- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddSentenceFeedback_args where- hashWithSalt salt record = salt `H.hashWithSalt` addSentenceFeedback_args_searchResultsId record `H.hashWithSalt` addSentenceFeedback_args_communicationId record `H.hashWithSalt` addSentenceFeedback_args_sentenceId record `H.hashWithSalt` addSentenceFeedback_args_feedback record -instance QC.Arbitrary AddSentenceFeedback_args where - arbitrary = M.liftM AddSentenceFeedback_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AddSentenceFeedback_args = []- | P.otherwise = M.catMaybes- [ if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_searchResultsId = addSentenceFeedback_args_searchResultsId obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_searchResultsId = addSentenceFeedback_args_searchResultsId obj}- , if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_communicationId = addSentenceFeedback_args_communicationId obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_communicationId = addSentenceFeedback_args_communicationId obj}- , if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_sentenceId = addSentenceFeedback_args_sentenceId obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_sentenceId = addSentenceFeedback_args_sentenceId obj}- , if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_feedback = addSentenceFeedback_args_feedback obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_feedback = addSentenceFeedback_args_feedback obj}- ]-from_AddSentenceFeedback_args :: AddSentenceFeedback_args -> T.ThriftVal-from_AddSentenceFeedback_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v199 -> P.Just (1, ("searchResultsId",Uuid_Types.from_UUID _v199))) $ addSentenceFeedback_args_searchResultsId record- , (\_v199 -> P.Just (2, ("communicationId",T.TString $ E.encodeUtf8 _v199))) $ addSentenceFeedback_args_communicationId record- , (\_v199 -> P.Just (3, ("sentenceId",Uuid_Types.from_UUID _v199))) $ addSentenceFeedback_args_sentenceId record- , (\_v199 -> P.Just (4, ("feedback",T.TI32 $ P.fromIntegral $ P.fromEnum _v199))) $ addSentenceFeedback_args_feedback record- ]-write_AddSentenceFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_args -> P.IO ()-write_AddSentenceFeedback_args oprot record = T.writeVal oprot $ from_AddSentenceFeedback_args record-encode_AddSentenceFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_args -> LBS.ByteString-encode_AddSentenceFeedback_args oprot record = T.serializeVal oprot $ from_AddSentenceFeedback_args record-to_AddSentenceFeedback_args :: T.ThriftVal -> AddSentenceFeedback_args-to_AddSentenceFeedback_args (T.TStruct fields) = AddSentenceFeedback_args{- addSentenceFeedback_args_searchResultsId = P.maybe (addSentenceFeedback_args_searchResultsId default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TStruct _val202 -> (Uuid_Types.to_UUID (T.TStruct _val202)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- addSentenceFeedback_args_communicationId = P.maybe (addSentenceFeedback_args_communicationId default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TString _val203 -> E.decodeUtf8 _val203; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- addSentenceFeedback_args_sentenceId = P.maybe (addSentenceFeedback_args_sentenceId default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TStruct _val204 -> (Uuid_Types.to_UUID (T.TStruct _val204)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- addSentenceFeedback_args_feedback = P.maybe (addSentenceFeedback_args_feedback default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TI32 _val205 -> P.toEnum $ P.fromIntegral _val205; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_AddSentenceFeedback_args _ = P.error "not a struct"-read_AddSentenceFeedback_args :: (T.Transport t, T.Protocol p) => p t -> P.IO AddSentenceFeedback_args-read_AddSentenceFeedback_args iprot = to_AddSentenceFeedback_args <$> T.readVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_args)-decode_AddSentenceFeedback_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddSentenceFeedback_args-decode_AddSentenceFeedback_args iprot bs = to_AddSentenceFeedback_args $ T.deserializeVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_args) bs-typemap_AddSentenceFeedback_args :: T.TypeMap-typemap_AddSentenceFeedback_args = Map.fromList [(1,("searchResultsId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("communicationId",T.T_STRING)),(3,("sentenceId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(4,("feedback",T.T_I32))]-default_AddSentenceFeedback_args :: AddSentenceFeedback_args-default_AddSentenceFeedback_args = AddSentenceFeedback_args{- addSentenceFeedback_args_searchResultsId = Uuid_Types.default_UUID,- addSentenceFeedback_args_communicationId = "",- addSentenceFeedback_args_sentenceId = Uuid_Types.default_UUID,- addSentenceFeedback_args_feedback = (P.toEnum 0)}-data AddSentenceFeedback_result = AddSentenceFeedback_result { addSentenceFeedback_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddSentenceFeedback_result where- hashWithSalt salt record = salt `H.hashWithSalt` addSentenceFeedback_result_ex record -instance QC.Arbitrary AddSentenceFeedback_result where - arbitrary = M.liftM AddSentenceFeedback_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_AddSentenceFeedback_result = []- | P.otherwise = M.catMaybes- [ if obj == default_AddSentenceFeedback_result{addSentenceFeedback_result_ex = addSentenceFeedback_result_ex obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_result{addSentenceFeedback_result_ex = addSentenceFeedback_result_ex obj}- ]-from_AddSentenceFeedback_result :: AddSentenceFeedback_result -> T.ThriftVal-from_AddSentenceFeedback_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v208 -> (1, ("ex",Services_Types.from_ServicesException _v208))) <$> addSentenceFeedback_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v208 -> (1, ("ex",Services_Types.from_ServicesException _v208))) <$> addSentenceFeedback_result_ex record- ]- )-write_AddSentenceFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_result -> P.IO ()-write_AddSentenceFeedback_result oprot record = T.writeVal oprot $ from_AddSentenceFeedback_result record-encode_AddSentenceFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_result -> LBS.ByteString-encode_AddSentenceFeedback_result oprot record = T.serializeVal oprot $ from_AddSentenceFeedback_result record-to_AddSentenceFeedback_result :: T.ThriftVal -> AddSentenceFeedback_result-to_AddSentenceFeedback_result (T.TStruct fields) = AddSentenceFeedback_result{- addSentenceFeedback_result_ex = P.maybe (P.Nothing) (\(_,_val210) -> P.Just (case _val210 of {T.TStruct _val211 -> (Services_Types.to_ServicesException (T.TStruct _val211)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_AddSentenceFeedback_result _ = P.error "not a struct"-read_AddSentenceFeedback_result :: (T.Transport t, T.Protocol p) => p t -> P.IO AddSentenceFeedback_result-read_AddSentenceFeedback_result iprot = to_AddSentenceFeedback_result <$> T.readVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_result)-decode_AddSentenceFeedback_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddSentenceFeedback_result-decode_AddSentenceFeedback_result iprot bs = to_AddSentenceFeedback_result $ T.deserializeVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_result) bs-typemap_AddSentenceFeedback_result :: T.TypeMap-typemap_AddSentenceFeedback_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_AddSentenceFeedback_result :: AddSentenceFeedback_result-default_AddSentenceFeedback_result = AddSentenceFeedback_result{- addSentenceFeedback_result_ex = P.Nothing}-process_startFeedback (seqid, iprot, oprot, handler) = do- args <- read_StartFeedback_args iprot- (X.catch- (X.catch- (do- Iface.startFeedback handler (startFeedback_args_results args)- let res = default_StartFeedback_result- T.writeMessageBegin oprot ("startFeedback", T.M_REPLY, seqid)- write_StartFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_StartFeedback_result{startFeedback_result_ex = P.Just e}- T.writeMessageBegin oprot ("startFeedback", T.M_REPLY, seqid)- write_StartFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("startFeedback", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_addCommunicationFeedback (seqid, iprot, oprot, handler) = do- args <- read_AddCommunicationFeedback_args iprot- (X.catch- (X.catch- (do- Iface.addCommunicationFeedback handler (addCommunicationFeedback_args_searchResultsId args) (addCommunicationFeedback_args_communicationId args) (addCommunicationFeedback_args_feedback args)- let res = default_AddCommunicationFeedback_result- T.writeMessageBegin oprot ("addCommunicationFeedback", T.M_REPLY, seqid)- write_AddCommunicationFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_AddCommunicationFeedback_result{addCommunicationFeedback_result_ex = P.Just e}- T.writeMessageBegin oprot ("addCommunicationFeedback", T.M_REPLY, seqid)- write_AddCommunicationFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("addCommunicationFeedback", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_addSentenceFeedback (seqid, iprot, oprot, handler) = do- args <- read_AddSentenceFeedback_args iprot- (X.catch- (X.catch- (do- Iface.addSentenceFeedback handler (addSentenceFeedback_args_searchResultsId args) (addSentenceFeedback_args_communicationId args) (addSentenceFeedback_args_sentenceId args) (addSentenceFeedback_args_feedback args)- let res = default_AddSentenceFeedback_result- T.writeMessageBegin oprot ("addSentenceFeedback", T.M_REPLY, seqid)- write_AddSentenceFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_AddSentenceFeedback_result{addSentenceFeedback_result_ex = P.Just e}- T.writeMessageBegin oprot ("addSentenceFeedback", T.M_REPLY, seqid)- write_AddSentenceFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("addSentenceFeedback", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "startFeedback" -> process_startFeedback (seqid,iprot,oprot,handler)- "addCommunicationFeedback" -> process_addCommunicationFeedback (seqid,iprot,oprot,handler)- "addSentenceFeedback" -> process_addSentenceFeedback (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/FeedbackService_Client.hs
@@ -1,103 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.FeedbackService_Client(startFeedback,addCommunicationFeedback,addSentenceFeedback) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types-import FeedbackService-seqid = R.newIORef 0-startFeedback (ip,op) arg_results = do- send_startFeedback op arg_results- recv_startFeedback ip-send_startFeedback op arg_results = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("startFeedback", T.M_CALL, seqn)- write_StartFeedback_args op (StartFeedback_args{startFeedback_args_results=arg_results})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_startFeedback ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_StartFeedback_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (startFeedback_result_ex res)- P.return ()-addCommunicationFeedback (ip,op) arg_searchResultsId arg_communicationId arg_feedback = do- send_addCommunicationFeedback op arg_searchResultsId arg_communicationId arg_feedback- recv_addCommunicationFeedback ip-send_addCommunicationFeedback op arg_searchResultsId arg_communicationId arg_feedback = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("addCommunicationFeedback", T.M_CALL, seqn)- write_AddCommunicationFeedback_args op (AddCommunicationFeedback_args{addCommunicationFeedback_args_searchResultsId=arg_searchResultsId,addCommunicationFeedback_args_communicationId=arg_communicationId,addCommunicationFeedback_args_feedback=arg_feedback})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_addCommunicationFeedback ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_AddCommunicationFeedback_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (addCommunicationFeedback_result_ex res)- P.return ()-addSentenceFeedback (ip,op) arg_searchResultsId arg_communicationId arg_sentenceId arg_feedback = do- send_addSentenceFeedback op arg_searchResultsId arg_communicationId arg_sentenceId arg_feedback- recv_addSentenceFeedback ip-send_addSentenceFeedback op arg_searchResultsId arg_communicationId arg_sentenceId arg_feedback = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("addSentenceFeedback", T.M_CALL, seqn)- write_AddSentenceFeedback_args op (AddSentenceFeedback_args{addSentenceFeedback_args_searchResultsId=arg_searchResultsId,addSentenceFeedback_args_communicationId=arg_communicationId,addSentenceFeedback_args_sentenceId=arg_sentenceId,addSentenceFeedback_args_feedback=arg_feedback})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_addSentenceFeedback ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_AddSentenceFeedback_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (addSentenceFeedback_result_ex res)- P.return ()
− src/Data/Concrete/Services/FeedbackService_Iface.hs
@@ -1,54 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.FeedbackService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types--import Service_Iface-class Service_Iface a => FeedbackService_Iface a where- startFeedback :: a -> SearchResult -> P.IO ()- addCommunicationFeedback :: a -> Uuid_Types.UUID -> LT.Text -> SearchFeedback -> P.IO ()- addSentenceFeedback :: a -> Uuid_Types.UUID -> LT.Text -> Uuid_Types.UUID -> SearchFeedback -> P.IO ()
+ src/Data/Concrete/Services/Fetch.hs view
@@ -0,0 +1,97 @@+{-# LANGUAGE DeriveGeneric, OverloadedStrings, FlexibleInstances, BangPatterns #-}++module Data.Concrete.Services.Fetch ( HandleFetch(..)+ , ZipFetch(..)+ , TarFetch(..)+ , makeTarFetch+ , process+ ) where++import System.IO (Handle)+import qualified Data.Vector as V+import qualified Codec.Archive.Tar as Tar+import qualified Codec.Archive.Tar.Entry as Tar+import qualified Codec.Archive.Tar.Index as Tar+import qualified Data.ByteString as SBS+import qualified Data.ByteString.Lazy as LBS+import qualified Codec.Compression.GZip as GZip+import qualified Codec.Compression.BZip as BZip+import qualified Codec.Archive.Zip as Zip+import qualified Codec.Archive.Tar as Tar+import qualified Codec.Archive.Tar.Entry as Tar+import qualified Codec.Archive.Tar.Index as Tar+import System.IO (openFile, IOMode(..), hTell)+import System.FilePath (takeExtension)+import Data.Either (rights)+import qualified Data.Map.Strict as Map+import Data.Map.Strict (Map)+import Data.Concrete.Utils (stringToComm)+import Data.Concrete.Services (Compression(..))+import Data.Concrete.Autogen.Communication_Types (Communication(..), default_Communication, read_Communication, write_Communication)+import Data.Concrete.Autogen.Service_Iface (Service_Iface(about, alive))+import Data.Concrete.Autogen.Services_Types (ServiceInfo(..))+import Data.Concrete.Autogen.Access_Types (FetchResult(..), default_FetchResult, FetchRequest(..))+import Data.Concrete.Autogen.FetchCommunicationService_Iface (FetchCommunicationService_Iface(fetch, getCommunicationIDs, getCommunicationCount))+import Data.Concrete.Autogen.FetchCommunicationService (process)+import Data.List (genericDrop, genericTake, genericLength)+import Data.Text.Lazy (Text, pack, unpack)++-- Handle-backed++newtype HandleFetch = HandleFetch (Handle, Maybe Compression)++-- Zip-backed++newtype ZipFetch = ZipFetch (Handle, Maybe Compression)++-- Tar-backed++newtype TarFetch = TarFetch (Handle, (LBS.ByteString -> LBS.ByteString), Tar.TarIndex, Map String FilePath)+++instance Service_Iface TarFetch where+ about _ = return $ ServiceInfo "Tar-backed FetchCommunicationService" "0.0.1" (Just "Haskell implementation")+ alive _ = return True+++instance FetchCommunicationService_Iface TarFetch where+ fetch (TarFetch (h, c, i, l)) ii = do+ cc <- sequence $ map fetchOne ((map unpack . V.toList . fetchRequest_communicationIds) ii)+ return $ default_FetchResult { fetchResult_communications=V.fromList cc }+ where+ fetchOne :: String -> IO Communication+ fetchOne p = do+ let (Just (Tar.TarFileEntry o)) = Tar.lookup i (l Map.! p)+ e <- Tar.hReadEntry h o+ stringToComm ((((\ (Tar.NormalFile bs _) -> bs) . Tar.entryContent) ) e)+ getCommunicationIDs (TarFetch (_, _, _, l)) offset count = return $ V.fromList $ ((map (pack . fst)) . genericTake count . genericDrop offset . Map.toList) l+ getCommunicationCount (TarFetch (_, _, _, l)) = return ((genericLength . Map.toList) l)+++makeTarFetch :: String -> IO TarFetch+makeTarFetch f = do+ let c = case takeExtension f of+ --".tgz" -> GZip.decompress+ --".tbz2" -> BZip.decompress+ ".tar" -> id+ h <- openFile f ReadMode+ bs <- c <$> LBS.readFile f+ let e = Tar.read bs+ (l, i) <- build e+ h' <- openFile f ReadMode+ return $ TarFetch (h, c, i, Map.fromList l)+++commFromEntry :: Tar.Entry -> IO Communication+commFromEntry e = stringToComm (((\ (Tar.NormalFile bs _) -> bs) . Tar.entryContent) e)+++build :: Tar.Entries e -> IO ([(String, FilePath)], Tar.TarIndex)+build = go ([], Tar.empty)+ where+ go :: ([(String, FilePath)], Tar.IndexBuilder) -> Tar.Entries e -> IO ([(String, FilePath)], Tar.TarIndex)+ go (l, !builder) (Tar.Next e es) = do+ c <- commFromEntry e+ go (((unpack . communication_id) c, Tar.entryPath e):l, Tar.addNextEntry e builder) es+ go (l, !builder) (Tar.Done) = do+ return (l, Tar.finalise builder)
− src/Data/Concrete/Services/FetchCommunicationService.hs
@@ -1,343 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.FetchCommunicationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import qualified Service-import Access_Types-import qualified FetchCommunicationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Fetch_args = Fetch_args { fetch_args_request :: FetchRequest- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Fetch_args where- hashWithSalt salt record = salt `H.hashWithSalt` fetch_args_request record -instance QC.Arbitrary Fetch_args where - arbitrary = M.liftM Fetch_args (QC.arbitrary)- shrink obj | obj == default_Fetch_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Fetch_args{fetch_args_request = fetch_args_request obj} then P.Nothing else P.Just $ default_Fetch_args{fetch_args_request = fetch_args_request obj}- ]-from_Fetch_args :: Fetch_args -> T.ThriftVal-from_Fetch_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v23 -> P.Just (1, ("request",from_FetchRequest _v23))) $ fetch_args_request record- ]-write_Fetch_args :: (T.Protocol p, T.Transport t) => p t -> Fetch_args -> P.IO ()-write_Fetch_args oprot record = T.writeVal oprot $ from_Fetch_args record-encode_Fetch_args :: (T.Protocol p, T.Transport t) => p t -> Fetch_args -> LBS.ByteString-encode_Fetch_args oprot record = T.serializeVal oprot $ from_Fetch_args record-to_Fetch_args :: T.ThriftVal -> Fetch_args-to_Fetch_args (T.TStruct fields) = Fetch_args{- fetch_args_request = P.maybe (fetch_args_request default_Fetch_args) (\(_,_val25) -> (case _val25 of {T.TStruct _val26 -> (to_FetchRequest (T.TStruct _val26)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Fetch_args _ = P.error "not a struct"-read_Fetch_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Fetch_args-read_Fetch_args iprot = to_Fetch_args <$> T.readVal iprot (T.T_STRUCT typemap_Fetch_args)-decode_Fetch_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Fetch_args-decode_Fetch_args iprot bs = to_Fetch_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Fetch_args) bs-typemap_Fetch_args :: T.TypeMap-typemap_Fetch_args = Map.fromList [(1,("request",(T.T_STRUCT typemap_FetchRequest)))]-default_Fetch_args :: Fetch_args-default_Fetch_args = Fetch_args{- fetch_args_request = default_FetchRequest}-data Fetch_result = Fetch_result { fetch_result_success :: FetchResult- , fetch_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Fetch_result where- hashWithSalt salt record = salt `H.hashWithSalt` fetch_result_success record `H.hashWithSalt` fetch_result_ex record -instance QC.Arbitrary Fetch_result where - arbitrary = M.liftM Fetch_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Fetch_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Fetch_result{fetch_result_success = fetch_result_success obj} then P.Nothing else P.Just $ default_Fetch_result{fetch_result_success = fetch_result_success obj}- , if obj == default_Fetch_result{fetch_result_ex = fetch_result_ex obj} then P.Nothing else P.Just $ default_Fetch_result{fetch_result_ex = fetch_result_ex obj}- ]-from_Fetch_result :: Fetch_result -> T.ThriftVal-from_Fetch_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v29 -> (1, ("ex",Services_Types.from_ServicesException _v29))) <$> fetch_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v29 -> P.Just (0, ("success",from_FetchResult _v29))) $ fetch_result_success record- , (\_v29 -> (1, ("ex",Services_Types.from_ServicesException _v29))) <$> fetch_result_ex record- ]- )-write_Fetch_result :: (T.Protocol p, T.Transport t) => p t -> Fetch_result -> P.IO ()-write_Fetch_result oprot record = T.writeVal oprot $ from_Fetch_result record-encode_Fetch_result :: (T.Protocol p, T.Transport t) => p t -> Fetch_result -> LBS.ByteString-encode_Fetch_result oprot record = T.serializeVal oprot $ from_Fetch_result record-to_Fetch_result :: T.ThriftVal -> Fetch_result-to_Fetch_result (T.TStruct fields) = Fetch_result{- fetch_result_success = P.maybe (fetch_result_success default_Fetch_result) (\(_,_val31) -> (case _val31 of {T.TStruct _val32 -> (to_FetchResult (T.TStruct _val32)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- fetch_result_ex = P.maybe (P.Nothing) (\(_,_val31) -> P.Just (case _val31 of {T.TStruct _val33 -> (Services_Types.to_ServicesException (T.TStruct _val33)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Fetch_result _ = P.error "not a struct"-read_Fetch_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Fetch_result-read_Fetch_result iprot = to_Fetch_result <$> T.readVal iprot (T.T_STRUCT typemap_Fetch_result)-decode_Fetch_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Fetch_result-decode_Fetch_result iprot bs = to_Fetch_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Fetch_result) bs-typemap_Fetch_result :: T.TypeMap-typemap_Fetch_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_FetchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Fetch_result :: Fetch_result-default_Fetch_result = Fetch_result{- fetch_result_success = default_FetchResult,- fetch_result_ex = P.Nothing}-data GetCommunicationIDs_args = GetCommunicationIDs_args { getCommunicationIDs_args_offset :: I.Int64- , getCommunicationIDs_args_count :: I.Int64- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationIDs_args where- hashWithSalt salt record = salt `H.hashWithSalt` getCommunicationIDs_args_offset record `H.hashWithSalt` getCommunicationIDs_args_count record -instance QC.Arbitrary GetCommunicationIDs_args where - arbitrary = M.liftM GetCommunicationIDs_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_GetCommunicationIDs_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCommunicationIDs_args{getCommunicationIDs_args_offset = getCommunicationIDs_args_offset obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_args{getCommunicationIDs_args_offset = getCommunicationIDs_args_offset obj}- , if obj == default_GetCommunicationIDs_args{getCommunicationIDs_args_count = getCommunicationIDs_args_count obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_args{getCommunicationIDs_args_count = getCommunicationIDs_args_count obj}- ]-from_GetCommunicationIDs_args :: GetCommunicationIDs_args -> T.ThriftVal-from_GetCommunicationIDs_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v36 -> P.Just (1, ("offset",T.TI64 _v36))) $ getCommunicationIDs_args_offset record- , (\_v36 -> P.Just (2, ("count",T.TI64 _v36))) $ getCommunicationIDs_args_count record- ]-write_GetCommunicationIDs_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_args -> P.IO ()-write_GetCommunicationIDs_args oprot record = T.writeVal oprot $ from_GetCommunicationIDs_args record-encode_GetCommunicationIDs_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_args -> LBS.ByteString-encode_GetCommunicationIDs_args oprot record = T.serializeVal oprot $ from_GetCommunicationIDs_args record-to_GetCommunicationIDs_args :: T.ThriftVal -> GetCommunicationIDs_args-to_GetCommunicationIDs_args (T.TStruct fields) = GetCommunicationIDs_args{- getCommunicationIDs_args_offset = P.maybe (getCommunicationIDs_args_offset default_GetCommunicationIDs_args) (\(_,_val38) -> (case _val38 of {T.TI64 _val39 -> _val39; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- getCommunicationIDs_args_count = P.maybe (getCommunicationIDs_args_count default_GetCommunicationIDs_args) (\(_,_val38) -> (case _val38 of {T.TI64 _val40 -> _val40; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_GetCommunicationIDs_args _ = P.error "not a struct"-read_GetCommunicationIDs_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationIDs_args-read_GetCommunicationIDs_args iprot = to_GetCommunicationIDs_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_args)-decode_GetCommunicationIDs_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationIDs_args-decode_GetCommunicationIDs_args iprot bs = to_GetCommunicationIDs_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_args) bs-typemap_GetCommunicationIDs_args :: T.TypeMap-typemap_GetCommunicationIDs_args = Map.fromList [(1,("offset",T.T_I64)),(2,("count",T.T_I64))]-default_GetCommunicationIDs_args :: GetCommunicationIDs_args-default_GetCommunicationIDs_args = GetCommunicationIDs_args{- getCommunicationIDs_args_offset = 0,- getCommunicationIDs_args_count = 0}-data GetCommunicationIDs_result = GetCommunicationIDs_result { getCommunicationIDs_result_success :: (Vector.Vector LT.Text)- , getCommunicationIDs_result_ex :: P.Maybe Services_Types.NotImplementedException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationIDs_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCommunicationIDs_result_success record `H.hashWithSalt` getCommunicationIDs_result_ex record -instance QC.Arbitrary GetCommunicationIDs_result where - arbitrary = M.liftM GetCommunicationIDs_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCommunicationIDs_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCommunicationIDs_result{getCommunicationIDs_result_success = getCommunicationIDs_result_success obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_result{getCommunicationIDs_result_success = getCommunicationIDs_result_success obj}- , if obj == default_GetCommunicationIDs_result{getCommunicationIDs_result_ex = getCommunicationIDs_result_ex obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_result{getCommunicationIDs_result_ex = getCommunicationIDs_result_ex obj}- ]-from_GetCommunicationIDs_result :: GetCommunicationIDs_result -> T.ThriftVal-from_GetCommunicationIDs_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v43 -> (1, ("ex",Services_Types.from_NotImplementedException _v43))) <$> getCommunicationIDs_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v43 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v45 -> T.TString $ E.encodeUtf8 _v45) $ Vector.toList _v43))) $ getCommunicationIDs_result_success record- , (\_v43 -> (1, ("ex",Services_Types.from_NotImplementedException _v43))) <$> getCommunicationIDs_result_ex record- ]- )-write_GetCommunicationIDs_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_result -> P.IO ()-write_GetCommunicationIDs_result oprot record = T.writeVal oprot $ from_GetCommunicationIDs_result record-encode_GetCommunicationIDs_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_result -> LBS.ByteString-encode_GetCommunicationIDs_result oprot record = T.serializeVal oprot $ from_GetCommunicationIDs_result record-to_GetCommunicationIDs_result :: T.ThriftVal -> GetCommunicationIDs_result-to_GetCommunicationIDs_result (T.TStruct fields) = GetCommunicationIDs_result{- getCommunicationIDs_result_success = P.maybe (getCommunicationIDs_result_success default_GetCommunicationIDs_result) (\(_,_val47) -> (case _val47 of {T.TList _ _val48 -> (Vector.fromList $ P.map (\_v49 -> (case _v49 of {T.TString _val50 -> E.decodeUtf8 _val50; _ -> P.error "wrong type"})) _val48); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCommunicationIDs_result_ex = P.maybe (P.Nothing) (\(_,_val47) -> P.Just (case _val47 of {T.TStruct _val51 -> (Services_Types.to_NotImplementedException (T.TStruct _val51)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCommunicationIDs_result _ = P.error "not a struct"-read_GetCommunicationIDs_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationIDs_result-read_GetCommunicationIDs_result iprot = to_GetCommunicationIDs_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_result)-decode_GetCommunicationIDs_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationIDs_result-decode_GetCommunicationIDs_result iprot bs = to_GetCommunicationIDs_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_result) bs-typemap_GetCommunicationIDs_result :: T.TypeMap-typemap_GetCommunicationIDs_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_NotImplementedException)))]-default_GetCommunicationIDs_result :: GetCommunicationIDs_result-default_GetCommunicationIDs_result = GetCommunicationIDs_result{- getCommunicationIDs_result_success = Vector.empty,- getCommunicationIDs_result_ex = P.Nothing}-data GetCommunicationCount_args = GetCommunicationCount_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationCount_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCommunicationCount_args where - arbitrary = QC.elements [GetCommunicationCount_args]-from_GetCommunicationCount_args :: GetCommunicationCount_args -> T.ThriftVal-from_GetCommunicationCount_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCommunicationCount_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_args -> P.IO ()-write_GetCommunicationCount_args oprot record = T.writeVal oprot $ from_GetCommunicationCount_args record-encode_GetCommunicationCount_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_args -> LBS.ByteString-encode_GetCommunicationCount_args oprot record = T.serializeVal oprot $ from_GetCommunicationCount_args record-to_GetCommunicationCount_args :: T.ThriftVal -> GetCommunicationCount_args-to_GetCommunicationCount_args (T.TStruct fields) = GetCommunicationCount_args{-- }-to_GetCommunicationCount_args _ = P.error "not a struct"-read_GetCommunicationCount_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationCount_args-read_GetCommunicationCount_args iprot = to_GetCommunicationCount_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationCount_args)-decode_GetCommunicationCount_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationCount_args-decode_GetCommunicationCount_args iprot bs = to_GetCommunicationCount_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationCount_args) bs-typemap_GetCommunicationCount_args :: T.TypeMap-typemap_GetCommunicationCount_args = Map.fromList []-default_GetCommunicationCount_args :: GetCommunicationCount_args-default_GetCommunicationCount_args = GetCommunicationCount_args{-}-data GetCommunicationCount_result = GetCommunicationCount_result { getCommunicationCount_result_success :: I.Int64- , getCommunicationCount_result_ex :: P.Maybe Services_Types.NotImplementedException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationCount_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCommunicationCount_result_success record `H.hashWithSalt` getCommunicationCount_result_ex record -instance QC.Arbitrary GetCommunicationCount_result where - arbitrary = M.liftM GetCommunicationCount_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCommunicationCount_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCommunicationCount_result{getCommunicationCount_result_success = getCommunicationCount_result_success obj} then P.Nothing else P.Just $ default_GetCommunicationCount_result{getCommunicationCount_result_success = getCommunicationCount_result_success obj}- , if obj == default_GetCommunicationCount_result{getCommunicationCount_result_ex = getCommunicationCount_result_ex obj} then P.Nothing else P.Just $ default_GetCommunicationCount_result{getCommunicationCount_result_ex = getCommunicationCount_result_ex obj}- ]-from_GetCommunicationCount_result :: GetCommunicationCount_result -> T.ThriftVal-from_GetCommunicationCount_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v59 -> (1, ("ex",Services_Types.from_NotImplementedException _v59))) <$> getCommunicationCount_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v59 -> P.Just (0, ("success",T.TI64 _v59))) $ getCommunicationCount_result_success record- , (\_v59 -> (1, ("ex",Services_Types.from_NotImplementedException _v59))) <$> getCommunicationCount_result_ex record- ]- )-write_GetCommunicationCount_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_result -> P.IO ()-write_GetCommunicationCount_result oprot record = T.writeVal oprot $ from_GetCommunicationCount_result record-encode_GetCommunicationCount_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_result -> LBS.ByteString-encode_GetCommunicationCount_result oprot record = T.serializeVal oprot $ from_GetCommunicationCount_result record-to_GetCommunicationCount_result :: T.ThriftVal -> GetCommunicationCount_result-to_GetCommunicationCount_result (T.TStruct fields) = GetCommunicationCount_result{- getCommunicationCount_result_success = P.maybe (getCommunicationCount_result_success default_GetCommunicationCount_result) (\(_,_val61) -> (case _val61 of {T.TI64 _val62 -> _val62; _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCommunicationCount_result_ex = P.maybe (P.Nothing) (\(_,_val61) -> P.Just (case _val61 of {T.TStruct _val63 -> (Services_Types.to_NotImplementedException (T.TStruct _val63)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCommunicationCount_result _ = P.error "not a struct"-read_GetCommunicationCount_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationCount_result-read_GetCommunicationCount_result iprot = to_GetCommunicationCount_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationCount_result)-decode_GetCommunicationCount_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationCount_result-decode_GetCommunicationCount_result iprot bs = to_GetCommunicationCount_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationCount_result) bs-typemap_GetCommunicationCount_result :: T.TypeMap-typemap_GetCommunicationCount_result = Map.fromList [(0,("success",T.T_I64)),(1,("ex",(T.T_STRUCT Services_Types.typemap_NotImplementedException)))]-default_GetCommunicationCount_result :: GetCommunicationCount_result-default_GetCommunicationCount_result = GetCommunicationCount_result{- getCommunicationCount_result_success = 0,- getCommunicationCount_result_ex = P.Nothing}-process_fetch (seqid, iprot, oprot, handler) = do- args <- read_Fetch_args iprot- (X.catch- (X.catch- (do- val <- Iface.fetch handler (fetch_args_request args)- let res = default_Fetch_result{fetch_result_success = val}- T.writeMessageBegin oprot ("fetch", T.M_REPLY, seqid)- write_Fetch_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Fetch_result{fetch_result_ex = P.Just e}- T.writeMessageBegin oprot ("fetch", T.M_REPLY, seqid)- write_Fetch_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("fetch", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCommunicationIDs (seqid, iprot, oprot, handler) = do- args <- read_GetCommunicationIDs_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCommunicationIDs handler (getCommunicationIDs_args_offset args) (getCommunicationIDs_args_count args)- let res = default_GetCommunicationIDs_result{getCommunicationIDs_result_success = val}- T.writeMessageBegin oprot ("getCommunicationIDs", T.M_REPLY, seqid)- write_GetCommunicationIDs_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCommunicationIDs_result{getCommunicationIDs_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCommunicationIDs", T.M_REPLY, seqid)- write_GetCommunicationIDs_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCommunicationIDs", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCommunicationCount (seqid, iprot, oprot, handler) = do- args <- read_GetCommunicationCount_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCommunicationCount handler- let res = default_GetCommunicationCount_result{getCommunicationCount_result_success = val}- T.writeMessageBegin oprot ("getCommunicationCount", T.M_REPLY, seqid)- write_GetCommunicationCount_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCommunicationCount_result{getCommunicationCount_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCommunicationCount", T.M_REPLY, seqid)- write_GetCommunicationCount_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCommunicationCount", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "fetch" -> process_fetch (seqid,iprot,oprot,handler)- "getCommunicationIDs" -> process_getCommunicationIDs (seqid,iprot,oprot,handler)- "getCommunicationCount" -> process_getCommunicationCount (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/FetchCommunicationService_Client.hs
@@ -1,99 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.FetchCommunicationService_Client(fetch,getCommunicationIDs,getCommunicationCount) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types-import FetchCommunicationService-seqid = R.newIORef 0-fetch (ip,op) arg_request = do- send_fetch op arg_request- recv_fetch ip-send_fetch op arg_request = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("fetch", T.M_CALL, seqn)- write_Fetch_args op (Fetch_args{fetch_args_request=arg_request})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_fetch ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Fetch_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (fetch_result_ex res)- P.return $ fetch_result_success res-getCommunicationIDs (ip,op) arg_offset arg_count = do- send_getCommunicationIDs op arg_offset arg_count- recv_getCommunicationIDs ip-send_getCommunicationIDs op arg_offset arg_count = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCommunicationIDs", T.M_CALL, seqn)- write_GetCommunicationIDs_args op (GetCommunicationIDs_args{getCommunicationIDs_args_offset=arg_offset,getCommunicationIDs_args_count=arg_count})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCommunicationIDs ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCommunicationIDs_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCommunicationIDs_result_ex res)- P.return $ getCommunicationIDs_result_success res-getCommunicationCount (ip,op) = do- send_getCommunicationCount op- recv_getCommunicationCount ip-send_getCommunicationCount op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCommunicationCount", T.M_CALL, seqn)- write_GetCommunicationCount_args op (GetCommunicationCount_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCommunicationCount ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCommunicationCount_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCommunicationCount_result_ex res)- P.return $ getCommunicationCount_result_success res
− src/Data/Concrete/Services/FetchCommunicationService_Iface.hs
@@ -1,50 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.FetchCommunicationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types--import Service_Iface-class Service_Iface a => FetchCommunicationService_Iface a where- fetch :: a -> FetchRequest -> P.IO FetchResult- getCommunicationIDs :: a -> I.Int64 -> I.Int64 -> P.IO (Vector.Vector LT.Text)- getCommunicationCount :: a -> P.IO I.Int64
− src/Data/Concrete/Services/ResultsServerService.hs
@@ -1,945 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ResultsServerService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import qualified Service-import Results_Types-import qualified ResultsServerService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data RegisterSearchResult_args = RegisterSearchResult_args { registerSearchResult_args_result :: Search_Types.SearchResult- , registerSearchResult_args_taskType :: Services_Types.AnnotationTaskType- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable RegisterSearchResult_args where- hashWithSalt salt record = salt `H.hashWithSalt` registerSearchResult_args_result record `H.hashWithSalt` registerSearchResult_args_taskType record -instance QC.Arbitrary RegisterSearchResult_args where - arbitrary = M.liftM RegisterSearchResult_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_RegisterSearchResult_args = []- | P.otherwise = M.catMaybes- [ if obj == default_RegisterSearchResult_args{registerSearchResult_args_result = registerSearchResult_args_result obj} then P.Nothing else P.Just $ default_RegisterSearchResult_args{registerSearchResult_args_result = registerSearchResult_args_result obj}- , if obj == default_RegisterSearchResult_args{registerSearchResult_args_taskType = registerSearchResult_args_taskType obj} then P.Nothing else P.Just $ default_RegisterSearchResult_args{registerSearchResult_args_taskType = registerSearchResult_args_taskType obj}- ]-from_RegisterSearchResult_args :: RegisterSearchResult_args -> T.ThriftVal-from_RegisterSearchResult_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("result",Search_Types.from_SearchResult _v2))) $ registerSearchResult_args_result record- , (\_v2 -> P.Just (2, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v2))) $ registerSearchResult_args_taskType record- ]-write_RegisterSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_args -> P.IO ()-write_RegisterSearchResult_args oprot record = T.writeVal oprot $ from_RegisterSearchResult_args record-encode_RegisterSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_args -> LBS.ByteString-encode_RegisterSearchResult_args oprot record = T.serializeVal oprot $ from_RegisterSearchResult_args record-to_RegisterSearchResult_args :: T.ThriftVal -> RegisterSearchResult_args-to_RegisterSearchResult_args (T.TStruct fields) = RegisterSearchResult_args{- registerSearchResult_args_result = P.maybe (registerSearchResult_args_result default_RegisterSearchResult_args) (\(_,_val4) -> (case _val4 of {T.TStruct _val5 -> (Search_Types.to_SearchResult (T.TStruct _val5)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- registerSearchResult_args_taskType = P.maybe (registerSearchResult_args_taskType default_RegisterSearchResult_args) (\(_,_val4) -> (case _val4 of {T.TI32 _val6 -> P.toEnum $ P.fromIntegral _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_RegisterSearchResult_args _ = P.error "not a struct"-read_RegisterSearchResult_args :: (T.Transport t, T.Protocol p) => p t -> P.IO RegisterSearchResult_args-read_RegisterSearchResult_args iprot = to_RegisterSearchResult_args <$> T.readVal iprot (T.T_STRUCT typemap_RegisterSearchResult_args)-decode_RegisterSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> RegisterSearchResult_args-decode_RegisterSearchResult_args iprot bs = to_RegisterSearchResult_args $ T.deserializeVal iprot (T.T_STRUCT typemap_RegisterSearchResult_args) bs-typemap_RegisterSearchResult_args :: T.TypeMap-typemap_RegisterSearchResult_args = Map.fromList [(1,("result",(T.T_STRUCT Search_Types.typemap_SearchResult))),(2,("taskType",T.T_I32))]-default_RegisterSearchResult_args :: RegisterSearchResult_args-default_RegisterSearchResult_args = RegisterSearchResult_args{- registerSearchResult_args_result = Search_Types.default_SearchResult,- registerSearchResult_args_taskType = (P.toEnum 0)}-data RegisterSearchResult_result = RegisterSearchResult_result { registerSearchResult_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable RegisterSearchResult_result where- hashWithSalt salt record = salt `H.hashWithSalt` registerSearchResult_result_ex record -instance QC.Arbitrary RegisterSearchResult_result where - arbitrary = M.liftM RegisterSearchResult_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_RegisterSearchResult_result = []- | P.otherwise = M.catMaybes- [ if obj == default_RegisterSearchResult_result{registerSearchResult_result_ex = registerSearchResult_result_ex obj} then P.Nothing else P.Just $ default_RegisterSearchResult_result{registerSearchResult_result_ex = registerSearchResult_result_ex obj}- ]-from_RegisterSearchResult_result :: RegisterSearchResult_result -> T.ThriftVal-from_RegisterSearchResult_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v9 -> (1, ("ex",Services_Types.from_ServicesException _v9))) <$> registerSearchResult_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v9 -> (1, ("ex",Services_Types.from_ServicesException _v9))) <$> registerSearchResult_result_ex record- ]- )-write_RegisterSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_result -> P.IO ()-write_RegisterSearchResult_result oprot record = T.writeVal oprot $ from_RegisterSearchResult_result record-encode_RegisterSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_result -> LBS.ByteString-encode_RegisterSearchResult_result oprot record = T.serializeVal oprot $ from_RegisterSearchResult_result record-to_RegisterSearchResult_result :: T.ThriftVal -> RegisterSearchResult_result-to_RegisterSearchResult_result (T.TStruct fields) = RegisterSearchResult_result{- registerSearchResult_result_ex = P.maybe (P.Nothing) (\(_,_val11) -> P.Just (case _val11 of {T.TStruct _val12 -> (Services_Types.to_ServicesException (T.TStruct _val12)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_RegisterSearchResult_result _ = P.error "not a struct"-read_RegisterSearchResult_result :: (T.Transport t, T.Protocol p) => p t -> P.IO RegisterSearchResult_result-read_RegisterSearchResult_result iprot = to_RegisterSearchResult_result <$> T.readVal iprot (T.T_STRUCT typemap_RegisterSearchResult_result)-decode_RegisterSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> RegisterSearchResult_result-decode_RegisterSearchResult_result iprot bs = to_RegisterSearchResult_result $ T.deserializeVal iprot (T.T_STRUCT typemap_RegisterSearchResult_result) bs-typemap_RegisterSearchResult_result :: T.TypeMap-typemap_RegisterSearchResult_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_RegisterSearchResult_result :: RegisterSearchResult_result-default_RegisterSearchResult_result = RegisterSearchResult_result{- registerSearchResult_result_ex = P.Nothing}-data GetSearchResults_args = GetSearchResults_args { getSearchResults_args_taskType :: Services_Types.AnnotationTaskType- , getSearchResults_args_limit :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResults_args where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResults_args_taskType record `H.hashWithSalt` getSearchResults_args_limit record -instance QC.Arbitrary GetSearchResults_args where - arbitrary = M.liftM GetSearchResults_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_GetSearchResults_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResults_args{getSearchResults_args_taskType = getSearchResults_args_taskType obj} then P.Nothing else P.Just $ default_GetSearchResults_args{getSearchResults_args_taskType = getSearchResults_args_taskType obj}- , if obj == default_GetSearchResults_args{getSearchResults_args_limit = getSearchResults_args_limit obj} then P.Nothing else P.Just $ default_GetSearchResults_args{getSearchResults_args_limit = getSearchResults_args_limit obj}- ]-from_GetSearchResults_args :: GetSearchResults_args -> T.ThriftVal-from_GetSearchResults_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v15 -> P.Just (1, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v15))) $ getSearchResults_args_taskType record- , (\_v15 -> P.Just (2, ("limit",T.TI32 _v15))) $ getSearchResults_args_limit record- ]-write_GetSearchResults_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_args -> P.IO ()-write_GetSearchResults_args oprot record = T.writeVal oprot $ from_GetSearchResults_args record-encode_GetSearchResults_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_args -> LBS.ByteString-encode_GetSearchResults_args oprot record = T.serializeVal oprot $ from_GetSearchResults_args record-to_GetSearchResults_args :: T.ThriftVal -> GetSearchResults_args-to_GetSearchResults_args (T.TStruct fields) = GetSearchResults_args{- getSearchResults_args_taskType = P.maybe (getSearchResults_args_taskType default_GetSearchResults_args) (\(_,_val17) -> (case _val17 of {T.TI32 _val18 -> P.toEnum $ P.fromIntegral _val18; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- getSearchResults_args_limit = P.maybe (getSearchResults_args_limit default_GetSearchResults_args) (\(_,_val17) -> (case _val17 of {T.TI32 _val19 -> _val19; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_GetSearchResults_args _ = P.error "not a struct"-read_GetSearchResults_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResults_args-read_GetSearchResults_args iprot = to_GetSearchResults_args <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResults_args)-decode_GetSearchResults_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResults_args-decode_GetSearchResults_args iprot bs = to_GetSearchResults_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResults_args) bs-typemap_GetSearchResults_args :: T.TypeMap-typemap_GetSearchResults_args = Map.fromList [(1,("taskType",T.T_I32)),(2,("limit",T.T_I32))]-default_GetSearchResults_args :: GetSearchResults_args-default_GetSearchResults_args = GetSearchResults_args{- getSearchResults_args_taskType = (P.toEnum 0),- getSearchResults_args_limit = 0}-data GetSearchResults_result = GetSearchResults_result { getSearchResults_result_success :: (Vector.Vector Search_Types.SearchResult)- , getSearchResults_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResults_result where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResults_result_success record `H.hashWithSalt` getSearchResults_result_ex record -instance QC.Arbitrary GetSearchResults_result where - arbitrary = M.liftM GetSearchResults_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetSearchResults_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResults_result{getSearchResults_result_success = getSearchResults_result_success obj} then P.Nothing else P.Just $ default_GetSearchResults_result{getSearchResults_result_success = getSearchResults_result_success obj}- , if obj == default_GetSearchResults_result{getSearchResults_result_ex = getSearchResults_result_ex obj} then P.Nothing else P.Just $ default_GetSearchResults_result{getSearchResults_result_ex = getSearchResults_result_ex obj}- ]-from_GetSearchResults_result :: GetSearchResults_result -> T.ThriftVal-from_GetSearchResults_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v22 -> (1, ("ex",Services_Types.from_ServicesException _v22))) <$> getSearchResults_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v22 -> P.Just (0, ("success",T.TList (T.T_STRUCT Search_Types.typemap_SearchResult) $ P.map (\_v24 -> Search_Types.from_SearchResult _v24) $ Vector.toList _v22))) $ getSearchResults_result_success record- , (\_v22 -> (1, ("ex",Services_Types.from_ServicesException _v22))) <$> getSearchResults_result_ex record- ]- )-write_GetSearchResults_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_result -> P.IO ()-write_GetSearchResults_result oprot record = T.writeVal oprot $ from_GetSearchResults_result record-encode_GetSearchResults_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_result -> LBS.ByteString-encode_GetSearchResults_result oprot record = T.serializeVal oprot $ from_GetSearchResults_result record-to_GetSearchResults_result :: T.ThriftVal -> GetSearchResults_result-to_GetSearchResults_result (T.TStruct fields) = GetSearchResults_result{- getSearchResults_result_success = P.maybe (getSearchResults_result_success default_GetSearchResults_result) (\(_,_val26) -> (case _val26 of {T.TList _ _val27 -> (Vector.fromList $ P.map (\_v28 -> (case _v28 of {T.TStruct _val29 -> (Search_Types.to_SearchResult (T.TStruct _val29)); _ -> P.error "wrong type"})) _val27); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getSearchResults_result_ex = P.maybe (P.Nothing) (\(_,_val26) -> P.Just (case _val26 of {T.TStruct _val30 -> (Services_Types.to_ServicesException (T.TStruct _val30)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResults_result _ = P.error "not a struct"-read_GetSearchResults_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResults_result-read_GetSearchResults_result iprot = to_GetSearchResults_result <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResults_result)-decode_GetSearchResults_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResults_result-decode_GetSearchResults_result iprot bs = to_GetSearchResults_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResults_result) bs-typemap_GetSearchResults_result :: T.TypeMap-typemap_GetSearchResults_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT Search_Types.typemap_SearchResult)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetSearchResults_result :: GetSearchResults_result-default_GetSearchResults_result = GetSearchResults_result{- getSearchResults_result_success = Vector.empty,- getSearchResults_result_ex = P.Nothing}-data GetSearchResultsByUser_args = GetSearchResultsByUser_args { getSearchResultsByUser_args_taskType :: Services_Types.AnnotationTaskType- , getSearchResultsByUser_args_userId :: LT.Text- , getSearchResultsByUser_args_limit :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResultsByUser_args where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResultsByUser_args_taskType record `H.hashWithSalt` getSearchResultsByUser_args_userId record `H.hashWithSalt` getSearchResultsByUser_args_limit record -instance QC.Arbitrary GetSearchResultsByUser_args where - arbitrary = M.liftM GetSearchResultsByUser_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_GetSearchResultsByUser_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResultsByUser_args{getSearchResultsByUser_args_taskType = getSearchResultsByUser_args_taskType obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_args{getSearchResultsByUser_args_taskType = getSearchResultsByUser_args_taskType obj}- , if obj == default_GetSearchResultsByUser_args{getSearchResultsByUser_args_userId = getSearchResultsByUser_args_userId obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_args{getSearchResultsByUser_args_userId = getSearchResultsByUser_args_userId obj}- , if obj == default_GetSearchResultsByUser_args{getSearchResultsByUser_args_limit = getSearchResultsByUser_args_limit obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_args{getSearchResultsByUser_args_limit = getSearchResultsByUser_args_limit obj}- ]-from_GetSearchResultsByUser_args :: GetSearchResultsByUser_args -> T.ThriftVal-from_GetSearchResultsByUser_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v33 -> P.Just (1, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v33))) $ getSearchResultsByUser_args_taskType record- , (\_v33 -> P.Just (2, ("userId",T.TString $ E.encodeUtf8 _v33))) $ getSearchResultsByUser_args_userId record- , (\_v33 -> P.Just (3, ("limit",T.TI32 _v33))) $ getSearchResultsByUser_args_limit record- ]-write_GetSearchResultsByUser_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_args -> P.IO ()-write_GetSearchResultsByUser_args oprot record = T.writeVal oprot $ from_GetSearchResultsByUser_args record-encode_GetSearchResultsByUser_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_args -> LBS.ByteString-encode_GetSearchResultsByUser_args oprot record = T.serializeVal oprot $ from_GetSearchResultsByUser_args record-to_GetSearchResultsByUser_args :: T.ThriftVal -> GetSearchResultsByUser_args-to_GetSearchResultsByUser_args (T.TStruct fields) = GetSearchResultsByUser_args{- getSearchResultsByUser_args_taskType = P.maybe (getSearchResultsByUser_args_taskType default_GetSearchResultsByUser_args) (\(_,_val35) -> (case _val35 of {T.TI32 _val36 -> P.toEnum $ P.fromIntegral _val36; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- getSearchResultsByUser_args_userId = P.maybe (getSearchResultsByUser_args_userId default_GetSearchResultsByUser_args) (\(_,_val35) -> (case _val35 of {T.TString _val37 -> E.decodeUtf8 _val37; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- getSearchResultsByUser_args_limit = P.maybe (getSearchResultsByUser_args_limit default_GetSearchResultsByUser_args) (\(_,_val35) -> (case _val35 of {T.TI32 _val38 -> _val38; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_GetSearchResultsByUser_args _ = P.error "not a struct"-read_GetSearchResultsByUser_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResultsByUser_args-read_GetSearchResultsByUser_args iprot = to_GetSearchResultsByUser_args <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_args)-decode_GetSearchResultsByUser_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResultsByUser_args-decode_GetSearchResultsByUser_args iprot bs = to_GetSearchResultsByUser_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_args) bs-typemap_GetSearchResultsByUser_args :: T.TypeMap-typemap_GetSearchResultsByUser_args = Map.fromList [(1,("taskType",T.T_I32)),(2,("userId",T.T_STRING)),(3,("limit",T.T_I32))]-default_GetSearchResultsByUser_args :: GetSearchResultsByUser_args-default_GetSearchResultsByUser_args = GetSearchResultsByUser_args{- getSearchResultsByUser_args_taskType = (P.toEnum 0),- getSearchResultsByUser_args_userId = "",- getSearchResultsByUser_args_limit = 0}-data GetSearchResultsByUser_result = GetSearchResultsByUser_result { getSearchResultsByUser_result_success :: (Vector.Vector Search_Types.SearchResult)- , getSearchResultsByUser_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResultsByUser_result where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResultsByUser_result_success record `H.hashWithSalt` getSearchResultsByUser_result_ex record -instance QC.Arbitrary GetSearchResultsByUser_result where - arbitrary = M.liftM GetSearchResultsByUser_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetSearchResultsByUser_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResultsByUser_result{getSearchResultsByUser_result_success = getSearchResultsByUser_result_success obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_result{getSearchResultsByUser_result_success = getSearchResultsByUser_result_success obj}- , if obj == default_GetSearchResultsByUser_result{getSearchResultsByUser_result_ex = getSearchResultsByUser_result_ex obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_result{getSearchResultsByUser_result_ex = getSearchResultsByUser_result_ex obj}- ]-from_GetSearchResultsByUser_result :: GetSearchResultsByUser_result -> T.ThriftVal-from_GetSearchResultsByUser_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v41 -> (1, ("ex",Services_Types.from_ServicesException _v41))) <$> getSearchResultsByUser_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v41 -> P.Just (0, ("success",T.TList (T.T_STRUCT Search_Types.typemap_SearchResult) $ P.map (\_v43 -> Search_Types.from_SearchResult _v43) $ Vector.toList _v41))) $ getSearchResultsByUser_result_success record- , (\_v41 -> (1, ("ex",Services_Types.from_ServicesException _v41))) <$> getSearchResultsByUser_result_ex record- ]- )-write_GetSearchResultsByUser_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_result -> P.IO ()-write_GetSearchResultsByUser_result oprot record = T.writeVal oprot $ from_GetSearchResultsByUser_result record-encode_GetSearchResultsByUser_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_result -> LBS.ByteString-encode_GetSearchResultsByUser_result oprot record = T.serializeVal oprot $ from_GetSearchResultsByUser_result record-to_GetSearchResultsByUser_result :: T.ThriftVal -> GetSearchResultsByUser_result-to_GetSearchResultsByUser_result (T.TStruct fields) = GetSearchResultsByUser_result{- getSearchResultsByUser_result_success = P.maybe (getSearchResultsByUser_result_success default_GetSearchResultsByUser_result) (\(_,_val45) -> (case _val45 of {T.TList _ _val46 -> (Vector.fromList $ P.map (\_v47 -> (case _v47 of {T.TStruct _val48 -> (Search_Types.to_SearchResult (T.TStruct _val48)); _ -> P.error "wrong type"})) _val46); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getSearchResultsByUser_result_ex = P.maybe (P.Nothing) (\(_,_val45) -> P.Just (case _val45 of {T.TStruct _val49 -> (Services_Types.to_ServicesException (T.TStruct _val49)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResultsByUser_result _ = P.error "not a struct"-read_GetSearchResultsByUser_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResultsByUser_result-read_GetSearchResultsByUser_result iprot = to_GetSearchResultsByUser_result <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_result)-decode_GetSearchResultsByUser_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResultsByUser_result-decode_GetSearchResultsByUser_result iprot bs = to_GetSearchResultsByUser_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_result) bs-typemap_GetSearchResultsByUser_result :: T.TypeMap-typemap_GetSearchResultsByUser_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT Search_Types.typemap_SearchResult)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetSearchResultsByUser_result :: GetSearchResultsByUser_result-default_GetSearchResultsByUser_result = GetSearchResultsByUser_result{- getSearchResultsByUser_result_success = Vector.empty,- getSearchResultsByUser_result_ex = P.Nothing}-data GetLatestSearchResult_args = GetLatestSearchResult_args { getLatestSearchResult_args_userId :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetLatestSearchResult_args where- hashWithSalt salt record = salt `H.hashWithSalt` getLatestSearchResult_args_userId record -instance QC.Arbitrary GetLatestSearchResult_args where - arbitrary = M.liftM GetLatestSearchResult_args (QC.arbitrary)- shrink obj | obj == default_GetLatestSearchResult_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetLatestSearchResult_args{getLatestSearchResult_args_userId = getLatestSearchResult_args_userId obj} then P.Nothing else P.Just $ default_GetLatestSearchResult_args{getLatestSearchResult_args_userId = getLatestSearchResult_args_userId obj}- ]-from_GetLatestSearchResult_args :: GetLatestSearchResult_args -> T.ThriftVal-from_GetLatestSearchResult_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v52 -> P.Just (1, ("userId",T.TString $ E.encodeUtf8 _v52))) $ getLatestSearchResult_args_userId record- ]-write_GetLatestSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_args -> P.IO ()-write_GetLatestSearchResult_args oprot record = T.writeVal oprot $ from_GetLatestSearchResult_args record-encode_GetLatestSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_args -> LBS.ByteString-encode_GetLatestSearchResult_args oprot record = T.serializeVal oprot $ from_GetLatestSearchResult_args record-to_GetLatestSearchResult_args :: T.ThriftVal -> GetLatestSearchResult_args-to_GetLatestSearchResult_args (T.TStruct fields) = GetLatestSearchResult_args{- getLatestSearchResult_args_userId = P.maybe (getLatestSearchResult_args_userId default_GetLatestSearchResult_args) (\(_,_val54) -> (case _val54 of {T.TString _val55 -> E.decodeUtf8 _val55; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetLatestSearchResult_args _ = P.error "not a struct"-read_GetLatestSearchResult_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetLatestSearchResult_args-read_GetLatestSearchResult_args iprot = to_GetLatestSearchResult_args <$> T.readVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_args)-decode_GetLatestSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetLatestSearchResult_args-decode_GetLatestSearchResult_args iprot bs = to_GetLatestSearchResult_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_args) bs-typemap_GetLatestSearchResult_args :: T.TypeMap-typemap_GetLatestSearchResult_args = Map.fromList [(1,("userId",T.T_STRING))]-default_GetLatestSearchResult_args :: GetLatestSearchResult_args-default_GetLatestSearchResult_args = GetLatestSearchResult_args{- getLatestSearchResult_args_userId = ""}-data GetLatestSearchResult_result = GetLatestSearchResult_result { getLatestSearchResult_result_success :: Search_Types.SearchResult- , getLatestSearchResult_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetLatestSearchResult_result where- hashWithSalt salt record = salt `H.hashWithSalt` getLatestSearchResult_result_success record `H.hashWithSalt` getLatestSearchResult_result_ex record -instance QC.Arbitrary GetLatestSearchResult_result where - arbitrary = M.liftM GetLatestSearchResult_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetLatestSearchResult_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetLatestSearchResult_result{getLatestSearchResult_result_success = getLatestSearchResult_result_success obj} then P.Nothing else P.Just $ default_GetLatestSearchResult_result{getLatestSearchResult_result_success = getLatestSearchResult_result_success obj}- , if obj == default_GetLatestSearchResult_result{getLatestSearchResult_result_ex = getLatestSearchResult_result_ex obj} then P.Nothing else P.Just $ default_GetLatestSearchResult_result{getLatestSearchResult_result_ex = getLatestSearchResult_result_ex obj}- ]-from_GetLatestSearchResult_result :: GetLatestSearchResult_result -> T.ThriftVal-from_GetLatestSearchResult_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v58 -> (1, ("ex",Services_Types.from_ServicesException _v58))) <$> getLatestSearchResult_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v58 -> P.Just (0, ("success",Search_Types.from_SearchResult _v58))) $ getLatestSearchResult_result_success record- , (\_v58 -> (1, ("ex",Services_Types.from_ServicesException _v58))) <$> getLatestSearchResult_result_ex record- ]- )-write_GetLatestSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_result -> P.IO ()-write_GetLatestSearchResult_result oprot record = T.writeVal oprot $ from_GetLatestSearchResult_result record-encode_GetLatestSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_result -> LBS.ByteString-encode_GetLatestSearchResult_result oprot record = T.serializeVal oprot $ from_GetLatestSearchResult_result record-to_GetLatestSearchResult_result :: T.ThriftVal -> GetLatestSearchResult_result-to_GetLatestSearchResult_result (T.TStruct fields) = GetLatestSearchResult_result{- getLatestSearchResult_result_success = P.maybe (getLatestSearchResult_result_success default_GetLatestSearchResult_result) (\(_,_val60) -> (case _val60 of {T.TStruct _val61 -> (Search_Types.to_SearchResult (T.TStruct _val61)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getLatestSearchResult_result_ex = P.maybe (P.Nothing) (\(_,_val60) -> P.Just (case _val60 of {T.TStruct _val62 -> (Services_Types.to_ServicesException (T.TStruct _val62)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetLatestSearchResult_result _ = P.error "not a struct"-read_GetLatestSearchResult_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetLatestSearchResult_result-read_GetLatestSearchResult_result iprot = to_GetLatestSearchResult_result <$> T.readVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_result)-decode_GetLatestSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetLatestSearchResult_result-decode_GetLatestSearchResult_result iprot bs = to_GetLatestSearchResult_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_result) bs-typemap_GetLatestSearchResult_result :: T.TypeMap-typemap_GetLatestSearchResult_result = Map.fromList [(0,("success",(T.T_STRUCT Search_Types.typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetLatestSearchResult_result :: GetLatestSearchResult_result-default_GetLatestSearchResult_result = GetLatestSearchResult_result{- getLatestSearchResult_result_success = Search_Types.default_SearchResult,- getLatestSearchResult_result_ex = P.Nothing}-data GetSearchResult_args = GetSearchResult_args { getSearchResult_args_searchResultId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResult_args where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResult_args_searchResultId record -instance QC.Arbitrary GetSearchResult_args where - arbitrary = M.liftM GetSearchResult_args (QC.arbitrary)- shrink obj | obj == default_GetSearchResult_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResult_args{getSearchResult_args_searchResultId = getSearchResult_args_searchResultId obj} then P.Nothing else P.Just $ default_GetSearchResult_args{getSearchResult_args_searchResultId = getSearchResult_args_searchResultId obj}- ]-from_GetSearchResult_args :: GetSearchResult_args -> T.ThriftVal-from_GetSearchResult_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v65 -> P.Just (1, ("searchResultId",Uuid_Types.from_UUID _v65))) $ getSearchResult_args_searchResultId record- ]-write_GetSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_args -> P.IO ()-write_GetSearchResult_args oprot record = T.writeVal oprot $ from_GetSearchResult_args record-encode_GetSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_args -> LBS.ByteString-encode_GetSearchResult_args oprot record = T.serializeVal oprot $ from_GetSearchResult_args record-to_GetSearchResult_args :: T.ThriftVal -> GetSearchResult_args-to_GetSearchResult_args (T.TStruct fields) = GetSearchResult_args{- getSearchResult_args_searchResultId = P.maybe (getSearchResult_args_searchResultId default_GetSearchResult_args) (\(_,_val67) -> (case _val67 of {T.TStruct _val68 -> (Uuid_Types.to_UUID (T.TStruct _val68)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResult_args _ = P.error "not a struct"-read_GetSearchResult_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResult_args-read_GetSearchResult_args iprot = to_GetSearchResult_args <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResult_args)-decode_GetSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResult_args-decode_GetSearchResult_args iprot bs = to_GetSearchResult_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResult_args) bs-typemap_GetSearchResult_args :: T.TypeMap-typemap_GetSearchResult_args = Map.fromList [(1,("searchResultId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_GetSearchResult_args :: GetSearchResult_args-default_GetSearchResult_args = GetSearchResult_args{- getSearchResult_args_searchResultId = Uuid_Types.default_UUID}-data GetSearchResult_result = GetSearchResult_result { getSearchResult_result_success :: Search_Types.SearchResult- , getSearchResult_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResult_result where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResult_result_success record `H.hashWithSalt` getSearchResult_result_ex record -instance QC.Arbitrary GetSearchResult_result where - arbitrary = M.liftM GetSearchResult_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetSearchResult_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResult_result{getSearchResult_result_success = getSearchResult_result_success obj} then P.Nothing else P.Just $ default_GetSearchResult_result{getSearchResult_result_success = getSearchResult_result_success obj}- , if obj == default_GetSearchResult_result{getSearchResult_result_ex = getSearchResult_result_ex obj} then P.Nothing else P.Just $ default_GetSearchResult_result{getSearchResult_result_ex = getSearchResult_result_ex obj}- ]-from_GetSearchResult_result :: GetSearchResult_result -> T.ThriftVal-from_GetSearchResult_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v71 -> (1, ("ex",Services_Types.from_ServicesException _v71))) <$> getSearchResult_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v71 -> P.Just (0, ("success",Search_Types.from_SearchResult _v71))) $ getSearchResult_result_success record- , (\_v71 -> (1, ("ex",Services_Types.from_ServicesException _v71))) <$> getSearchResult_result_ex record- ]- )-write_GetSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_result -> P.IO ()-write_GetSearchResult_result oprot record = T.writeVal oprot $ from_GetSearchResult_result record-encode_GetSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_result -> LBS.ByteString-encode_GetSearchResult_result oprot record = T.serializeVal oprot $ from_GetSearchResult_result record-to_GetSearchResult_result :: T.ThriftVal -> GetSearchResult_result-to_GetSearchResult_result (T.TStruct fields) = GetSearchResult_result{- getSearchResult_result_success = P.maybe (getSearchResult_result_success default_GetSearchResult_result) (\(_,_val73) -> (case _val73 of {T.TStruct _val74 -> (Search_Types.to_SearchResult (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getSearchResult_result_ex = P.maybe (P.Nothing) (\(_,_val73) -> P.Just (case _val73 of {T.TStruct _val75 -> (Services_Types.to_ServicesException (T.TStruct _val75)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResult_result _ = P.error "not a struct"-read_GetSearchResult_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResult_result-read_GetSearchResult_result iprot = to_GetSearchResult_result <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResult_result)-decode_GetSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResult_result-decode_GetSearchResult_result iprot bs = to_GetSearchResult_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResult_result) bs-typemap_GetSearchResult_result :: T.TypeMap-typemap_GetSearchResult_result = Map.fromList [(0,("success",(T.T_STRUCT Search_Types.typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetSearchResult_result :: GetSearchResult_result-default_GetSearchResult_result = GetSearchResult_result{- getSearchResult_result_success = Search_Types.default_SearchResult,- getSearchResult_result_ex = P.Nothing}-data StartSession_args = StartSession_args { startSession_args_searchResultId :: Uuid_Types.UUID- , startSession_args_taskType :: Services_Types.AnnotationTaskType- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartSession_args where- hashWithSalt salt record = salt `H.hashWithSalt` startSession_args_searchResultId record `H.hashWithSalt` startSession_args_taskType record -instance QC.Arbitrary StartSession_args where - arbitrary = M.liftM StartSession_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_StartSession_args = []- | P.otherwise = M.catMaybes- [ if obj == default_StartSession_args{startSession_args_searchResultId = startSession_args_searchResultId obj} then P.Nothing else P.Just $ default_StartSession_args{startSession_args_searchResultId = startSession_args_searchResultId obj}- , if obj == default_StartSession_args{startSession_args_taskType = startSession_args_taskType obj} then P.Nothing else P.Just $ default_StartSession_args{startSession_args_taskType = startSession_args_taskType obj}- ]-from_StartSession_args :: StartSession_args -> T.ThriftVal-from_StartSession_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v78 -> P.Just (1, ("searchResultId",Uuid_Types.from_UUID _v78))) $ startSession_args_searchResultId record- , (\_v78 -> P.Just (2, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v78))) $ startSession_args_taskType record- ]-write_StartSession_args :: (T.Protocol p, T.Transport t) => p t -> StartSession_args -> P.IO ()-write_StartSession_args oprot record = T.writeVal oprot $ from_StartSession_args record-encode_StartSession_args :: (T.Protocol p, T.Transport t) => p t -> StartSession_args -> LBS.ByteString-encode_StartSession_args oprot record = T.serializeVal oprot $ from_StartSession_args record-to_StartSession_args :: T.ThriftVal -> StartSession_args-to_StartSession_args (T.TStruct fields) = StartSession_args{- startSession_args_searchResultId = P.maybe (startSession_args_searchResultId default_StartSession_args) (\(_,_val80) -> (case _val80 of {T.TStruct _val81 -> (Uuid_Types.to_UUID (T.TStruct _val81)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- startSession_args_taskType = P.maybe (startSession_args_taskType default_StartSession_args) (\(_,_val80) -> (case _val80 of {T.TI32 _val82 -> P.toEnum $ P.fromIntegral _val82; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_StartSession_args _ = P.error "not a struct"-read_StartSession_args :: (T.Transport t, T.Protocol p) => p t -> P.IO StartSession_args-read_StartSession_args iprot = to_StartSession_args <$> T.readVal iprot (T.T_STRUCT typemap_StartSession_args)-decode_StartSession_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartSession_args-decode_StartSession_args iprot bs = to_StartSession_args $ T.deserializeVal iprot (T.T_STRUCT typemap_StartSession_args) bs-typemap_StartSession_args :: T.TypeMap-typemap_StartSession_args = Map.fromList [(1,("searchResultId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("taskType",T.T_I32))]-default_StartSession_args :: StartSession_args-default_StartSession_args = StartSession_args{- startSession_args_searchResultId = Uuid_Types.default_UUID,- startSession_args_taskType = (P.toEnum 0)}-data StartSession_result = StartSession_result { startSession_result_success :: Uuid_Types.UUID- , startSession_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartSession_result where- hashWithSalt salt record = salt `H.hashWithSalt` startSession_result_success record `H.hashWithSalt` startSession_result_ex record -instance QC.Arbitrary StartSession_result where - arbitrary = M.liftM StartSession_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_StartSession_result = []- | P.otherwise = M.catMaybes- [ if obj == default_StartSession_result{startSession_result_success = startSession_result_success obj} then P.Nothing else P.Just $ default_StartSession_result{startSession_result_success = startSession_result_success obj}- , if obj == default_StartSession_result{startSession_result_ex = startSession_result_ex obj} then P.Nothing else P.Just $ default_StartSession_result{startSession_result_ex = startSession_result_ex obj}- ]-from_StartSession_result :: StartSession_result -> T.ThriftVal-from_StartSession_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v85 -> (1, ("ex",Services_Types.from_ServicesException _v85))) <$> startSession_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v85 -> P.Just (0, ("success",Uuid_Types.from_UUID _v85))) $ startSession_result_success record- , (\_v85 -> (1, ("ex",Services_Types.from_ServicesException _v85))) <$> startSession_result_ex record- ]- )-write_StartSession_result :: (T.Protocol p, T.Transport t) => p t -> StartSession_result -> P.IO ()-write_StartSession_result oprot record = T.writeVal oprot $ from_StartSession_result record-encode_StartSession_result :: (T.Protocol p, T.Transport t) => p t -> StartSession_result -> LBS.ByteString-encode_StartSession_result oprot record = T.serializeVal oprot $ from_StartSession_result record-to_StartSession_result :: T.ThriftVal -> StartSession_result-to_StartSession_result (T.TStruct fields) = StartSession_result{- startSession_result_success = P.maybe (startSession_result_success default_StartSession_result) (\(_,_val87) -> (case _val87 of {T.TStruct _val88 -> (Uuid_Types.to_UUID (T.TStruct _val88)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- startSession_result_ex = P.maybe (P.Nothing) (\(_,_val87) -> P.Just (case _val87 of {T.TStruct _val89 -> (Services_Types.to_ServicesException (T.TStruct _val89)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StartSession_result _ = P.error "not a struct"-read_StartSession_result :: (T.Transport t, T.Protocol p) => p t -> P.IO StartSession_result-read_StartSession_result iprot = to_StartSession_result <$> T.readVal iprot (T.T_STRUCT typemap_StartSession_result)-decode_StartSession_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartSession_result-decode_StartSession_result iprot bs = to_StartSession_result $ T.deserializeVal iprot (T.T_STRUCT typemap_StartSession_result) bs-typemap_StartSession_result :: T.TypeMap-typemap_StartSession_result = Map.fromList [(0,("success",(T.T_STRUCT Uuid_Types.typemap_UUID))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_StartSession_result :: StartSession_result-default_StartSession_result = StartSession_result{- startSession_result_success = Uuid_Types.default_UUID,- startSession_result_ex = P.Nothing}-data StopSession_args = StopSession_args { stopSession_args_sessionId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StopSession_args where- hashWithSalt salt record = salt `H.hashWithSalt` stopSession_args_sessionId record -instance QC.Arbitrary StopSession_args where - arbitrary = M.liftM StopSession_args (QC.arbitrary)- shrink obj | obj == default_StopSession_args = []- | P.otherwise = M.catMaybes- [ if obj == default_StopSession_args{stopSession_args_sessionId = stopSession_args_sessionId obj} then P.Nothing else P.Just $ default_StopSession_args{stopSession_args_sessionId = stopSession_args_sessionId obj}- ]-from_StopSession_args :: StopSession_args -> T.ThriftVal-from_StopSession_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v92 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v92))) $ stopSession_args_sessionId record- ]-write_StopSession_args :: (T.Protocol p, T.Transport t) => p t -> StopSession_args -> P.IO ()-write_StopSession_args oprot record = T.writeVal oprot $ from_StopSession_args record-encode_StopSession_args :: (T.Protocol p, T.Transport t) => p t -> StopSession_args -> LBS.ByteString-encode_StopSession_args oprot record = T.serializeVal oprot $ from_StopSession_args record-to_StopSession_args :: T.ThriftVal -> StopSession_args-to_StopSession_args (T.TStruct fields) = StopSession_args{- stopSession_args_sessionId = P.maybe (stopSession_args_sessionId default_StopSession_args) (\(_,_val94) -> (case _val94 of {T.TStruct _val95 -> (Uuid_Types.to_UUID (T.TStruct _val95)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StopSession_args _ = P.error "not a struct"-read_StopSession_args :: (T.Transport t, T.Protocol p) => p t -> P.IO StopSession_args-read_StopSession_args iprot = to_StopSession_args <$> T.readVal iprot (T.T_STRUCT typemap_StopSession_args)-decode_StopSession_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StopSession_args-decode_StopSession_args iprot bs = to_StopSession_args $ T.deserializeVal iprot (T.T_STRUCT typemap_StopSession_args) bs-typemap_StopSession_args :: T.TypeMap-typemap_StopSession_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_StopSession_args :: StopSession_args-default_StopSession_args = StopSession_args{- stopSession_args_sessionId = Uuid_Types.default_UUID}-data StopSession_result = StopSession_result { stopSession_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StopSession_result where- hashWithSalt salt record = salt `H.hashWithSalt` stopSession_result_ex record -instance QC.Arbitrary StopSession_result where - arbitrary = M.liftM StopSession_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_StopSession_result = []- | P.otherwise = M.catMaybes- [ if obj == default_StopSession_result{stopSession_result_ex = stopSession_result_ex obj} then P.Nothing else P.Just $ default_StopSession_result{stopSession_result_ex = stopSession_result_ex obj}- ]-from_StopSession_result :: StopSession_result -> T.ThriftVal-from_StopSession_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> stopSession_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> stopSession_result_ex record- ]- )-write_StopSession_result :: (T.Protocol p, T.Transport t) => p t -> StopSession_result -> P.IO ()-write_StopSession_result oprot record = T.writeVal oprot $ from_StopSession_result record-encode_StopSession_result :: (T.Protocol p, T.Transport t) => p t -> StopSession_result -> LBS.ByteString-encode_StopSession_result oprot record = T.serializeVal oprot $ from_StopSession_result record-to_StopSession_result :: T.ThriftVal -> StopSession_result-to_StopSession_result (T.TStruct fields) = StopSession_result{- stopSession_result_ex = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TStruct _val101 -> (Services_Types.to_ServicesException (T.TStruct _val101)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StopSession_result _ = P.error "not a struct"-read_StopSession_result :: (T.Transport t, T.Protocol p) => p t -> P.IO StopSession_result-read_StopSession_result iprot = to_StopSession_result <$> T.readVal iprot (T.T_STRUCT typemap_StopSession_result)-decode_StopSession_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StopSession_result-decode_StopSession_result iprot bs = to_StopSession_result $ T.deserializeVal iprot (T.T_STRUCT typemap_StopSession_result) bs-typemap_StopSession_result :: T.TypeMap-typemap_StopSession_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_StopSession_result :: StopSession_result-default_StopSession_result = StopSession_result{- stopSession_result_ex = P.Nothing}-data GetNextChunk_args = GetNextChunk_args { getNextChunk_args_sessionId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetNextChunk_args where- hashWithSalt salt record = salt `H.hashWithSalt` getNextChunk_args_sessionId record -instance QC.Arbitrary GetNextChunk_args where - arbitrary = M.liftM GetNextChunk_args (QC.arbitrary)- shrink obj | obj == default_GetNextChunk_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetNextChunk_args{getNextChunk_args_sessionId = getNextChunk_args_sessionId obj} then P.Nothing else P.Just $ default_GetNextChunk_args{getNextChunk_args_sessionId = getNextChunk_args_sessionId obj}- ]-from_GetNextChunk_args :: GetNextChunk_args -> T.ThriftVal-from_GetNextChunk_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v104 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v104))) $ getNextChunk_args_sessionId record- ]-write_GetNextChunk_args :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_args -> P.IO ()-write_GetNextChunk_args oprot record = T.writeVal oprot $ from_GetNextChunk_args record-encode_GetNextChunk_args :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_args -> LBS.ByteString-encode_GetNextChunk_args oprot record = T.serializeVal oprot $ from_GetNextChunk_args record-to_GetNextChunk_args :: T.ThriftVal -> GetNextChunk_args-to_GetNextChunk_args (T.TStruct fields) = GetNextChunk_args{- getNextChunk_args_sessionId = P.maybe (getNextChunk_args_sessionId default_GetNextChunk_args) (\(_,_val106) -> (case _val106 of {T.TStruct _val107 -> (Uuid_Types.to_UUID (T.TStruct _val107)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetNextChunk_args _ = P.error "not a struct"-read_GetNextChunk_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetNextChunk_args-read_GetNextChunk_args iprot = to_GetNextChunk_args <$> T.readVal iprot (T.T_STRUCT typemap_GetNextChunk_args)-decode_GetNextChunk_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetNextChunk_args-decode_GetNextChunk_args iprot bs = to_GetNextChunk_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetNextChunk_args) bs-typemap_GetNextChunk_args :: T.TypeMap-typemap_GetNextChunk_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_GetNextChunk_args :: GetNextChunk_args-default_GetNextChunk_args = GetNextChunk_args{- getNextChunk_args_sessionId = Uuid_Types.default_UUID}-data GetNextChunk_result = GetNextChunk_result { getNextChunk_result_success :: (Vector.Vector Services_Types.AnnotationUnitIdentifier)- , getNextChunk_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetNextChunk_result where- hashWithSalt salt record = salt `H.hashWithSalt` getNextChunk_result_success record `H.hashWithSalt` getNextChunk_result_ex record -instance QC.Arbitrary GetNextChunk_result where - arbitrary = M.liftM GetNextChunk_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetNextChunk_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetNextChunk_result{getNextChunk_result_success = getNextChunk_result_success obj} then P.Nothing else P.Just $ default_GetNextChunk_result{getNextChunk_result_success = getNextChunk_result_success obj}- , if obj == default_GetNextChunk_result{getNextChunk_result_ex = getNextChunk_result_ex obj} then P.Nothing else P.Just $ default_GetNextChunk_result{getNextChunk_result_ex = getNextChunk_result_ex obj}- ]-from_GetNextChunk_result :: GetNextChunk_result -> T.ThriftVal-from_GetNextChunk_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v110 -> (1, ("ex",Services_Types.from_ServicesException _v110))) <$> getNextChunk_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v110 -> P.Just (0, ("success",T.TList (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier) $ P.map (\_v112 -> Services_Types.from_AnnotationUnitIdentifier _v112) $ Vector.toList _v110))) $ getNextChunk_result_success record- , (\_v110 -> (1, ("ex",Services_Types.from_ServicesException _v110))) <$> getNextChunk_result_ex record- ]- )-write_GetNextChunk_result :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_result -> P.IO ()-write_GetNextChunk_result oprot record = T.writeVal oprot $ from_GetNextChunk_result record-encode_GetNextChunk_result :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_result -> LBS.ByteString-encode_GetNextChunk_result oprot record = T.serializeVal oprot $ from_GetNextChunk_result record-to_GetNextChunk_result :: T.ThriftVal -> GetNextChunk_result-to_GetNextChunk_result (T.TStruct fields) = GetNextChunk_result{- getNextChunk_result_success = P.maybe (getNextChunk_result_success default_GetNextChunk_result) (\(_,_val114) -> (case _val114 of {T.TList _ _val115 -> (Vector.fromList $ P.map (\_v116 -> (case _v116 of {T.TStruct _val117 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val117)); _ -> P.error "wrong type"})) _val115); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getNextChunk_result_ex = P.maybe (P.Nothing) (\(_,_val114) -> P.Just (case _val114 of {T.TStruct _val118 -> (Services_Types.to_ServicesException (T.TStruct _val118)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetNextChunk_result _ = P.error "not a struct"-read_GetNextChunk_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetNextChunk_result-read_GetNextChunk_result iprot = to_GetNextChunk_result <$> T.readVal iprot (T.T_STRUCT typemap_GetNextChunk_result)-decode_GetNextChunk_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetNextChunk_result-decode_GetNextChunk_result iprot bs = to_GetNextChunk_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetNextChunk_result) bs-typemap_GetNextChunk_result :: T.TypeMap-typemap_GetNextChunk_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetNextChunk_result :: GetNextChunk_result-default_GetNextChunk_result = GetNextChunk_result{- getNextChunk_result_success = Vector.empty,- getNextChunk_result_ex = P.Nothing}-data SubmitAnnotation_args = SubmitAnnotation_args { submitAnnotation_args_sessionId :: Uuid_Types.UUID- , submitAnnotation_args_unitId :: Services_Types.AnnotationUnitIdentifier- , submitAnnotation_args_communication :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitAnnotation_args where- hashWithSalt salt record = salt `H.hashWithSalt` submitAnnotation_args_sessionId record `H.hashWithSalt` submitAnnotation_args_unitId record `H.hashWithSalt` submitAnnotation_args_communication record -instance QC.Arbitrary SubmitAnnotation_args where - arbitrary = M.liftM SubmitAnnotation_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SubmitAnnotation_args = []- | P.otherwise = M.catMaybes- [ if obj == default_SubmitAnnotation_args{submitAnnotation_args_sessionId = submitAnnotation_args_sessionId obj} then P.Nothing else P.Just $ default_SubmitAnnotation_args{submitAnnotation_args_sessionId = submitAnnotation_args_sessionId obj}- , if obj == default_SubmitAnnotation_args{submitAnnotation_args_unitId = submitAnnotation_args_unitId obj} then P.Nothing else P.Just $ default_SubmitAnnotation_args{submitAnnotation_args_unitId = submitAnnotation_args_unitId obj}- , if obj == default_SubmitAnnotation_args{submitAnnotation_args_communication = submitAnnotation_args_communication obj} then P.Nothing else P.Just $ default_SubmitAnnotation_args{submitAnnotation_args_communication = submitAnnotation_args_communication obj}- ]-from_SubmitAnnotation_args :: SubmitAnnotation_args -> T.ThriftVal-from_SubmitAnnotation_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v121 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v121))) $ submitAnnotation_args_sessionId record- , (\_v121 -> P.Just (2, ("unitId",Services_Types.from_AnnotationUnitIdentifier _v121))) $ submitAnnotation_args_unitId record- , (\_v121 -> P.Just (3, ("communication",Communication_Types.from_Communication _v121))) $ submitAnnotation_args_communication record- ]-write_SubmitAnnotation_args :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_args -> P.IO ()-write_SubmitAnnotation_args oprot record = T.writeVal oprot $ from_SubmitAnnotation_args record-encode_SubmitAnnotation_args :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_args -> LBS.ByteString-encode_SubmitAnnotation_args oprot record = T.serializeVal oprot $ from_SubmitAnnotation_args record-to_SubmitAnnotation_args :: T.ThriftVal -> SubmitAnnotation_args-to_SubmitAnnotation_args (T.TStruct fields) = SubmitAnnotation_args{- submitAnnotation_args_sessionId = P.maybe (submitAnnotation_args_sessionId default_SubmitAnnotation_args) (\(_,_val123) -> (case _val123 of {T.TStruct _val124 -> (Uuid_Types.to_UUID (T.TStruct _val124)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- submitAnnotation_args_unitId = P.maybe (submitAnnotation_args_unitId default_SubmitAnnotation_args) (\(_,_val123) -> (case _val123 of {T.TStruct _val125 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val125)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- submitAnnotation_args_communication = P.maybe (submitAnnotation_args_communication default_SubmitAnnotation_args) (\(_,_val123) -> (case _val123 of {T.TStruct _val126 -> (Communication_Types.to_Communication (T.TStruct _val126)); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_SubmitAnnotation_args _ = P.error "not a struct"-read_SubmitAnnotation_args :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitAnnotation_args-read_SubmitAnnotation_args iprot = to_SubmitAnnotation_args <$> T.readVal iprot (T.T_STRUCT typemap_SubmitAnnotation_args)-decode_SubmitAnnotation_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitAnnotation_args-decode_SubmitAnnotation_args iprot bs = to_SubmitAnnotation_args $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitAnnotation_args) bs-typemap_SubmitAnnotation_args :: T.TypeMap-typemap_SubmitAnnotation_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("unitId",(T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier))),(3,("communication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_SubmitAnnotation_args :: SubmitAnnotation_args-default_SubmitAnnotation_args = SubmitAnnotation_args{- submitAnnotation_args_sessionId = Uuid_Types.default_UUID,- submitAnnotation_args_unitId = Services_Types.default_AnnotationUnitIdentifier,- submitAnnotation_args_communication = Communication_Types.default_Communication}-data SubmitAnnotation_result = SubmitAnnotation_result { submitAnnotation_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitAnnotation_result where- hashWithSalt salt record = salt `H.hashWithSalt` submitAnnotation_result_ex record -instance QC.Arbitrary SubmitAnnotation_result where - arbitrary = M.liftM SubmitAnnotation_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SubmitAnnotation_result = []- | P.otherwise = M.catMaybes- [ if obj == default_SubmitAnnotation_result{submitAnnotation_result_ex = submitAnnotation_result_ex obj} then P.Nothing else P.Just $ default_SubmitAnnotation_result{submitAnnotation_result_ex = submitAnnotation_result_ex obj}- ]-from_SubmitAnnotation_result :: SubmitAnnotation_result -> T.ThriftVal-from_SubmitAnnotation_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v129 -> (1, ("ex",Services_Types.from_ServicesException _v129))) <$> submitAnnotation_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v129 -> (1, ("ex",Services_Types.from_ServicesException _v129))) <$> submitAnnotation_result_ex record- ]- )-write_SubmitAnnotation_result :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_result -> P.IO ()-write_SubmitAnnotation_result oprot record = T.writeVal oprot $ from_SubmitAnnotation_result record-encode_SubmitAnnotation_result :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_result -> LBS.ByteString-encode_SubmitAnnotation_result oprot record = T.serializeVal oprot $ from_SubmitAnnotation_result record-to_SubmitAnnotation_result :: T.ThriftVal -> SubmitAnnotation_result-to_SubmitAnnotation_result (T.TStruct fields) = SubmitAnnotation_result{- submitAnnotation_result_ex = P.maybe (P.Nothing) (\(_,_val131) -> P.Just (case _val131 of {T.TStruct _val132 -> (Services_Types.to_ServicesException (T.TStruct _val132)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_SubmitAnnotation_result _ = P.error "not a struct"-read_SubmitAnnotation_result :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitAnnotation_result-read_SubmitAnnotation_result iprot = to_SubmitAnnotation_result <$> T.readVal iprot (T.T_STRUCT typemap_SubmitAnnotation_result)-decode_SubmitAnnotation_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitAnnotation_result-decode_SubmitAnnotation_result iprot bs = to_SubmitAnnotation_result $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitAnnotation_result) bs-typemap_SubmitAnnotation_result :: T.TypeMap-typemap_SubmitAnnotation_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_SubmitAnnotation_result :: SubmitAnnotation_result-default_SubmitAnnotation_result = SubmitAnnotation_result{- submitAnnotation_result_ex = P.Nothing}-process_registerSearchResult (seqid, iprot, oprot, handler) = do- args <- read_RegisterSearchResult_args iprot- (X.catch- (X.catch- (do- Iface.registerSearchResult handler (registerSearchResult_args_result args) (registerSearchResult_args_taskType args)- let res = default_RegisterSearchResult_result- T.writeMessageBegin oprot ("registerSearchResult", T.M_REPLY, seqid)- write_RegisterSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_RegisterSearchResult_result{registerSearchResult_result_ex = P.Just e}- T.writeMessageBegin oprot ("registerSearchResult", T.M_REPLY, seqid)- write_RegisterSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("registerSearchResult", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getSearchResults (seqid, iprot, oprot, handler) = do- args <- read_GetSearchResults_args iprot- (X.catch- (X.catch- (do- val <- Iface.getSearchResults handler (getSearchResults_args_taskType args) (getSearchResults_args_limit args)- let res = default_GetSearchResults_result{getSearchResults_result_success = val}- T.writeMessageBegin oprot ("getSearchResults", T.M_REPLY, seqid)- write_GetSearchResults_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetSearchResults_result{getSearchResults_result_ex = P.Just e}- T.writeMessageBegin oprot ("getSearchResults", T.M_REPLY, seqid)- write_GetSearchResults_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getSearchResults", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getSearchResultsByUser (seqid, iprot, oprot, handler) = do- args <- read_GetSearchResultsByUser_args iprot- (X.catch- (X.catch- (do- val <- Iface.getSearchResultsByUser handler (getSearchResultsByUser_args_taskType args) (getSearchResultsByUser_args_userId args) (getSearchResultsByUser_args_limit args)- let res = default_GetSearchResultsByUser_result{getSearchResultsByUser_result_success = val}- T.writeMessageBegin oprot ("getSearchResultsByUser", T.M_REPLY, seqid)- write_GetSearchResultsByUser_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetSearchResultsByUser_result{getSearchResultsByUser_result_ex = P.Just e}- T.writeMessageBegin oprot ("getSearchResultsByUser", T.M_REPLY, seqid)- write_GetSearchResultsByUser_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getSearchResultsByUser", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getLatestSearchResult (seqid, iprot, oprot, handler) = do- args <- read_GetLatestSearchResult_args iprot- (X.catch- (X.catch- (do- val <- Iface.getLatestSearchResult handler (getLatestSearchResult_args_userId args)- let res = default_GetLatestSearchResult_result{getLatestSearchResult_result_success = val}- T.writeMessageBegin oprot ("getLatestSearchResult", T.M_REPLY, seqid)- write_GetLatestSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetLatestSearchResult_result{getLatestSearchResult_result_ex = P.Just e}- T.writeMessageBegin oprot ("getLatestSearchResult", T.M_REPLY, seqid)- write_GetLatestSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getLatestSearchResult", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getSearchResult (seqid, iprot, oprot, handler) = do- args <- read_GetSearchResult_args iprot- (X.catch- (X.catch- (do- val <- Iface.getSearchResult handler (getSearchResult_args_searchResultId args)- let res = default_GetSearchResult_result{getSearchResult_result_success = val}- T.writeMessageBegin oprot ("getSearchResult", T.M_REPLY, seqid)- write_GetSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetSearchResult_result{getSearchResult_result_ex = P.Just e}- T.writeMessageBegin oprot ("getSearchResult", T.M_REPLY, seqid)- write_GetSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getSearchResult", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_startSession (seqid, iprot, oprot, handler) = do- args <- read_StartSession_args iprot- (X.catch- (X.catch- (do- val <- Iface.startSession handler (startSession_args_searchResultId args) (startSession_args_taskType args)- let res = default_StartSession_result{startSession_result_success = val}- T.writeMessageBegin oprot ("startSession", T.M_REPLY, seqid)- write_StartSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_StartSession_result{startSession_result_ex = P.Just e}- T.writeMessageBegin oprot ("startSession", T.M_REPLY, seqid)- write_StartSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("startSession", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_stopSession (seqid, iprot, oprot, handler) = do- args <- read_StopSession_args iprot- (X.catch- (X.catch- (do- Iface.stopSession handler (stopSession_args_sessionId args)- let res = default_StopSession_result- T.writeMessageBegin oprot ("stopSession", T.M_REPLY, seqid)- write_StopSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_StopSession_result{stopSession_result_ex = P.Just e}- T.writeMessageBegin oprot ("stopSession", T.M_REPLY, seqid)- write_StopSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("stopSession", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getNextChunk (seqid, iprot, oprot, handler) = do- args <- read_GetNextChunk_args iprot- (X.catch- (X.catch- (do- val <- Iface.getNextChunk handler (getNextChunk_args_sessionId args)- let res = default_GetNextChunk_result{getNextChunk_result_success = val}- T.writeMessageBegin oprot ("getNextChunk", T.M_REPLY, seqid)- write_GetNextChunk_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetNextChunk_result{getNextChunk_result_ex = P.Just e}- T.writeMessageBegin oprot ("getNextChunk", T.M_REPLY, seqid)- write_GetNextChunk_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getNextChunk", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_submitAnnotation (seqid, iprot, oprot, handler) = do- args <- read_SubmitAnnotation_args iprot- (X.catch- (X.catch- (do- Iface.submitAnnotation handler (submitAnnotation_args_sessionId args) (submitAnnotation_args_unitId args) (submitAnnotation_args_communication args)- let res = default_SubmitAnnotation_result- T.writeMessageBegin oprot ("submitAnnotation", T.M_REPLY, seqid)- write_SubmitAnnotation_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_SubmitAnnotation_result{submitAnnotation_result_ex = P.Just e}- T.writeMessageBegin oprot ("submitAnnotation", T.M_REPLY, seqid)- write_SubmitAnnotation_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("submitAnnotation", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "registerSearchResult" -> process_registerSearchResult (seqid,iprot,oprot,handler)- "getSearchResults" -> process_getSearchResults (seqid,iprot,oprot,handler)- "getSearchResultsByUser" -> process_getSearchResultsByUser (seqid,iprot,oprot,handler)- "getLatestSearchResult" -> process_getLatestSearchResult (seqid,iprot,oprot,handler)- "getSearchResult" -> process_getSearchResult (seqid,iprot,oprot,handler)- "startSession" -> process_startSession (seqid,iprot,oprot,handler)- "stopSession" -> process_stopSession (seqid,iprot,oprot,handler)- "getNextChunk" -> process_getNextChunk (seqid,iprot,oprot,handler)- "submitAnnotation" -> process_submitAnnotation (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/ResultsServerService_Client.hs
@@ -1,203 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ResultsServerService_Client(registerSearchResult,getSearchResults,getSearchResultsByUser,getLatestSearchResult,getSearchResult,startSession,stopSession,getNextChunk,submitAnnotation) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import Results_Types-import ResultsServerService-seqid = R.newIORef 0-registerSearchResult (ip,op) arg_result arg_taskType = do- send_registerSearchResult op arg_result arg_taskType- recv_registerSearchResult ip-send_registerSearchResult op arg_result arg_taskType = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("registerSearchResult", T.M_CALL, seqn)- write_RegisterSearchResult_args op (RegisterSearchResult_args{registerSearchResult_args_result=arg_result,registerSearchResult_args_taskType=arg_taskType})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_registerSearchResult ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_RegisterSearchResult_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (registerSearchResult_result_ex res)- P.return ()-getSearchResults (ip,op) arg_taskType arg_limit = do- send_getSearchResults op arg_taskType arg_limit- recv_getSearchResults ip-send_getSearchResults op arg_taskType arg_limit = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getSearchResults", T.M_CALL, seqn)- write_GetSearchResults_args op (GetSearchResults_args{getSearchResults_args_taskType=arg_taskType,getSearchResults_args_limit=arg_limit})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getSearchResults ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetSearchResults_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getSearchResults_result_ex res)- P.return $ getSearchResults_result_success res-getSearchResultsByUser (ip,op) arg_taskType arg_userId arg_limit = do- send_getSearchResultsByUser op arg_taskType arg_userId arg_limit- recv_getSearchResultsByUser ip-send_getSearchResultsByUser op arg_taskType arg_userId arg_limit = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getSearchResultsByUser", T.M_CALL, seqn)- write_GetSearchResultsByUser_args op (GetSearchResultsByUser_args{getSearchResultsByUser_args_taskType=arg_taskType,getSearchResultsByUser_args_userId=arg_userId,getSearchResultsByUser_args_limit=arg_limit})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getSearchResultsByUser ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetSearchResultsByUser_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getSearchResultsByUser_result_ex res)- P.return $ getSearchResultsByUser_result_success res-getLatestSearchResult (ip,op) arg_userId = do- send_getLatestSearchResult op arg_userId- recv_getLatestSearchResult ip-send_getLatestSearchResult op arg_userId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getLatestSearchResult", T.M_CALL, seqn)- write_GetLatestSearchResult_args op (GetLatestSearchResult_args{getLatestSearchResult_args_userId=arg_userId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getLatestSearchResult ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetLatestSearchResult_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getLatestSearchResult_result_ex res)- P.return $ getLatestSearchResult_result_success res-getSearchResult (ip,op) arg_searchResultId = do- send_getSearchResult op arg_searchResultId- recv_getSearchResult ip-send_getSearchResult op arg_searchResultId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getSearchResult", T.M_CALL, seqn)- write_GetSearchResult_args op (GetSearchResult_args{getSearchResult_args_searchResultId=arg_searchResultId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getSearchResult ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetSearchResult_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getSearchResult_result_ex res)- P.return $ getSearchResult_result_success res-startSession (ip,op) arg_searchResultId arg_taskType = do- send_startSession op arg_searchResultId arg_taskType- recv_startSession ip-send_startSession op arg_searchResultId arg_taskType = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("startSession", T.M_CALL, seqn)- write_StartSession_args op (StartSession_args{startSession_args_searchResultId=arg_searchResultId,startSession_args_taskType=arg_taskType})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_startSession ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_StartSession_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (startSession_result_ex res)- P.return $ startSession_result_success res-stopSession (ip,op) arg_sessionId = do- send_stopSession op arg_sessionId- recv_stopSession ip-send_stopSession op arg_sessionId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("stopSession", T.M_CALL, seqn)- write_StopSession_args op (StopSession_args{stopSession_args_sessionId=arg_sessionId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_stopSession ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_StopSession_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (stopSession_result_ex res)- P.return ()-getNextChunk (ip,op) arg_sessionId = do- send_getNextChunk op arg_sessionId- recv_getNextChunk ip-send_getNextChunk op arg_sessionId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getNextChunk", T.M_CALL, seqn)- write_GetNextChunk_args op (GetNextChunk_args{getNextChunk_args_sessionId=arg_sessionId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getNextChunk ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetNextChunk_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getNextChunk_result_ex res)- P.return $ getNextChunk_result_success res-submitAnnotation (ip,op) arg_sessionId arg_unitId arg_communication = do- send_submitAnnotation op arg_sessionId arg_unitId arg_communication- recv_submitAnnotation ip-send_submitAnnotation op arg_sessionId arg_unitId arg_communication = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("submitAnnotation", T.M_CALL, seqn)- write_SubmitAnnotation_args op (SubmitAnnotation_args{submitAnnotation_args_sessionId=arg_sessionId,submitAnnotation_args_unitId=arg_unitId,submitAnnotation_args_communication=arg_communication})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_submitAnnotation ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_SubmitAnnotation_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (submitAnnotation_result_ex res)- P.return ()
− src/Data/Concrete/Services/ResultsServerService_Iface.hs
@@ -1,58 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.ResultsServerService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import Results_Types--import Service_Iface-class Service_Iface a => ResultsServerService_Iface a where- registerSearchResult :: a -> Search_Types.SearchResult -> Services_Types.AnnotationTaskType -> P.IO ()- getSearchResults :: a -> Services_Types.AnnotationTaskType -> I.Int32 -> P.IO (Vector.Vector Search_Types.SearchResult)- getSearchResultsByUser :: a -> Services_Types.AnnotationTaskType -> LT.Text -> I.Int32 -> P.IO (Vector.Vector Search_Types.SearchResult)- getLatestSearchResult :: a -> LT.Text -> P.IO Search_Types.SearchResult- getSearchResult :: a -> Uuid_Types.UUID -> P.IO Search_Types.SearchResult- startSession :: a -> Uuid_Types.UUID -> Services_Types.AnnotationTaskType -> P.IO Uuid_Types.UUID- stopSession :: a -> Uuid_Types.UUID -> P.IO ()- getNextChunk :: a -> Uuid_Types.UUID -> P.IO (Vector.Vector Services_Types.AnnotationUnitIdentifier)- submitAnnotation :: a -> Uuid_Types.UUID -> Services_Types.AnnotationUnitIdentifier -> Communication_Types.Communication -> P.IO ()
− src/Data/Concrete/Services/SearchProxyService.hs
@@ -1,443 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SearchProxyService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import qualified Service-import Search_Types-import qualified SearchProxyService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Search_args = Search_args { search_args_query :: SearchQuery- , search_args_provider :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_args where- hashWithSalt salt record = salt `H.hashWithSalt` search_args_query record `H.hashWithSalt` search_args_provider record -instance QC.Arbitrary Search_args where - arbitrary = M.liftM Search_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Search_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_args{search_args_query = search_args_query obj} then P.Nothing else P.Just $ default_Search_args{search_args_query = search_args_query obj}- , if obj == default_Search_args{search_args_provider = search_args_provider obj} then P.Nothing else P.Just $ default_Search_args{search_args_provider = search_args_provider obj}- ]-from_Search_args :: Search_args -> T.ThriftVal-from_Search_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v109 -> P.Just (1, ("query",from_SearchQuery _v109))) $ search_args_query record- , (\_v109 -> P.Just (2, ("provider",T.TString $ E.encodeUtf8 _v109))) $ search_args_provider record- ]-write_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> P.IO ()-write_Search_args oprot record = T.writeVal oprot $ from_Search_args record-encode_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> LBS.ByteString-encode_Search_args oprot record = T.serializeVal oprot $ from_Search_args record-to_Search_args :: T.ThriftVal -> Search_args-to_Search_args (T.TStruct fields) = Search_args{- search_args_query = P.maybe (search_args_query default_Search_args) (\(_,_val111) -> (case _val111 of {T.TStruct _val112 -> (to_SearchQuery (T.TStruct _val112)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- search_args_provider = P.maybe (search_args_provider default_Search_args) (\(_,_val111) -> (case _val111 of {T.TString _val113 -> E.decodeUtf8 _val113; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_Search_args _ = P.error "not a struct"-read_Search_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_args-read_Search_args iprot = to_Search_args <$> T.readVal iprot (T.T_STRUCT typemap_Search_args)-decode_Search_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_args-decode_Search_args iprot bs = to_Search_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_args) bs-typemap_Search_args :: T.TypeMap-typemap_Search_args = Map.fromList [(1,("query",(T.T_STRUCT typemap_SearchQuery))),(2,("provider",T.T_STRING))]-default_Search_args :: Search_args-default_Search_args = Search_args{- search_args_query = default_SearchQuery,- search_args_provider = ""}-data Search_result = Search_result { search_result_success :: SearchResult- , search_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_result where- hashWithSalt salt record = salt `H.hashWithSalt` search_result_success record `H.hashWithSalt` search_result_ex record -instance QC.Arbitrary Search_result where - arbitrary = M.liftM Search_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Search_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_result{search_result_success = search_result_success obj} then P.Nothing else P.Just $ default_Search_result{search_result_success = search_result_success obj}- , if obj == default_Search_result{search_result_ex = search_result_ex obj} then P.Nothing else P.Just $ default_Search_result{search_result_ex = search_result_ex obj}- ]-from_Search_result :: Search_result -> T.ThriftVal-from_Search_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v116 -> (1, ("ex",Services_Types.from_ServicesException _v116))) <$> search_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v116 -> P.Just (0, ("success",from_SearchResult _v116))) $ search_result_success record- , (\_v116 -> (1, ("ex",Services_Types.from_ServicesException _v116))) <$> search_result_ex record- ]- )-write_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> P.IO ()-write_Search_result oprot record = T.writeVal oprot $ from_Search_result record-encode_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> LBS.ByteString-encode_Search_result oprot record = T.serializeVal oprot $ from_Search_result record-to_Search_result :: T.ThriftVal -> Search_result-to_Search_result (T.TStruct fields) = Search_result{- search_result_success = P.maybe (search_result_success default_Search_result) (\(_,_val118) -> (case _val118 of {T.TStruct _val119 -> (to_SearchResult (T.TStruct _val119)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- search_result_ex = P.maybe (P.Nothing) (\(_,_val118) -> P.Just (case _val118 of {T.TStruct _val120 -> (Services_Types.to_ServicesException (T.TStruct _val120)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Search_result _ = P.error "not a struct"-read_Search_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_result-read_Search_result iprot = to_Search_result <$> T.readVal iprot (T.T_STRUCT typemap_Search_result)-decode_Search_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_result-decode_Search_result iprot bs = to_Search_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_result) bs-typemap_Search_result :: T.TypeMap-typemap_Search_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Search_result :: Search_result-default_Search_result = Search_result{- search_result_success = default_SearchResult,- search_result_ex = P.Nothing}-data GetProviders_args = GetProviders_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetProviders_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetProviders_args where - arbitrary = QC.elements [GetProviders_args]-from_GetProviders_args :: GetProviders_args -> T.ThriftVal-from_GetProviders_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetProviders_args :: (T.Protocol p, T.Transport t) => p t -> GetProviders_args -> P.IO ()-write_GetProviders_args oprot record = T.writeVal oprot $ from_GetProviders_args record-encode_GetProviders_args :: (T.Protocol p, T.Transport t) => p t -> GetProviders_args -> LBS.ByteString-encode_GetProviders_args oprot record = T.serializeVal oprot $ from_GetProviders_args record-to_GetProviders_args :: T.ThriftVal -> GetProviders_args-to_GetProviders_args (T.TStruct fields) = GetProviders_args{-- }-to_GetProviders_args _ = P.error "not a struct"-read_GetProviders_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetProviders_args-read_GetProviders_args iprot = to_GetProviders_args <$> T.readVal iprot (T.T_STRUCT typemap_GetProviders_args)-decode_GetProviders_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetProviders_args-decode_GetProviders_args iprot bs = to_GetProviders_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetProviders_args) bs-typemap_GetProviders_args :: T.TypeMap-typemap_GetProviders_args = Map.fromList []-default_GetProviders_args :: GetProviders_args-default_GetProviders_args = GetProviders_args{-}-data GetProviders_result = GetProviders_result { getProviders_result_success :: (Vector.Vector LT.Text)- , getProviders_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetProviders_result where- hashWithSalt salt record = salt `H.hashWithSalt` getProviders_result_success record `H.hashWithSalt` getProviders_result_ex record -instance QC.Arbitrary GetProviders_result where - arbitrary = M.liftM GetProviders_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetProviders_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetProviders_result{getProviders_result_success = getProviders_result_success obj} then P.Nothing else P.Just $ default_GetProviders_result{getProviders_result_success = getProviders_result_success obj}- , if obj == default_GetProviders_result{getProviders_result_ex = getProviders_result_ex obj} then P.Nothing else P.Just $ default_GetProviders_result{getProviders_result_ex = getProviders_result_ex obj}- ]-from_GetProviders_result :: GetProviders_result -> T.ThriftVal-from_GetProviders_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v128 -> (1, ("ex",Services_Types.from_ServicesException _v128))) <$> getProviders_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v128 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v130 -> T.TString $ E.encodeUtf8 _v130) $ Vector.toList _v128))) $ getProviders_result_success record- , (\_v128 -> (1, ("ex",Services_Types.from_ServicesException _v128))) <$> getProviders_result_ex record- ]- )-write_GetProviders_result :: (T.Protocol p, T.Transport t) => p t -> GetProviders_result -> P.IO ()-write_GetProviders_result oprot record = T.writeVal oprot $ from_GetProviders_result record-encode_GetProviders_result :: (T.Protocol p, T.Transport t) => p t -> GetProviders_result -> LBS.ByteString-encode_GetProviders_result oprot record = T.serializeVal oprot $ from_GetProviders_result record-to_GetProviders_result :: T.ThriftVal -> GetProviders_result-to_GetProviders_result (T.TStruct fields) = GetProviders_result{- getProviders_result_success = P.maybe (getProviders_result_success default_GetProviders_result) (\(_,_val132) -> (case _val132 of {T.TList _ _val133 -> (Vector.fromList $ P.map (\_v134 -> (case _v134 of {T.TString _val135 -> E.decodeUtf8 _val135; _ -> P.error "wrong type"})) _val133); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getProviders_result_ex = P.maybe (P.Nothing) (\(_,_val132) -> P.Just (case _val132 of {T.TStruct _val136 -> (Services_Types.to_ServicesException (T.TStruct _val136)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetProviders_result _ = P.error "not a struct"-read_GetProviders_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetProviders_result-read_GetProviders_result iprot = to_GetProviders_result <$> T.readVal iprot (T.T_STRUCT typemap_GetProviders_result)-decode_GetProviders_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetProviders_result-decode_GetProviders_result iprot bs = to_GetProviders_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetProviders_result) bs-typemap_GetProviders_result :: T.TypeMap-typemap_GetProviders_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetProviders_result :: GetProviders_result-default_GetProviders_result = GetProviders_result{- getProviders_result_success = Vector.empty,- getProviders_result_ex = P.Nothing}-data GetCapabilities_args = GetCapabilities_args { getCapabilities_args_provider :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_args where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_args_provider record -instance QC.Arbitrary GetCapabilities_args where - arbitrary = M.liftM GetCapabilities_args (QC.arbitrary)- shrink obj | obj == default_GetCapabilities_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_args{getCapabilities_args_provider = getCapabilities_args_provider obj} then P.Nothing else P.Just $ default_GetCapabilities_args{getCapabilities_args_provider = getCapabilities_args_provider obj}- ]-from_GetCapabilities_args :: GetCapabilities_args -> T.ThriftVal-from_GetCapabilities_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v139 -> P.Just (1, ("provider",T.TString $ E.encodeUtf8 _v139))) $ getCapabilities_args_provider record- ]-write_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> P.IO ()-write_GetCapabilities_args oprot record = T.writeVal oprot $ from_GetCapabilities_args record-encode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> LBS.ByteString-encode_GetCapabilities_args oprot record = T.serializeVal oprot $ from_GetCapabilities_args record-to_GetCapabilities_args :: T.ThriftVal -> GetCapabilities_args-to_GetCapabilities_args (T.TStruct fields) = GetCapabilities_args{- getCapabilities_args_provider = P.maybe (getCapabilities_args_provider default_GetCapabilities_args) (\(_,_val141) -> (case _val141 of {T.TString _val142 -> E.decodeUtf8 _val142; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_args _ = P.error "not a struct"-read_GetCapabilities_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_args-read_GetCapabilities_args iprot = to_GetCapabilities_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_args)-decode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_args-decode_GetCapabilities_args iprot bs = to_GetCapabilities_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_args) bs-typemap_GetCapabilities_args :: T.TypeMap-typemap_GetCapabilities_args = Map.fromList [(1,("provider",T.T_STRING))]-default_GetCapabilities_args :: GetCapabilities_args-default_GetCapabilities_args = GetCapabilities_args{- getCapabilities_args_provider = ""}-data GetCapabilities_result = GetCapabilities_result { getCapabilities_result_success :: (Vector.Vector SearchCapability)- , getCapabilities_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_result_success record `H.hashWithSalt` getCapabilities_result_ex record -instance QC.Arbitrary GetCapabilities_result where - arbitrary = M.liftM GetCapabilities_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCapabilities_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj}- , if obj == default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj}- ]-from_GetCapabilities_result :: GetCapabilities_result -> T.ThriftVal-from_GetCapabilities_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v145 -> (1, ("ex",Services_Types.from_ServicesException _v145))) <$> getCapabilities_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v145 -> P.Just (0, ("success",T.TList (T.T_STRUCT typemap_SearchCapability) $ P.map (\_v147 -> from_SearchCapability _v147) $ Vector.toList _v145))) $ getCapabilities_result_success record- , (\_v145 -> (1, ("ex",Services_Types.from_ServicesException _v145))) <$> getCapabilities_result_ex record- ]- )-write_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> P.IO ()-write_GetCapabilities_result oprot record = T.writeVal oprot $ from_GetCapabilities_result record-encode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> LBS.ByteString-encode_GetCapabilities_result oprot record = T.serializeVal oprot $ from_GetCapabilities_result record-to_GetCapabilities_result :: T.ThriftVal -> GetCapabilities_result-to_GetCapabilities_result (T.TStruct fields) = GetCapabilities_result{- getCapabilities_result_success = P.maybe (getCapabilities_result_success default_GetCapabilities_result) (\(_,_val149) -> (case _val149 of {T.TList _ _val150 -> (Vector.fromList $ P.map (\_v151 -> (case _v151 of {T.TStruct _val152 -> (to_SearchCapability (T.TStruct _val152)); _ -> P.error "wrong type"})) _val150); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCapabilities_result_ex = P.maybe (P.Nothing) (\(_,_val149) -> P.Just (case _val149 of {T.TStruct _val153 -> (Services_Types.to_ServicesException (T.TStruct _val153)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_result _ = P.error "not a struct"-read_GetCapabilities_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_result-read_GetCapabilities_result iprot = to_GetCapabilities_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_result)-decode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_result-decode_GetCapabilities_result iprot bs = to_GetCapabilities_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_result) bs-typemap_GetCapabilities_result :: T.TypeMap-typemap_GetCapabilities_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT typemap_SearchCapability)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCapabilities_result :: GetCapabilities_result-default_GetCapabilities_result = GetCapabilities_result{- getCapabilities_result_success = Vector.empty,- getCapabilities_result_ex = P.Nothing}-data GetCorpora_args = GetCorpora_args { getCorpora_args_provider :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_args where- hashWithSalt salt record = salt `H.hashWithSalt` getCorpora_args_provider record -instance QC.Arbitrary GetCorpora_args where - arbitrary = M.liftM GetCorpora_args (QC.arbitrary)- shrink obj | obj == default_GetCorpora_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCorpora_args{getCorpora_args_provider = getCorpora_args_provider obj} then P.Nothing else P.Just $ default_GetCorpora_args{getCorpora_args_provider = getCorpora_args_provider obj}- ]-from_GetCorpora_args :: GetCorpora_args -> T.ThriftVal-from_GetCorpora_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v156 -> P.Just (1, ("provider",T.TString $ E.encodeUtf8 _v156))) $ getCorpora_args_provider record- ]-write_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> P.IO ()-write_GetCorpora_args oprot record = T.writeVal oprot $ from_GetCorpora_args record-encode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> LBS.ByteString-encode_GetCorpora_args oprot record = T.serializeVal oprot $ from_GetCorpora_args record-to_GetCorpora_args :: T.ThriftVal -> GetCorpora_args-to_GetCorpora_args (T.TStruct fields) = GetCorpora_args{- getCorpora_args_provider = P.maybe (getCorpora_args_provider default_GetCorpora_args) (\(_,_val158) -> (case _val158 of {T.TString _val159 -> E.decodeUtf8 _val159; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCorpora_args _ = P.error "not a struct"-read_GetCorpora_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_args-read_GetCorpora_args iprot = to_GetCorpora_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_args)-decode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_args-decode_GetCorpora_args iprot bs = to_GetCorpora_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_args) bs-typemap_GetCorpora_args :: T.TypeMap-typemap_GetCorpora_args = Map.fromList [(1,("provider",T.T_STRING))]-default_GetCorpora_args :: GetCorpora_args-default_GetCorpora_args = GetCorpora_args{- getCorpora_args_provider = ""}-data GetCorpora_result = GetCorpora_result { getCorpora_result_success :: (Vector.Vector LT.Text)- , getCorpora_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCorpora_result_success record `H.hashWithSalt` getCorpora_result_ex record -instance QC.Arbitrary GetCorpora_result where - arbitrary = M.liftM GetCorpora_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCorpora_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj}- , if obj == default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj}- ]-from_GetCorpora_result :: GetCorpora_result -> T.ThriftVal-from_GetCorpora_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v162 -> (1, ("ex",Services_Types.from_ServicesException _v162))) <$> getCorpora_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v162 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v164 -> T.TString $ E.encodeUtf8 _v164) $ Vector.toList _v162))) $ getCorpora_result_success record- , (\_v162 -> (1, ("ex",Services_Types.from_ServicesException _v162))) <$> getCorpora_result_ex record- ]- )-write_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> P.IO ()-write_GetCorpora_result oprot record = T.writeVal oprot $ from_GetCorpora_result record-encode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> LBS.ByteString-encode_GetCorpora_result oprot record = T.serializeVal oprot $ from_GetCorpora_result record-to_GetCorpora_result :: T.ThriftVal -> GetCorpora_result-to_GetCorpora_result (T.TStruct fields) = GetCorpora_result{- getCorpora_result_success = P.maybe (getCorpora_result_success default_GetCorpora_result) (\(_,_val166) -> (case _val166 of {T.TList _ _val167 -> (Vector.fromList $ P.map (\_v168 -> (case _v168 of {T.TString _val169 -> E.decodeUtf8 _val169; _ -> P.error "wrong type"})) _val167); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCorpora_result_ex = P.maybe (P.Nothing) (\(_,_val166) -> P.Just (case _val166 of {T.TStruct _val170 -> (Services_Types.to_ServicesException (T.TStruct _val170)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCorpora_result _ = P.error "not a struct"-read_GetCorpora_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_result-read_GetCorpora_result iprot = to_GetCorpora_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_result)-decode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_result-decode_GetCorpora_result iprot bs = to_GetCorpora_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_result) bs-typemap_GetCorpora_result :: T.TypeMap-typemap_GetCorpora_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCorpora_result :: GetCorpora_result-default_GetCorpora_result = GetCorpora_result{- getCorpora_result_success = Vector.empty,- getCorpora_result_ex = P.Nothing}-process_search (seqid, iprot, oprot, handler) = do- args <- read_Search_args iprot- (X.catch- (X.catch- (do- val <- Iface.search handler (search_args_query args) (search_args_provider args)- let res = default_Search_result{search_result_success = val}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Search_result{search_result_ex = P.Just e}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("search", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getProviders (seqid, iprot, oprot, handler) = do- args <- read_GetProviders_args iprot- (X.catch- (X.catch- (do- val <- Iface.getProviders handler- let res = default_GetProviders_result{getProviders_result_success = val}- T.writeMessageBegin oprot ("getProviders", T.M_REPLY, seqid)- write_GetProviders_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetProviders_result{getProviders_result_ex = P.Just e}- T.writeMessageBegin oprot ("getProviders", T.M_REPLY, seqid)- write_GetProviders_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getProviders", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCapabilities (seqid, iprot, oprot, handler) = do- args <- read_GetCapabilities_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCapabilities handler (getCapabilities_args_provider args)- let res = default_GetCapabilities_result{getCapabilities_result_success = val}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCapabilities_result{getCapabilities_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCapabilities", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCorpora (seqid, iprot, oprot, handler) = do- args <- read_GetCorpora_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCorpora handler (getCorpora_args_provider args)- let res = default_GetCorpora_result{getCorpora_result_success = val}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCorpora_result{getCorpora_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCorpora", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "search" -> process_search (seqid,iprot,oprot,handler)- "getProviders" -> process_getProviders (seqid,iprot,oprot,handler)- "getCapabilities" -> process_getCapabilities (seqid,iprot,oprot,handler)- "getCorpora" -> process_getCorpora (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/SearchProxyService_Client.hs
@@ -1,120 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SearchProxyService_Client(search,getProviders,getCapabilities,getCorpora) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types-import SearchProxyService-seqid = R.newIORef 0-search (ip,op) arg_query arg_provider = do- send_search op arg_query arg_provider- recv_search ip-send_search op arg_query arg_provider = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("search", T.M_CALL, seqn)- write_Search_args op (Search_args{search_args_query=arg_query,search_args_provider=arg_provider})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_search ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Search_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (search_result_ex res)- P.return $ search_result_success res-getProviders (ip,op) = do- send_getProviders op- recv_getProviders ip-send_getProviders op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getProviders", T.M_CALL, seqn)- write_GetProviders_args op (GetProviders_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getProviders ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetProviders_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getProviders_result_ex res)- P.return $ getProviders_result_success res-getCapabilities (ip,op) arg_provider = do- send_getCapabilities op arg_provider- recv_getCapabilities ip-send_getCapabilities op arg_provider = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCapabilities", T.M_CALL, seqn)- write_GetCapabilities_args op (GetCapabilities_args{getCapabilities_args_provider=arg_provider})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCapabilities ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCapabilities_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCapabilities_result_ex res)- P.return $ getCapabilities_result_success res-getCorpora (ip,op) arg_provider = do- send_getCorpora op arg_provider- recv_getCorpora ip-send_getCorpora op arg_provider = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCorpora", T.M_CALL, seqn)- write_GetCorpora_args op (GetCorpora_args{getCorpora_args_provider=arg_provider})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCorpora ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCorpora_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCorpora_result_ex res)- P.return $ getCorpora_result_success res
− src/Data/Concrete/Services/SearchProxyService_Iface.hs
@@ -1,55 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SearchProxyService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types--import Service_Iface-class Service_Iface a => SearchProxyService_Iface a where- search :: a -> SearchQuery -> LT.Text -> P.IO SearchResult- getProviders :: a -> P.IO (Vector.Vector LT.Text)- getCapabilities :: a -> LT.Text -> P.IO (Vector.Vector SearchCapability)- getCorpora :: a -> LT.Text -> P.IO (Vector.Vector LT.Text)
− src/Data/Concrete/Services/SearchService.hs
@@ -1,335 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SearchService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import qualified Service-import Search_Types-import qualified SearchService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Search_args = Search_args { search_args_query :: SearchQuery- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_args where- hashWithSalt salt record = salt `H.hashWithSalt` search_args_query record -instance QC.Arbitrary Search_args where - arbitrary = M.liftM Search_args (QC.arbitrary)- shrink obj | obj == default_Search_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_args{search_args_query = search_args_query obj} then P.Nothing else P.Just $ default_Search_args{search_args_query = search_args_query obj}- ]-from_Search_args :: Search_args -> T.ThriftVal-from_Search_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v64 -> P.Just (1, ("query",from_SearchQuery _v64))) $ search_args_query record- ]-write_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> P.IO ()-write_Search_args oprot record = T.writeVal oprot $ from_Search_args record-encode_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> LBS.ByteString-encode_Search_args oprot record = T.serializeVal oprot $ from_Search_args record-to_Search_args :: T.ThriftVal -> Search_args-to_Search_args (T.TStruct fields) = Search_args{- search_args_query = P.maybe (search_args_query default_Search_args) (\(_,_val66) -> (case _val66 of {T.TStruct _val67 -> (to_SearchQuery (T.TStruct _val67)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Search_args _ = P.error "not a struct"-read_Search_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_args-read_Search_args iprot = to_Search_args <$> T.readVal iprot (T.T_STRUCT typemap_Search_args)-decode_Search_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_args-decode_Search_args iprot bs = to_Search_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_args) bs-typemap_Search_args :: T.TypeMap-typemap_Search_args = Map.fromList [(1,("query",(T.T_STRUCT typemap_SearchQuery)))]-default_Search_args :: Search_args-default_Search_args = Search_args{- search_args_query = default_SearchQuery}-data Search_result = Search_result { search_result_success :: SearchResult- , search_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_result where- hashWithSalt salt record = salt `H.hashWithSalt` search_result_success record `H.hashWithSalt` search_result_ex record -instance QC.Arbitrary Search_result where - arbitrary = M.liftM Search_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Search_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_result{search_result_success = search_result_success obj} then P.Nothing else P.Just $ default_Search_result{search_result_success = search_result_success obj}- , if obj == default_Search_result{search_result_ex = search_result_ex obj} then P.Nothing else P.Just $ default_Search_result{search_result_ex = search_result_ex obj}- ]-from_Search_result :: Search_result -> T.ThriftVal-from_Search_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v70 -> (1, ("ex",Services_Types.from_ServicesException _v70))) <$> search_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v70 -> P.Just (0, ("success",from_SearchResult _v70))) $ search_result_success record- , (\_v70 -> (1, ("ex",Services_Types.from_ServicesException _v70))) <$> search_result_ex record- ]- )-write_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> P.IO ()-write_Search_result oprot record = T.writeVal oprot $ from_Search_result record-encode_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> LBS.ByteString-encode_Search_result oprot record = T.serializeVal oprot $ from_Search_result record-to_Search_result :: T.ThriftVal -> Search_result-to_Search_result (T.TStruct fields) = Search_result{- search_result_success = P.maybe (search_result_success default_Search_result) (\(_,_val72) -> (case _val72 of {T.TStruct _val73 -> (to_SearchResult (T.TStruct _val73)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- search_result_ex = P.maybe (P.Nothing) (\(_,_val72) -> P.Just (case _val72 of {T.TStruct _val74 -> (Services_Types.to_ServicesException (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Search_result _ = P.error "not a struct"-read_Search_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_result-read_Search_result iprot = to_Search_result <$> T.readVal iprot (T.T_STRUCT typemap_Search_result)-decode_Search_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_result-decode_Search_result iprot bs = to_Search_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_result) bs-typemap_Search_result :: T.TypeMap-typemap_Search_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Search_result :: Search_result-default_Search_result = Search_result{- search_result_success = default_SearchResult,- search_result_ex = P.Nothing}-data GetCapabilities_args = GetCapabilities_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCapabilities_args where - arbitrary = QC.elements [GetCapabilities_args]-from_GetCapabilities_args :: GetCapabilities_args -> T.ThriftVal-from_GetCapabilities_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> P.IO ()-write_GetCapabilities_args oprot record = T.writeVal oprot $ from_GetCapabilities_args record-encode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> LBS.ByteString-encode_GetCapabilities_args oprot record = T.serializeVal oprot $ from_GetCapabilities_args record-to_GetCapabilities_args :: T.ThriftVal -> GetCapabilities_args-to_GetCapabilities_args (T.TStruct fields) = GetCapabilities_args{-- }-to_GetCapabilities_args _ = P.error "not a struct"-read_GetCapabilities_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_args-read_GetCapabilities_args iprot = to_GetCapabilities_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_args)-decode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_args-decode_GetCapabilities_args iprot bs = to_GetCapabilities_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_args) bs-typemap_GetCapabilities_args :: T.TypeMap-typemap_GetCapabilities_args = Map.fromList []-default_GetCapabilities_args :: GetCapabilities_args-default_GetCapabilities_args = GetCapabilities_args{-}-data GetCapabilities_result = GetCapabilities_result { getCapabilities_result_success :: (Vector.Vector SearchCapability)- , getCapabilities_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_result_success record `H.hashWithSalt` getCapabilities_result_ex record -instance QC.Arbitrary GetCapabilities_result where - arbitrary = M.liftM GetCapabilities_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCapabilities_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj}- , if obj == default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj}- ]-from_GetCapabilities_result :: GetCapabilities_result -> T.ThriftVal-from_GetCapabilities_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v82 -> (1, ("ex",Services_Types.from_ServicesException _v82))) <$> getCapabilities_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v82 -> P.Just (0, ("success",T.TList (T.T_STRUCT typemap_SearchCapability) $ P.map (\_v84 -> from_SearchCapability _v84) $ Vector.toList _v82))) $ getCapabilities_result_success record- , (\_v82 -> (1, ("ex",Services_Types.from_ServicesException _v82))) <$> getCapabilities_result_ex record- ]- )-write_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> P.IO ()-write_GetCapabilities_result oprot record = T.writeVal oprot $ from_GetCapabilities_result record-encode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> LBS.ByteString-encode_GetCapabilities_result oprot record = T.serializeVal oprot $ from_GetCapabilities_result record-to_GetCapabilities_result :: T.ThriftVal -> GetCapabilities_result-to_GetCapabilities_result (T.TStruct fields) = GetCapabilities_result{- getCapabilities_result_success = P.maybe (getCapabilities_result_success default_GetCapabilities_result) (\(_,_val86) -> (case _val86 of {T.TList _ _val87 -> (Vector.fromList $ P.map (\_v88 -> (case _v88 of {T.TStruct _val89 -> (to_SearchCapability (T.TStruct _val89)); _ -> P.error "wrong type"})) _val87); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCapabilities_result_ex = P.maybe (P.Nothing) (\(_,_val86) -> P.Just (case _val86 of {T.TStruct _val90 -> (Services_Types.to_ServicesException (T.TStruct _val90)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_result _ = P.error "not a struct"-read_GetCapabilities_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_result-read_GetCapabilities_result iprot = to_GetCapabilities_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_result)-decode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_result-decode_GetCapabilities_result iprot bs = to_GetCapabilities_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_result) bs-typemap_GetCapabilities_result :: T.TypeMap-typemap_GetCapabilities_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT typemap_SearchCapability)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCapabilities_result :: GetCapabilities_result-default_GetCapabilities_result = GetCapabilities_result{- getCapabilities_result_success = Vector.empty,- getCapabilities_result_ex = P.Nothing}-data GetCorpora_args = GetCorpora_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCorpora_args where - arbitrary = QC.elements [GetCorpora_args]-from_GetCorpora_args :: GetCorpora_args -> T.ThriftVal-from_GetCorpora_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> P.IO ()-write_GetCorpora_args oprot record = T.writeVal oprot $ from_GetCorpora_args record-encode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> LBS.ByteString-encode_GetCorpora_args oprot record = T.serializeVal oprot $ from_GetCorpora_args record-to_GetCorpora_args :: T.ThriftVal -> GetCorpora_args-to_GetCorpora_args (T.TStruct fields) = GetCorpora_args{-- }-to_GetCorpora_args _ = P.error "not a struct"-read_GetCorpora_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_args-read_GetCorpora_args iprot = to_GetCorpora_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_args)-decode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_args-decode_GetCorpora_args iprot bs = to_GetCorpora_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_args) bs-typemap_GetCorpora_args :: T.TypeMap-typemap_GetCorpora_args = Map.fromList []-default_GetCorpora_args :: GetCorpora_args-default_GetCorpora_args = GetCorpora_args{-}-data GetCorpora_result = GetCorpora_result { getCorpora_result_success :: (Vector.Vector LT.Text)- , getCorpora_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCorpora_result_success record `H.hashWithSalt` getCorpora_result_ex record -instance QC.Arbitrary GetCorpora_result where - arbitrary = M.liftM GetCorpora_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCorpora_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj}- , if obj == default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj}- ]-from_GetCorpora_result :: GetCorpora_result -> T.ThriftVal-from_GetCorpora_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> getCorpora_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v98 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v100 -> T.TString $ E.encodeUtf8 _v100) $ Vector.toList _v98))) $ getCorpora_result_success record- , (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> getCorpora_result_ex record- ]- )-write_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> P.IO ()-write_GetCorpora_result oprot record = T.writeVal oprot $ from_GetCorpora_result record-encode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> LBS.ByteString-encode_GetCorpora_result oprot record = T.serializeVal oprot $ from_GetCorpora_result record-to_GetCorpora_result :: T.ThriftVal -> GetCorpora_result-to_GetCorpora_result (T.TStruct fields) = GetCorpora_result{- getCorpora_result_success = P.maybe (getCorpora_result_success default_GetCorpora_result) (\(_,_val102) -> (case _val102 of {T.TList _ _val103 -> (Vector.fromList $ P.map (\_v104 -> (case _v104 of {T.TString _val105 -> E.decodeUtf8 _val105; _ -> P.error "wrong type"})) _val103); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCorpora_result_ex = P.maybe (P.Nothing) (\(_,_val102) -> P.Just (case _val102 of {T.TStruct _val106 -> (Services_Types.to_ServicesException (T.TStruct _val106)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCorpora_result _ = P.error "not a struct"-read_GetCorpora_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_result-read_GetCorpora_result iprot = to_GetCorpora_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_result)-decode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_result-decode_GetCorpora_result iprot bs = to_GetCorpora_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_result) bs-typemap_GetCorpora_result :: T.TypeMap-typemap_GetCorpora_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCorpora_result :: GetCorpora_result-default_GetCorpora_result = GetCorpora_result{- getCorpora_result_success = Vector.empty,- getCorpora_result_ex = P.Nothing}-process_search (seqid, iprot, oprot, handler) = do- args <- read_Search_args iprot- (X.catch- (X.catch- (do- val <- Iface.search handler (search_args_query args)- let res = default_Search_result{search_result_success = val}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Search_result{search_result_ex = P.Just e}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("search", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCapabilities (seqid, iprot, oprot, handler) = do- args <- read_GetCapabilities_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCapabilities handler- let res = default_GetCapabilities_result{getCapabilities_result_success = val}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCapabilities_result{getCapabilities_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCapabilities", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCorpora (seqid, iprot, oprot, handler) = do- args <- read_GetCorpora_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCorpora handler- let res = default_GetCorpora_result{getCorpora_result_success = val}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCorpora_result{getCorpora_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCorpora", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "search" -> process_search (seqid,iprot,oprot,handler)- "getCapabilities" -> process_getCapabilities (seqid,iprot,oprot,handler)- "getCorpora" -> process_getCorpora (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/SearchService_Client.hs
@@ -1,103 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SearchService_Client(search,getCapabilities,getCorpora) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types-import SearchService-seqid = R.newIORef 0-search (ip,op) arg_query = do- send_search op arg_query- recv_search ip-send_search op arg_query = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("search", T.M_CALL, seqn)- write_Search_args op (Search_args{search_args_query=arg_query})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_search ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Search_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (search_result_ex res)- P.return $ search_result_success res-getCapabilities (ip,op) = do- send_getCapabilities op- recv_getCapabilities ip-send_getCapabilities op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCapabilities", T.M_CALL, seqn)- write_GetCapabilities_args op (GetCapabilities_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCapabilities ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCapabilities_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCapabilities_result_ex res)- P.return $ getCapabilities_result_success res-getCorpora (ip,op) = do- send_getCorpora op- recv_getCorpora ip-send_getCorpora op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCorpora", T.M_CALL, seqn)- write_GetCorpora_args op (GetCorpora_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCorpora ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCorpora_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCorpora_result_ex res)- P.return $ getCorpora_result_success res
− src/Data/Concrete/Services/SearchService_Iface.hs
@@ -1,54 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SearchService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types--import Service_Iface-class Service_Iface a => SearchService_Iface a where- search :: a -> SearchQuery -> P.IO SearchResult- getCapabilities :: a -> P.IO (Vector.Vector SearchCapability)- getCorpora :: a -> P.IO (Vector.Vector LT.Text)
− src/Data/Concrete/Services/Service.hs
@@ -1,206 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.Service where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types-import qualified Service_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data About_args = About_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable About_args where- hashWithSalt salt record = salt -instance QC.Arbitrary About_args where - arbitrary = QC.elements [About_args]-from_About_args :: About_args -> T.ThriftVal-from_About_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_About_args :: (T.Protocol p, T.Transport t) => p t -> About_args -> P.IO ()-write_About_args oprot record = T.writeVal oprot $ from_About_args record-encode_About_args :: (T.Protocol p, T.Transport t) => p t -> About_args -> LBS.ByteString-encode_About_args oprot record = T.serializeVal oprot $ from_About_args record-to_About_args :: T.ThriftVal -> About_args-to_About_args (T.TStruct fields) = About_args{-- }-to_About_args _ = P.error "not a struct"-read_About_args :: (T.Transport t, T.Protocol p) => p t -> P.IO About_args-read_About_args iprot = to_About_args <$> T.readVal iprot (T.T_STRUCT typemap_About_args)-decode_About_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> About_args-decode_About_args iprot bs = to_About_args $ T.deserializeVal iprot (T.T_STRUCT typemap_About_args) bs-typemap_About_args :: T.TypeMap-typemap_About_args = Map.fromList []-default_About_args :: About_args-default_About_args = About_args{-}-data About_result = About_result { about_result_success :: ServiceInfo- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable About_result where- hashWithSalt salt record = salt `H.hashWithSalt` about_result_success record -instance QC.Arbitrary About_result where - arbitrary = M.liftM About_result (QC.arbitrary)- shrink obj | obj == default_About_result = []- | P.otherwise = M.catMaybes- [ if obj == default_About_result{about_result_success = about_result_success obj} then P.Nothing else P.Just $ default_About_result{about_result_success = about_result_success obj}- ]-from_About_result :: About_result -> T.ThriftVal-from_About_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v43 -> P.Just (0, ("success",from_ServiceInfo _v43))) $ about_result_success record- ]-write_About_result :: (T.Protocol p, T.Transport t) => p t -> About_result -> P.IO ()-write_About_result oprot record = T.writeVal oprot $ from_About_result record-encode_About_result :: (T.Protocol p, T.Transport t) => p t -> About_result -> LBS.ByteString-encode_About_result oprot record = T.serializeVal oprot $ from_About_result record-to_About_result :: T.ThriftVal -> About_result-to_About_result (T.TStruct fields) = About_result{- about_result_success = P.maybe (about_result_success default_About_result) (\(_,_val45) -> (case _val45 of {T.TStruct _val46 -> (to_ServiceInfo (T.TStruct _val46)); _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_About_result _ = P.error "not a struct"-read_About_result :: (T.Transport t, T.Protocol p) => p t -> P.IO About_result-read_About_result iprot = to_About_result <$> T.readVal iprot (T.T_STRUCT typemap_About_result)-decode_About_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> About_result-decode_About_result iprot bs = to_About_result $ T.deserializeVal iprot (T.T_STRUCT typemap_About_result) bs-typemap_About_result :: T.TypeMap-typemap_About_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_ServiceInfo)))]-default_About_result :: About_result-default_About_result = About_result{- about_result_success = default_ServiceInfo}-data Alive_args = Alive_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Alive_args where- hashWithSalt salt record = salt -instance QC.Arbitrary Alive_args where - arbitrary = QC.elements [Alive_args]-from_Alive_args :: Alive_args -> T.ThriftVal-from_Alive_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Alive_args :: (T.Protocol p, T.Transport t) => p t -> Alive_args -> P.IO ()-write_Alive_args oprot record = T.writeVal oprot $ from_Alive_args record-encode_Alive_args :: (T.Protocol p, T.Transport t) => p t -> Alive_args -> LBS.ByteString-encode_Alive_args oprot record = T.serializeVal oprot $ from_Alive_args record-to_Alive_args :: T.ThriftVal -> Alive_args-to_Alive_args (T.TStruct fields) = Alive_args{-- }-to_Alive_args _ = P.error "not a struct"-read_Alive_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Alive_args-read_Alive_args iprot = to_Alive_args <$> T.readVal iprot (T.T_STRUCT typemap_Alive_args)-decode_Alive_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Alive_args-decode_Alive_args iprot bs = to_Alive_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Alive_args) bs-typemap_Alive_args :: T.TypeMap-typemap_Alive_args = Map.fromList []-default_Alive_args :: Alive_args-default_Alive_args = Alive_args{-}-data Alive_result = Alive_result { alive_result_success :: P.Bool- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Alive_result where- hashWithSalt salt record = salt `H.hashWithSalt` alive_result_success record -instance QC.Arbitrary Alive_result where - arbitrary = M.liftM Alive_result (QC.arbitrary)- shrink obj | obj == default_Alive_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Alive_result{alive_result_success = alive_result_success obj} then P.Nothing else P.Just $ default_Alive_result{alive_result_success = alive_result_success obj}- ]-from_Alive_result :: Alive_result -> T.ThriftVal-from_Alive_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v54 -> P.Just (0, ("success",T.TBool _v54))) $ alive_result_success record- ]-write_Alive_result :: (T.Protocol p, T.Transport t) => p t -> Alive_result -> P.IO ()-write_Alive_result oprot record = T.writeVal oprot $ from_Alive_result record-encode_Alive_result :: (T.Protocol p, T.Transport t) => p t -> Alive_result -> LBS.ByteString-encode_Alive_result oprot record = T.serializeVal oprot $ from_Alive_result record-to_Alive_result :: T.ThriftVal -> Alive_result-to_Alive_result (T.TStruct fields) = Alive_result{- alive_result_success = P.maybe (alive_result_success default_Alive_result) (\(_,_val56) -> (case _val56 of {T.TBool _val57 -> _val57; _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_Alive_result _ = P.error "not a struct"-read_Alive_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Alive_result-read_Alive_result iprot = to_Alive_result <$> T.readVal iprot (T.T_STRUCT typemap_Alive_result)-decode_Alive_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Alive_result-decode_Alive_result iprot bs = to_Alive_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Alive_result) bs-typemap_Alive_result :: T.TypeMap-typemap_Alive_result = Map.fromList [(0,("success",T.T_BOOL))]-default_Alive_result :: Alive_result-default_Alive_result = Alive_result{- alive_result_success = P.False}-process_about (seqid, iprot, oprot, handler) = do- args <- read_About_args iprot- (X.catch- (do- val <- Iface.about handler- let res = default_About_result{about_result_success = val}- T.writeMessageBegin oprot ("about", T.M_REPLY, seqid)- write_About_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("about", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_alive (seqid, iprot, oprot, handler) = do- args <- read_Alive_args iprot- (X.catch- (do- val <- Iface.alive handler- let res = default_Alive_result{alive_result_success = val}- T.writeMessageBegin oprot ("alive", T.M_REPLY, seqid)- write_Alive_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("alive", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "about" -> process_about (seqid,iprot,oprot,handler)- "alive" -> process_alive (seqid,iprot,oprot,handler)- _ -> do- _ <- T.readVal iprot (T.T_STRUCT Map.empty)- T.writeMessageBegin oprot (name,T.M_EXCEPTION,seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN_METHOD ("Unknown function " ++ LT.unpack name))- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/Service_Client.hs
@@ -1,78 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.Service_Client(about,alive) where-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types-import Service-seqid = R.newIORef 0-about (ip,op) = do- send_about op- recv_about ip-send_about op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("about", T.M_CALL, seqn)- write_About_args op (About_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_about ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_About_result ip- T.readMessageEnd ip- P.return $ about_result_success res-alive (ip,op) = do- send_alive op- recv_alive ip-send_alive op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("alive", T.M_CALL, seqn)- write_Alive_args op (Alive_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_alive ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Alive_result ip- T.readMessageEnd ip- P.return $ alive_result_success res
− src/Data/Concrete/Services/Service_Iface.hs
@@ -1,47 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.Service_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types--class Service_Iface a where- about :: a -> P.IO ServiceInfo- alive :: a -> P.IO P.Bool
+ src/Data/Concrete/Services/Store.hs view
@@ -0,0 +1,104 @@+{-# LANGUAGE DeriveGeneric, OverloadedStrings, FlexibleInstances #-}++module Data.Concrete.Services.Store ( HandleStore(..)+ , ZipStore(..)+ , TarStore(..)+ , process+ , makeTarStore+ ) where++import qualified Data.ByteString as SBS+import qualified Data.ByteString.Lazy as LBS+import qualified Codec.Compression.GZip as GZip+import qualified Codec.Compression.BZip as BZip+import qualified Codec.Archive.Zip as Zip+import qualified Codec.Archive.Tar as Tar+import qualified Codec.Archive.Tar.Entry as Tar+import qualified Codec.Archive.Tar.Index as Tar+import System.IO (Handle, hSeek, hTell, hFlush, SeekMode(..))+import qualified Data.Text.Lazy as T+import qualified Data.List as L+import Path.IO (resolveFile')+import Data.Either (rights)+import Path (Path, Dir, File, Abs, filename)+import Data.Concrete.Services (Compression(..))+import Data.Concrete.Autogen.Communication_Types (Communication(..), default_Communication, read_Communication, write_Communication)+import Data.Concrete.Autogen.Service_Iface (Service_Iface(about, alive))+import Data.Concrete.Autogen.Services_Types (ServiceInfo(..))+import Data.Concrete.Autogen.StoreCommunicationService_Iface (StoreCommunicationService_Iface(store))+import Data.Concrete.Autogen.StoreCommunicationService (process)+import Data.Concrete.Utils (commToString)+import System.IO (openFile, IOMode(..))+import Control.Monad (liftM)+import System.FilePath (takeExtension)++lift1st :: Monad m => (m a, b) -> m (a, b)+lift1st (f, s) = do+ f' <- f+ return (f', s)+++-- Handle-backed++newtype HandleStore = HandleStore (Handle, Maybe Compression)++instance Service_Iface HandleStore where+ about _ = return $ ServiceInfo "Flat-file-backed StoreCommunicationService" "0.0.1" (Just "Haskell implementation")+ alive _ = return True ++instance StoreCommunicationService_Iface HandleStore where+ store (HandleStore (h, c)) comm = do+ t <- commToString comm+ let c' = case c of+ Nothing -> id+ Just GZip -> GZip.compress+ Just BZip -> BZip.compress+ LBS.hPutStr h (c' t)++-- Zip-backed++newtype ZipStore = ZipStore (Handle, Maybe Compression)++instance Service_Iface (Zip.ZipArchive ()) where+ about _ = return $ ServiceInfo "Zip-backed StoreCommunicationService" "0.0.1" (Just "Haskell implementation")+ alive _ = return True++instance StoreCommunicationService_Iface (Zip.ZipArchive ()) where+ store _ c = do+ bs <- commToString c+ f <- filename <$> resolveFile' ((T.unpack . communication_id) c)+ es <- Zip.mkEntrySelector f+ return $ Zip.addEntry Zip.BZip2 (LBS.toStrict bs) es+ print $ T.unpack (communication_id c)+ return ()++-- Tar-backed++newtype TarStore = TarStore (Handle, (LBS.ByteString -> LBS.ByteString), SBS.ByteString, Integer)++makeTarStore :: String -> IO TarStore+makeTarStore f = do+ (h, c) <- case takeExtension f of+ ".tgz" -> lift1st (openFile f WriteMode, GZip.compress)+ ".tbz2" -> lift1st (openFile f WriteMode, BZip.compress)+ ".tar" -> lift1st (openFile f WriteMode, id)+ let pad = LBS.toStrict (c (LBS.replicate (1024) 0))+ return $ TarStore (h, c, pad, fromIntegral $ - (SBS.length pad))++instance Service_Iface TarStore where+ about _ = return $ ServiceInfo "Tar-backed StoreCommunicationService" "0.0.1" (Just "Haskell implementation")+ alive _ = return True++instance StoreCommunicationService_Iface TarStore where+ store (TarStore (h, c, pad, o)) comm = do+ cur <- hTell h+ if cur == 0 then return () else hSeek h RelativeSeek o+ t <- commToString comm+ let e = Tar.fileEntry ((L.head . rights) [Tar.toTarPath False ((T.unpack . communication_id) comm)]) t+ bs' = Tar.write [e]+ bs'' = LBS.toStrict bs'+ l = SBS.length bs''+ bs''' = SBS.take (l - 1024) bs''+ LBS.hPutStr h (c (LBS.fromStrict bs'''))+ SBS.hPutStr h pad+ hFlush h
− src/Data/Concrete/Services/StoreCommunicationService.hs
@@ -1,145 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.StoreCommunicationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import qualified Service-import Access_Types-import qualified StoreCommunicationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Store_args = Store_args { store_args_communication :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Store_args where- hashWithSalt salt record = salt `H.hashWithSalt` store_args_communication record -instance QC.Arbitrary Store_args where - arbitrary = M.liftM Store_args (QC.arbitrary)- shrink obj | obj == default_Store_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Store_args{store_args_communication = store_args_communication obj} then P.Nothing else P.Just $ default_Store_args{store_args_communication = store_args_communication obj}- ]-from_Store_args :: Store_args -> T.ThriftVal-from_Store_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v66 -> P.Just (1, ("communication",Communication_Types.from_Communication _v66))) $ store_args_communication record- ]-write_Store_args :: (T.Protocol p, T.Transport t) => p t -> Store_args -> P.IO ()-write_Store_args oprot record = T.writeVal oprot $ from_Store_args record-encode_Store_args :: (T.Protocol p, T.Transport t) => p t -> Store_args -> LBS.ByteString-encode_Store_args oprot record = T.serializeVal oprot $ from_Store_args record-to_Store_args :: T.ThriftVal -> Store_args-to_Store_args (T.TStruct fields) = Store_args{- store_args_communication = P.maybe (store_args_communication default_Store_args) (\(_,_val68) -> (case _val68 of {T.TStruct _val69 -> (Communication_Types.to_Communication (T.TStruct _val69)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Store_args _ = P.error "not a struct"-read_Store_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Store_args-read_Store_args iprot = to_Store_args <$> T.readVal iprot (T.T_STRUCT typemap_Store_args)-decode_Store_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Store_args-decode_Store_args iprot bs = to_Store_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Store_args) bs-typemap_Store_args :: T.TypeMap-typemap_Store_args = Map.fromList [(1,("communication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_Store_args :: Store_args-default_Store_args = Store_args{- store_args_communication = Communication_Types.default_Communication}-data Store_result = Store_result { store_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Store_result where- hashWithSalt salt record = salt `H.hashWithSalt` store_result_ex record -instance QC.Arbitrary Store_result where - arbitrary = M.liftM Store_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Store_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Store_result{store_result_ex = store_result_ex obj} then P.Nothing else P.Just $ default_Store_result{store_result_ex = store_result_ex obj}- ]-from_Store_result :: Store_result -> T.ThriftVal-from_Store_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v72 -> (1, ("ex",Services_Types.from_ServicesException _v72))) <$> store_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v72 -> (1, ("ex",Services_Types.from_ServicesException _v72))) <$> store_result_ex record- ]- )-write_Store_result :: (T.Protocol p, T.Transport t) => p t -> Store_result -> P.IO ()-write_Store_result oprot record = T.writeVal oprot $ from_Store_result record-encode_Store_result :: (T.Protocol p, T.Transport t) => p t -> Store_result -> LBS.ByteString-encode_Store_result oprot record = T.serializeVal oprot $ from_Store_result record-to_Store_result :: T.ThriftVal -> Store_result-to_Store_result (T.TStruct fields) = Store_result{- store_result_ex = P.maybe (P.Nothing) (\(_,_val74) -> P.Just (case _val74 of {T.TStruct _val75 -> (Services_Types.to_ServicesException (T.TStruct _val75)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Store_result _ = P.error "not a struct"-read_Store_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Store_result-read_Store_result iprot = to_Store_result <$> T.readVal iprot (T.T_STRUCT typemap_Store_result)-decode_Store_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Store_result-decode_Store_result iprot bs = to_Store_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Store_result) bs-typemap_Store_result :: T.TypeMap-typemap_Store_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Store_result :: Store_result-default_Store_result = Store_result{- store_result_ex = P.Nothing}-process_store (seqid, iprot, oprot, handler) = do- args <- read_Store_args iprot- (X.catch- (X.catch- (do- Iface.store handler (store_args_communication args)- let res = default_Store_result- T.writeMessageBegin oprot ("store", T.M_REPLY, seqid)- write_Store_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Store_result{store_result_ex = P.Just e}- T.writeMessageBegin oprot ("store", T.M_REPLY, seqid)- write_Store_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("store", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "store" -> process_store (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/StoreCommunicationService_Client.hs
@@ -1,65 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.StoreCommunicationService_Client(store) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types-import StoreCommunicationService-seqid = R.newIORef 0-store (ip,op) arg_communication = do- send_store op arg_communication- recv_store ip-send_store op arg_communication = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("store", T.M_CALL, seqn)- write_Store_args op (Store_args{store_args_communication=arg_communication})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_store ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Store_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (store_result_ex res)- P.return ()
− src/Data/Concrete/Services/StoreCommunicationService_Iface.hs
@@ -1,48 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.StoreCommunicationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types--import Service_Iface-class Service_Iface a => StoreCommunicationService_Iface a where- store :: a -> Communication_Types.Communication -> P.IO ()
− src/Data/Concrete/Services/SummarizationService.hs
@@ -1,243 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SummarizationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import qualified Service-import Summarization_Types-import qualified SummarizationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Summarize_args = Summarize_args { summarize_args_query :: SummarizationRequest- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Summarize_args where- hashWithSalt salt record = salt `H.hashWithSalt` summarize_args_query record -instance QC.Arbitrary Summarize_args where - arbitrary = M.liftM Summarize_args (QC.arbitrary)- shrink obj | obj == default_Summarize_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Summarize_args{summarize_args_query = summarize_args_query obj} then P.Nothing else P.Just $ default_Summarize_args{summarize_args_query = summarize_args_query obj}- ]-from_Summarize_args :: Summarize_args -> T.ThriftVal-from_Summarize_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v48 -> P.Just (1, ("query",from_SummarizationRequest _v48))) $ summarize_args_query record- ]-write_Summarize_args :: (T.Protocol p, T.Transport t) => p t -> Summarize_args -> P.IO ()-write_Summarize_args oprot record = T.writeVal oprot $ from_Summarize_args record-encode_Summarize_args :: (T.Protocol p, T.Transport t) => p t -> Summarize_args -> LBS.ByteString-encode_Summarize_args oprot record = T.serializeVal oprot $ from_Summarize_args record-to_Summarize_args :: T.ThriftVal -> Summarize_args-to_Summarize_args (T.TStruct fields) = Summarize_args{- summarize_args_query = P.maybe (summarize_args_query default_Summarize_args) (\(_,_val50) -> (case _val50 of {T.TStruct _val51 -> (to_SummarizationRequest (T.TStruct _val51)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Summarize_args _ = P.error "not a struct"-read_Summarize_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Summarize_args-read_Summarize_args iprot = to_Summarize_args <$> T.readVal iprot (T.T_STRUCT typemap_Summarize_args)-decode_Summarize_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Summarize_args-decode_Summarize_args iprot bs = to_Summarize_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Summarize_args) bs-typemap_Summarize_args :: T.TypeMap-typemap_Summarize_args = Map.fromList [(1,("query",(T.T_STRUCT typemap_SummarizationRequest)))]-default_Summarize_args :: Summarize_args-default_Summarize_args = Summarize_args{- summarize_args_query = default_SummarizationRequest}-data Summarize_result = Summarize_result { summarize_result_success :: Summary- , summarize_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Summarize_result where- hashWithSalt salt record = salt `H.hashWithSalt` summarize_result_success record `H.hashWithSalt` summarize_result_ex record -instance QC.Arbitrary Summarize_result where - arbitrary = M.liftM Summarize_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Summarize_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Summarize_result{summarize_result_success = summarize_result_success obj} then P.Nothing else P.Just $ default_Summarize_result{summarize_result_success = summarize_result_success obj}- , if obj == default_Summarize_result{summarize_result_ex = summarize_result_ex obj} then P.Nothing else P.Just $ default_Summarize_result{summarize_result_ex = summarize_result_ex obj}- ]-from_Summarize_result :: Summarize_result -> T.ThriftVal-from_Summarize_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v54 -> (1, ("ex",Services_Types.from_ServicesException _v54))) <$> summarize_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v54 -> P.Just (0, ("success",from_Summary _v54))) $ summarize_result_success record- , (\_v54 -> (1, ("ex",Services_Types.from_ServicesException _v54))) <$> summarize_result_ex record- ]- )-write_Summarize_result :: (T.Protocol p, T.Transport t) => p t -> Summarize_result -> P.IO ()-write_Summarize_result oprot record = T.writeVal oprot $ from_Summarize_result record-encode_Summarize_result :: (T.Protocol p, T.Transport t) => p t -> Summarize_result -> LBS.ByteString-encode_Summarize_result oprot record = T.serializeVal oprot $ from_Summarize_result record-to_Summarize_result :: T.ThriftVal -> Summarize_result-to_Summarize_result (T.TStruct fields) = Summarize_result{- summarize_result_success = P.maybe (summarize_result_success default_Summarize_result) (\(_,_val56) -> (case _val56 of {T.TStruct _val57 -> (to_Summary (T.TStruct _val57)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- summarize_result_ex = P.maybe (P.Nothing) (\(_,_val56) -> P.Just (case _val56 of {T.TStruct _val58 -> (Services_Types.to_ServicesException (T.TStruct _val58)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Summarize_result _ = P.error "not a struct"-read_Summarize_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Summarize_result-read_Summarize_result iprot = to_Summarize_result <$> T.readVal iprot (T.T_STRUCT typemap_Summarize_result)-decode_Summarize_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Summarize_result-decode_Summarize_result iprot bs = to_Summarize_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Summarize_result) bs-typemap_Summarize_result :: T.TypeMap-typemap_Summarize_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_Summary))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Summarize_result :: Summarize_result-default_Summarize_result = Summarize_result{- summarize_result_success = default_Summary,- summarize_result_ex = P.Nothing}-data GetCapabilities_args = GetCapabilities_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCapabilities_args where - arbitrary = QC.elements [GetCapabilities_args]-from_GetCapabilities_args :: GetCapabilities_args -> T.ThriftVal-from_GetCapabilities_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> P.IO ()-write_GetCapabilities_args oprot record = T.writeVal oprot $ from_GetCapabilities_args record-encode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> LBS.ByteString-encode_GetCapabilities_args oprot record = T.serializeVal oprot $ from_GetCapabilities_args record-to_GetCapabilities_args :: T.ThriftVal -> GetCapabilities_args-to_GetCapabilities_args (T.TStruct fields) = GetCapabilities_args{-- }-to_GetCapabilities_args _ = P.error "not a struct"-read_GetCapabilities_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_args-read_GetCapabilities_args iprot = to_GetCapabilities_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_args)-decode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_args-decode_GetCapabilities_args iprot bs = to_GetCapabilities_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_args) bs-typemap_GetCapabilities_args :: T.TypeMap-typemap_GetCapabilities_args = Map.fromList []-default_GetCapabilities_args :: GetCapabilities_args-default_GetCapabilities_args = GetCapabilities_args{-}-data GetCapabilities_result = GetCapabilities_result { getCapabilities_result_success :: (Vector.Vector SummarizationCapability)- , getCapabilities_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_result_success record `H.hashWithSalt` getCapabilities_result_ex record -instance QC.Arbitrary GetCapabilities_result where - arbitrary = M.liftM GetCapabilities_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCapabilities_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj}- , if obj == default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj}- ]-from_GetCapabilities_result :: GetCapabilities_result -> T.ThriftVal-from_GetCapabilities_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v66 -> (1, ("ex",Services_Types.from_ServicesException _v66))) <$> getCapabilities_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v66 -> P.Just (0, ("success",T.TList (T.T_STRUCT typemap_SummarizationCapability) $ P.map (\_v68 -> from_SummarizationCapability _v68) $ Vector.toList _v66))) $ getCapabilities_result_success record- , (\_v66 -> (1, ("ex",Services_Types.from_ServicesException _v66))) <$> getCapabilities_result_ex record- ]- )-write_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> P.IO ()-write_GetCapabilities_result oprot record = T.writeVal oprot $ from_GetCapabilities_result record-encode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> LBS.ByteString-encode_GetCapabilities_result oprot record = T.serializeVal oprot $ from_GetCapabilities_result record-to_GetCapabilities_result :: T.ThriftVal -> GetCapabilities_result-to_GetCapabilities_result (T.TStruct fields) = GetCapabilities_result{- getCapabilities_result_success = P.maybe (getCapabilities_result_success default_GetCapabilities_result) (\(_,_val70) -> (case _val70 of {T.TList _ _val71 -> (Vector.fromList $ P.map (\_v72 -> (case _v72 of {T.TStruct _val73 -> (to_SummarizationCapability (T.TStruct _val73)); _ -> P.error "wrong type"})) _val71); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCapabilities_result_ex = P.maybe (P.Nothing) (\(_,_val70) -> P.Just (case _val70 of {T.TStruct _val74 -> (Services_Types.to_ServicesException (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_result _ = P.error "not a struct"-read_GetCapabilities_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_result-read_GetCapabilities_result iprot = to_GetCapabilities_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_result)-decode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_result-decode_GetCapabilities_result iprot bs = to_GetCapabilities_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_result) bs-typemap_GetCapabilities_result :: T.TypeMap-typemap_GetCapabilities_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT typemap_SummarizationCapability)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCapabilities_result :: GetCapabilities_result-default_GetCapabilities_result = GetCapabilities_result{- getCapabilities_result_success = Vector.empty,- getCapabilities_result_ex = P.Nothing}-process_summarize (seqid, iprot, oprot, handler) = do- args <- read_Summarize_args iprot- (X.catch- (X.catch- (do- val <- Iface.summarize handler (summarize_args_query args)- let res = default_Summarize_result{summarize_result_success = val}- T.writeMessageBegin oprot ("summarize", T.M_REPLY, seqid)- write_Summarize_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Summarize_result{summarize_result_ex = P.Just e}- T.writeMessageBegin oprot ("summarize", T.M_REPLY, seqid)- write_Summarize_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("summarize", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCapabilities (seqid, iprot, oprot, handler) = do- args <- read_GetCapabilities_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCapabilities handler- let res = default_GetCapabilities_result{getCapabilities_result_success = val}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCapabilities_result{getCapabilities_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCapabilities", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "summarize" -> process_summarize (seqid,iprot,oprot,handler)- "getCapabilities" -> process_getCapabilities (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Data/Concrete/Services/SummarizationService_Client.hs
@@ -1,84 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SummarizationService_Client(summarize,getCapabilities) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import Summarization_Types-import SummarizationService-seqid = R.newIORef 0-summarize (ip,op) arg_query = do- send_summarize op arg_query- recv_summarize ip-send_summarize op arg_query = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("summarize", T.M_CALL, seqn)- write_Summarize_args op (Summarize_args{summarize_args_query=arg_query})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_summarize ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Summarize_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (summarize_result_ex res)- P.return $ summarize_result_success res-getCapabilities (ip,op) = do- send_getCapabilities op- recv_getCapabilities ip-send_getCapabilities op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCapabilities", T.M_CALL, seqn)- write_GetCapabilities_args op (GetCapabilities_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCapabilities ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCapabilities_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCapabilities_result_ex res)- P.return $ getCapabilities_result_success res
− src/Data/Concrete/Services/SummarizationService_Iface.hs
@@ -1,51 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Data.Concrete.Services.SummarizationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import Summarization_Types--import Service_Iface-class Service_Iface a => SummarizationService_Iface a where- summarize :: a -> SummarizationRequest -> P.IO Summary- getCapabilities :: a -> P.IO (Vector.Vector SummarizationCapability)
− src/Data/Concrete/Types.hs
@@ -1,33 +0,0 @@-{-# LANGUAGE DeriveGeneric, OverloadedStrings #-}-module Data.Concrete.Types- ( --ProtoSection(..)- --, ProtoCommunication- ) where--import Data.Text.Lazy (Text)-import Data.Concrete (Communication)----- data ProtoSection = ProtoSection { start :: Int--- , end :: Int--- , label :: String--- , kind :: String--- }- --- type ProtoCommunication = (Text, [ProtoSection])---- type CommunicationStorer = [Communication] -> IO ()---- -- | A 'Bookkeeper' tracks information about an ongoing attempt--- -- to parse a Text stream into Communication objects.--- data Bookkeeper = Bookkeeper { valueMap :: Map String String -- | An arbitrary string-to-string map--- , comms :: [Communication] -- | List of Communications that have been parsed so far--- , sections :: [Section] -- | List of Sections accumulated for the Communication currently being parsed--- }---- -- | A 'CommunicationParser' is a stateful Megaparsec parser that, as it--- -- processes a Text stream, builds a list of Concrete Communications.--- type CommunicationParser a = ParsecT Dec Text (State Bookkeeper) a----- --type CommParser ParsecT Dec Text (S.State Bookkeeping) ()
src/Data/Concrete/Utils.hs view
@@ -1,47 +1,56 @@-{-# LANGUAGE DeriveGeneric, OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric, OverloadedStrings, FlexibleInstances #-} module Data.Concrete.Utils ( getUUID , createAnnotationMetadata- , readCommunicationsFromBytes- , readCommunicationsFromTar- , readCommunicationsFromZip- , writeCommunications , writeCommunication- , writeCommunicationToZip , showCommunication- , sendCommunication- , connectToService+ , commToString+ , incrementUUID+ , stringToComm ) where import GHC.Generics-import qualified Data.Concrete as C import Path.IO (resolveFile')-import Data.Concrete (Communication(..), Section(..), UUID(..), default_Communication, read_Communication)---import Data.Concrete (StoreCommunicationService_Client)+import Data.Concrete.Autogen.Communication_Types (Communication(..), default_Communication, read_Communication, write_Communication)+import Data.Concrete.Autogen.Structure_Types (Section(..))+import Data.Concrete.Autogen.Uuid_Types (UUID(..))+import Data.Concrete.Autogen.Metadata_Types (AnnotationMetadata(..), default_AnnotationMetadata)+import Data.Concrete.Autogen.Spans_Types (TextSpan(..))+import Data.Concrete.Autogen.Service_Iface (Service_Iface(about, alive))+import Data.Concrete.Autogen.Services_Types (ServiceInfo(..))+import Data.Concrete.Autogen.Access_Types (FetchResult(..), default_FetchResult)+import Data.Concrete.Autogen.StoreCommunicationService_Iface (StoreCommunicationService_Iface(store))+import Data.Concrete.Autogen.FetchCommunicationService_Iface (FetchCommunicationService_Iface(fetch))+import qualified Data.Concrete.Autogen.StoreCommunicationService as StoreCommunicationService import Data.Text+import Data.Either (rights) import Data.Maybe (fromJust, maybeToList, fromMaybe) import Data.ByteString.Lazy import Data.Map import Data.UUID.V4 (nextRandom)-import Data.UUID (toString)+import Data.UUID (toString, toWords, fromWords, fromString, nil)+import qualified Data.UUID as U import qualified Data.Text.Lazy as T import Thrift-import Thrift.Transport.Handle+import Thrift.Transport.Handle hiding (HandleSource) import Thrift.Transport.Framed import Thrift.Transport.Empty import Thrift.Protocol.Compact import Thrift.Protocol import Thrift.Transport.IOBuffer import Thrift.Transport+import Thrift.Server (runThreadedServer) import qualified Data.List as L import qualified Data.Map as Map+import qualified Data.ByteString as BSS import qualified Data.ByteString.Lazy as BS import qualified Codec.Compression.GZip as GZip import qualified Codec.Compression.BZip as BZip import qualified Codec.Archive.Tar as Tar import qualified Codec.Archive.Zip as Zip import qualified Codec.Archive.Tar.Entry as Tar+import qualified Codec.Archive.Tar.Index as Tar import Data.Time import Data.Time.Clock.POSIX import System.FilePath (takeFileName, (</>), (<.>))@@ -50,75 +59,23 @@ import Data.Foldable (foldr) import System.IO (Handle) import qualified Data.Vector as V-import qualified Network as Net-+import qualified Data.Binary.Get as G+import qualified Control.Monad.Extra as E+ getUUID :: IO UUID getUUID = do uuid <- (T.pack . toString) <$> nextRandom return $ UUID uuid -readCommunicationsFromTar :: ByteString -> IO [Communication]-readCommunicationsFromTar bs = do- let es = Tar.read bs- cs = Tar.foldEntries (\e x -> (Tar.entryContent e):x) [] (\e -> []) es- sequence $ L.map (\ (Tar.NormalFile bs _) -> stringToComm bs) cs--writeCommunicationsToTar :: [Communication] -> ByteString-writeCommunicationsToTar cs = error "unimplemented"--readCommunicationsFromZip :: String -> IO [Communication]-readCommunicationsFromZip f = do- f' <- resolveFile' f- es <- Zip.withArchive f' ((Map.keys <$> Zip.getEntries))- bss <- Zip.withArchive f' ((sequence . (L.map Zip.getEntry)) es)- sequence $ L.map (stringToComm . fromStrict) bss- -writeCommunicationsToZip :: String -> [Communication] -> IO ()-writeCommunicationsToZip f cs = return ()--writeCommunicationToZip :: String -> [Communication] -> IO ()-writeCommunicationToZip f cs = return ()--writeCommunications :: Handle -> [Communication] -> IO ()-writeCommunications out cs = do- let tarPath = "comms"- texts <- sequence [commToString c | c <- cs]- let names = rights [Tar.toTarPath False (tarPath </> ((T.unpack . C.communication_id) c) <.> "comm") | c <- cs]- entries = [Tar.fileEntry n t|(n, t) <- L.zip names texts]- t = Tar.write entries- (BS.hPutStr out . GZip.compress) t+incrementUUID :: UUID -> UUID+incrementUUID (UUID u) = case toWords (fromMaybe nil $ fromString (T.unpack u)) of+ (a, b, c, d) -> UUID $ (T.pack . toString) (fromWords a b c (d + 1)) writeCommunication :: Handle -> Communication -> IO () writeCommunication out c = do t <- commToString c BS.hPutStr out t- -- -connectToService :: String -> Int -> IO (CompactProtocol (FramedTransport Handle), CompactProtocol (FramedTransport Handle))-connectToService h p = do- transport <- hOpen (h, Net.PortNumber $ fromIntegral p)- transport' <- openFramedTransport transport- let protocol = CompactProtocol transport'- return (protocol, protocol) -sendCommunication :: String -> Int -> Communication -> IO ()-sendCommunication h p c = do - return ()--readCommunicationsFromBytes :: BS.ByteString -> IO [Communication]-readCommunicationsFromBytes t = do- transport <- newTString- fillBuf (getRead transport) t- let iproto = CompactProtocol transport- readCommunications iproto []- where- readCommunications pr cs = do- o <- tIsOpen $ getTransport pr - case o of- True -> do- c <- read_Communication pr- readCommunications pr $ c:cs- False -> return cs- entryToString :: Tar.EntryContent -> BS.ByteString entryToString (Tar.NormalFile s _) = s @@ -152,7 +109,7 @@ commToString c = do otransport <- newTString let oproto = CompactProtocol otransport- C.write_Communication oproto c+ write_Communication oproto c flushBuf (getWrite otransport) stringToComm :: BS.ByteString -> IO Communication@@ -160,25 +117,20 @@ otransport@(TString r w) <- newTString fillBuf r s let oproto = CompactProtocol otransport- C.read_Communication oproto--dropTarSuffix :: String -> String-dropTarSuffix f = (L.reverse . L.drop n . L.reverse) f- where- n = if ".tgz" `L.isSuffixOf` f then 4 else if ".tar.gz" `L.isSuffixOf` f then 7 else 0+ read_Communication oproto -createAnnotationMetadata :: String -> IO C.AnnotationMetadata+createAnnotationMetadata :: String -> IO AnnotationMetadata createAnnotationMetadata s = do time <- round `fmap` getPOSIXTime- return C.default_AnnotationMetadata { C.annotationMetadata_tool=T.pack s- , C.annotationMetadata_timestamp=time- }+ return default_AnnotationMetadata { annotationMetadata_tool=T.pack s+ , annotationMetadata_timestamp=time+ } -showSection :: T.Text -> C.Section -> T.Text-showSection t s = T.concat [" ", ((fromMaybe "*NO LABEL*" . C.section_label) s), " == ", t']+showSection :: T.Text -> Section -> T.Text+showSection t s = T.concat [" ", ((fromMaybe "*NO LABEL*" . section_label) s), " == ", t'] where- C.TextSpan s' e' = (fromJust . C.section_textSpan) s- k = C.section_kind s+ TextSpan s' e' = (fromJust . section_textSpan) s+ k = section_kind s t' = substr t (fromIntegral s') (fromIntegral e') substr :: T.Text -> Int -> Int -> T.Text@@ -188,10 +140,11 @@ res = T.take (fromIntegral $ e - s) start showCommunication :: Communication -> T.Text-showCommunication c = T.concat [C.communication_id c, " ", C.communication_type c, "\n Content sections:", "\n", T.intercalate "\n" contentSects, "\n Metadata sections: ", metadataText, "\n"]+showCommunication c = T.concat [communication_id c, " ", communication_type c, "\n Content sections:\n", T.intercalate "\n" contentSects, "\n ", metadataText] where- ss = L.concat $ L.map V.toList (maybeToList (C.communication_sectionList c))- t = (fromJust . C.communication_text) c+ ss = L.concat $ L.map V.toList (maybeToList (communication_sectionList c))+ t = (fromJust . communication_text) c contentSects = L.map (showSection t) ((L.filter (\x -> section_kind x == "content")) ss)- metadataSects = L.map (fromMaybe "?" . C.section_label) ((L.filter (\x -> section_kind x /= "content")) ss)- metadataText = T.intercalate ", " metadataSects+ metadataSects = L.map (fromMaybe "?" . section_label) ((L.filter (\x -> section_kind x /= "content")) ss)+ --metadataText = T.intercalate ", " metadataSects+ metadataText = T.concat [(T.pack . show) (L.length metadataSects), " metadata sections"]
− src/Email_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Email_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Email_Types
− src/Email_Types.hs
@@ -1,200 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Email_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data EmailAddress = EmailAddress { emailAddress_address :: P.Maybe LT.Text- , emailAddress_displayName :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable EmailAddress where- hashWithSalt salt record = salt `H.hashWithSalt` emailAddress_address record `H.hashWithSalt` emailAddress_displayName record -instance QC.Arbitrary EmailAddress where - arbitrary = M.liftM EmailAddress (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_EmailAddress = []- | P.otherwise = M.catMaybes- [ if obj == default_EmailAddress{emailAddress_address = emailAddress_address obj} then P.Nothing else P.Just $ default_EmailAddress{emailAddress_address = emailAddress_address obj}- , if obj == default_EmailAddress{emailAddress_displayName = emailAddress_displayName obj} then P.Nothing else P.Just $ default_EmailAddress{emailAddress_displayName = emailAddress_displayName obj}- ]-from_EmailAddress :: EmailAddress -> T.ThriftVal-from_EmailAddress record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("address",T.TString $ E.encodeUtf8 _v2))) <$> emailAddress_address record- , (\_v2 -> (2, ("displayName",T.TString $ E.encodeUtf8 _v2))) <$> emailAddress_displayName record- ]-write_EmailAddress :: (T.Protocol p, T.Transport t) => p t -> EmailAddress -> P.IO ()-write_EmailAddress oprot record = T.writeVal oprot $ from_EmailAddress record-encode_EmailAddress :: (T.Protocol p, T.Transport t) => p t -> EmailAddress -> LBS.ByteString-encode_EmailAddress oprot record = T.serializeVal oprot $ from_EmailAddress record-to_EmailAddress :: T.ThriftVal -> EmailAddress-to_EmailAddress (T.TStruct fields) = EmailAddress{- emailAddress_address = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val5 -> E.decodeUtf8 _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- emailAddress_displayName = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val6 -> E.decodeUtf8 _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_EmailAddress _ = P.error "not a struct"-read_EmailAddress :: (T.Transport t, T.Protocol p) => p t -> P.IO EmailAddress-read_EmailAddress iprot = to_EmailAddress <$> T.readVal iprot (T.T_STRUCT typemap_EmailAddress)-decode_EmailAddress :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> EmailAddress-decode_EmailAddress iprot bs = to_EmailAddress $ T.deserializeVal iprot (T.T_STRUCT typemap_EmailAddress) bs-typemap_EmailAddress :: T.TypeMap-typemap_EmailAddress = Map.fromList [(1,("address",T.T_STRING)),(2,("displayName",T.T_STRING))]-default_EmailAddress :: EmailAddress-default_EmailAddress = EmailAddress{- emailAddress_address = P.Nothing,- emailAddress_displayName = P.Nothing}-data EmailCommunicationInfo = EmailCommunicationInfo { emailCommunicationInfo_messageId :: P.Maybe LT.Text- , emailCommunicationInfo_contentType :: P.Maybe LT.Text- , emailCommunicationInfo_userAgent :: P.Maybe LT.Text- , emailCommunicationInfo_inReplyToList :: P.Maybe (Vector.Vector LT.Text)- , emailCommunicationInfo_referenceList :: P.Maybe (Vector.Vector LT.Text)- , emailCommunicationInfo_senderAddress :: P.Maybe EmailAddress- , emailCommunicationInfo_returnPathAddress :: P.Maybe EmailAddress- , emailCommunicationInfo_toAddressList :: P.Maybe (Vector.Vector EmailAddress)- , emailCommunicationInfo_ccAddressList :: P.Maybe (Vector.Vector EmailAddress)- , emailCommunicationInfo_bccAddressList :: P.Maybe (Vector.Vector EmailAddress)- , emailCommunicationInfo_emailFolder :: P.Maybe LT.Text- , emailCommunicationInfo_subject :: P.Maybe LT.Text- , emailCommunicationInfo_quotedAddresses :: P.Maybe (Vector.Vector LT.Text)- , emailCommunicationInfo_attachmentPaths :: P.Maybe (Vector.Vector LT.Text)- , emailCommunicationInfo_salutation :: P.Maybe LT.Text- , emailCommunicationInfo_signature :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable EmailCommunicationInfo where- hashWithSalt salt record = salt `H.hashWithSalt` emailCommunicationInfo_messageId record `H.hashWithSalt` emailCommunicationInfo_contentType record `H.hashWithSalt` emailCommunicationInfo_userAgent record `H.hashWithSalt` emailCommunicationInfo_inReplyToList record `H.hashWithSalt` emailCommunicationInfo_referenceList record `H.hashWithSalt` emailCommunicationInfo_senderAddress record `H.hashWithSalt` emailCommunicationInfo_returnPathAddress record `H.hashWithSalt` emailCommunicationInfo_toAddressList record `H.hashWithSalt` emailCommunicationInfo_ccAddressList record `H.hashWithSalt` emailCommunicationInfo_bccAddressList record `H.hashWithSalt` emailCommunicationInfo_emailFolder record `H.hashWithSalt` emailCommunicationInfo_subject record `H.hashWithSalt` emailCommunicationInfo_quotedAddresses record `H.hashWithSalt` emailCommunicationInfo_attachmentPaths record `H.hashWithSalt` emailCommunicationInfo_salutation record `H.hashWithSalt` emailCommunicationInfo_signature record -instance QC.Arbitrary EmailCommunicationInfo where - arbitrary = M.liftM EmailCommunicationInfo (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_EmailCommunicationInfo = []- | P.otherwise = M.catMaybes- [ if obj == default_EmailCommunicationInfo{emailCommunicationInfo_messageId = emailCommunicationInfo_messageId obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_messageId = emailCommunicationInfo_messageId obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_contentType = emailCommunicationInfo_contentType obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_contentType = emailCommunicationInfo_contentType obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_userAgent = emailCommunicationInfo_userAgent obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_userAgent = emailCommunicationInfo_userAgent obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_inReplyToList = emailCommunicationInfo_inReplyToList obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_inReplyToList = emailCommunicationInfo_inReplyToList obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_referenceList = emailCommunicationInfo_referenceList obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_referenceList = emailCommunicationInfo_referenceList obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_senderAddress = emailCommunicationInfo_senderAddress obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_senderAddress = emailCommunicationInfo_senderAddress obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_returnPathAddress = emailCommunicationInfo_returnPathAddress obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_returnPathAddress = emailCommunicationInfo_returnPathAddress obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_toAddressList = emailCommunicationInfo_toAddressList obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_toAddressList = emailCommunicationInfo_toAddressList obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_ccAddressList = emailCommunicationInfo_ccAddressList obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_ccAddressList = emailCommunicationInfo_ccAddressList obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_bccAddressList = emailCommunicationInfo_bccAddressList obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_bccAddressList = emailCommunicationInfo_bccAddressList obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_emailFolder = emailCommunicationInfo_emailFolder obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_emailFolder = emailCommunicationInfo_emailFolder obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_subject = emailCommunicationInfo_subject obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_subject = emailCommunicationInfo_subject obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_quotedAddresses = emailCommunicationInfo_quotedAddresses obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_quotedAddresses = emailCommunicationInfo_quotedAddresses obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_attachmentPaths = emailCommunicationInfo_attachmentPaths obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_attachmentPaths = emailCommunicationInfo_attachmentPaths obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_salutation = emailCommunicationInfo_salutation obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_salutation = emailCommunicationInfo_salutation obj}- , if obj == default_EmailCommunicationInfo{emailCommunicationInfo_signature = emailCommunicationInfo_signature obj} then P.Nothing else P.Just $ default_EmailCommunicationInfo{emailCommunicationInfo_signature = emailCommunicationInfo_signature obj}- ]-from_EmailCommunicationInfo :: EmailCommunicationInfo -> T.ThriftVal-from_EmailCommunicationInfo record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v9 -> (1, ("messageId",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_messageId record- , (\_v9 -> (2, ("contentType",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_contentType record- , (\_v9 -> (3, ("userAgent",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_userAgent record- , (\_v9 -> (4, ("inReplyToList",T.TList T.T_STRING $ P.map (\_v11 -> T.TString $ E.encodeUtf8 _v11) $ Vector.toList _v9))) <$> emailCommunicationInfo_inReplyToList record- , (\_v9 -> (5, ("referenceList",T.TList T.T_STRING $ P.map (\_v13 -> T.TString $ E.encodeUtf8 _v13) $ Vector.toList _v9))) <$> emailCommunicationInfo_referenceList record- , (\_v9 -> (6, ("senderAddress",from_EmailAddress _v9))) <$> emailCommunicationInfo_senderAddress record- , (\_v9 -> (7, ("returnPathAddress",from_EmailAddress _v9))) <$> emailCommunicationInfo_returnPathAddress record- , (\_v9 -> (8, ("toAddressList",T.TList (T.T_STRUCT typemap_EmailAddress) $ P.map (\_v15 -> from_EmailAddress _v15) $ Vector.toList _v9))) <$> emailCommunicationInfo_toAddressList record- , (\_v9 -> (9, ("ccAddressList",T.TList (T.T_STRUCT typemap_EmailAddress) $ P.map (\_v17 -> from_EmailAddress _v17) $ Vector.toList _v9))) <$> emailCommunicationInfo_ccAddressList record- , (\_v9 -> (10, ("bccAddressList",T.TList (T.T_STRUCT typemap_EmailAddress) $ P.map (\_v19 -> from_EmailAddress _v19) $ Vector.toList _v9))) <$> emailCommunicationInfo_bccAddressList record- , (\_v9 -> (11, ("emailFolder",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_emailFolder record- , (\_v9 -> (12, ("subject",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_subject record- , (\_v9 -> (13, ("quotedAddresses",T.TList T.T_STRING $ P.map (\_v21 -> T.TString $ E.encodeUtf8 _v21) $ Vector.toList _v9))) <$> emailCommunicationInfo_quotedAddresses record- , (\_v9 -> (14, ("attachmentPaths",T.TList T.T_STRING $ P.map (\_v23 -> T.TString $ E.encodeUtf8 _v23) $ Vector.toList _v9))) <$> emailCommunicationInfo_attachmentPaths record- , (\_v9 -> (15, ("salutation",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_salutation record- , (\_v9 -> (16, ("signature",T.TString $ E.encodeUtf8 _v9))) <$> emailCommunicationInfo_signature record- ]-write_EmailCommunicationInfo :: (T.Protocol p, T.Transport t) => p t -> EmailCommunicationInfo -> P.IO ()-write_EmailCommunicationInfo oprot record = T.writeVal oprot $ from_EmailCommunicationInfo record-encode_EmailCommunicationInfo :: (T.Protocol p, T.Transport t) => p t -> EmailCommunicationInfo -> LBS.ByteString-encode_EmailCommunicationInfo oprot record = T.serializeVal oprot $ from_EmailCommunicationInfo record-to_EmailCommunicationInfo :: T.ThriftVal -> EmailCommunicationInfo-to_EmailCommunicationInfo (T.TStruct fields) = EmailCommunicationInfo{- emailCommunicationInfo_messageId = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val26 -> E.decodeUtf8 _val26; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- emailCommunicationInfo_contentType = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val27 -> E.decodeUtf8 _val27; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- emailCommunicationInfo_userAgent = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val28 -> E.decodeUtf8 _val28; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- emailCommunicationInfo_inReplyToList = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val29 -> (Vector.fromList $ P.map (\_v30 -> (case _v30 of {T.TString _val31 -> E.decodeUtf8 _val31; _ -> P.error "wrong type"})) _val29); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- emailCommunicationInfo_referenceList = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val32 -> (Vector.fromList $ P.map (\_v33 -> (case _v33 of {T.TString _val34 -> E.decodeUtf8 _val34; _ -> P.error "wrong type"})) _val32); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- emailCommunicationInfo_senderAddress = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TStruct _val35 -> (to_EmailAddress (T.TStruct _val35)); _ -> P.error "wrong type"})) (Map.lookup (6) fields),- emailCommunicationInfo_returnPathAddress = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TStruct _val36 -> (to_EmailAddress (T.TStruct _val36)); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- emailCommunicationInfo_toAddressList = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val37 -> (Vector.fromList $ P.map (\_v38 -> (case _v38 of {T.TStruct _val39 -> (to_EmailAddress (T.TStruct _val39)); _ -> P.error "wrong type"})) _val37); _ -> P.error "wrong type"})) (Map.lookup (8) fields),- emailCommunicationInfo_ccAddressList = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val40 -> (Vector.fromList $ P.map (\_v41 -> (case _v41 of {T.TStruct _val42 -> (to_EmailAddress (T.TStruct _val42)); _ -> P.error "wrong type"})) _val40); _ -> P.error "wrong type"})) (Map.lookup (9) fields),- emailCommunicationInfo_bccAddressList = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val43 -> (Vector.fromList $ P.map (\_v44 -> (case _v44 of {T.TStruct _val45 -> (to_EmailAddress (T.TStruct _val45)); _ -> P.error "wrong type"})) _val43); _ -> P.error "wrong type"})) (Map.lookup (10) fields),- emailCommunicationInfo_emailFolder = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val46 -> E.decodeUtf8 _val46; _ -> P.error "wrong type"})) (Map.lookup (11) fields),- emailCommunicationInfo_subject = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val47 -> E.decodeUtf8 _val47; _ -> P.error "wrong type"})) (Map.lookup (12) fields),- emailCommunicationInfo_quotedAddresses = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val48 -> (Vector.fromList $ P.map (\_v49 -> (case _v49 of {T.TString _val50 -> E.decodeUtf8 _val50; _ -> P.error "wrong type"})) _val48); _ -> P.error "wrong type"})) (Map.lookup (13) fields),- emailCommunicationInfo_attachmentPaths = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val51 -> (Vector.fromList $ P.map (\_v52 -> (case _v52 of {T.TString _val53 -> E.decodeUtf8 _val53; _ -> P.error "wrong type"})) _val51); _ -> P.error "wrong type"})) (Map.lookup (14) fields),- emailCommunicationInfo_salutation = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val54 -> E.decodeUtf8 _val54; _ -> P.error "wrong type"})) (Map.lookup (15) fields),- emailCommunicationInfo_signature = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TString _val55 -> E.decodeUtf8 _val55; _ -> P.error "wrong type"})) (Map.lookup (16) fields)- }-to_EmailCommunicationInfo _ = P.error "not a struct"-read_EmailCommunicationInfo :: (T.Transport t, T.Protocol p) => p t -> P.IO EmailCommunicationInfo-read_EmailCommunicationInfo iprot = to_EmailCommunicationInfo <$> T.readVal iprot (T.T_STRUCT typemap_EmailCommunicationInfo)-decode_EmailCommunicationInfo :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> EmailCommunicationInfo-decode_EmailCommunicationInfo iprot bs = to_EmailCommunicationInfo $ T.deserializeVal iprot (T.T_STRUCT typemap_EmailCommunicationInfo) bs-typemap_EmailCommunicationInfo :: T.TypeMap-typemap_EmailCommunicationInfo = Map.fromList [(1,("messageId",T.T_STRING)),(2,("contentType",T.T_STRING)),(3,("userAgent",T.T_STRING)),(4,("inReplyToList",(T.T_LIST T.T_STRING))),(5,("referenceList",(T.T_LIST T.T_STRING))),(6,("senderAddress",(T.T_STRUCT typemap_EmailAddress))),(7,("returnPathAddress",(T.T_STRUCT typemap_EmailAddress))),(8,("toAddressList",(T.T_LIST (T.T_STRUCT typemap_EmailAddress)))),(9,("ccAddressList",(T.T_LIST (T.T_STRUCT typemap_EmailAddress)))),(10,("bccAddressList",(T.T_LIST (T.T_STRUCT typemap_EmailAddress)))),(11,("emailFolder",T.T_STRING)),(12,("subject",T.T_STRING)),(13,("quotedAddresses",(T.T_LIST T.T_STRING))),(14,("attachmentPaths",(T.T_LIST T.T_STRING))),(15,("salutation",T.T_STRING)),(16,("signature",T.T_STRING))]-default_EmailCommunicationInfo :: EmailCommunicationInfo-default_EmailCommunicationInfo = EmailCommunicationInfo{- emailCommunicationInfo_messageId = P.Nothing,- emailCommunicationInfo_contentType = P.Nothing,- emailCommunicationInfo_userAgent = P.Nothing,- emailCommunicationInfo_inReplyToList = P.Nothing,- emailCommunicationInfo_referenceList = P.Nothing,- emailCommunicationInfo_senderAddress = P.Nothing,- emailCommunicationInfo_returnPathAddress = P.Nothing,- emailCommunicationInfo_toAddressList = P.Nothing,- emailCommunicationInfo_ccAddressList = P.Nothing,- emailCommunicationInfo_bccAddressList = P.Nothing,- emailCommunicationInfo_emailFolder = P.Nothing,- emailCommunicationInfo_subject = P.Nothing,- emailCommunicationInfo_quotedAddresses = P.Nothing,- emailCommunicationInfo_attachmentPaths = P.Nothing,- emailCommunicationInfo_salutation = P.Nothing,- emailCommunicationInfo_signature = P.Nothing}
− src/Entities_Consts.hs
@@ -1,46 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Entities_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Structure_Types-import qualified Metadata_Types-import qualified Uuid_Types-import qualified Linking_Types---import Entities_Types
− src/Entities_Types.hs
@@ -1,287 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Entities_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Structure_Types-import qualified Metadata_Types-import qualified Uuid_Types-import qualified Linking_Types---data Entity = Entity { entity_uuid :: Uuid_Types.UUID- , entity_id :: P.Maybe LT.Text- , entity_mentionIdList :: (Vector.Vector Uuid_Types.UUID)- , entity_rawMentionList :: P.Maybe (Vector.Vector Structure_Types.TokenRefSequence)- , entity_type :: P.Maybe LT.Text- , entity_confidence :: P.Maybe P.Double- , entity_canonicalName :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Entity where- hashWithSalt salt record = salt `H.hashWithSalt` entity_uuid record `H.hashWithSalt` entity_id record `H.hashWithSalt` entity_mentionIdList record `H.hashWithSalt` entity_rawMentionList record `H.hashWithSalt` entity_type record `H.hashWithSalt` entity_confidence record `H.hashWithSalt` entity_canonicalName record -instance QC.Arbitrary Entity where - arbitrary = M.liftM Entity (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Entity = []- | P.otherwise = M.catMaybes- [ if obj == default_Entity{entity_uuid = entity_uuid obj} then P.Nothing else P.Just $ default_Entity{entity_uuid = entity_uuid obj}- , if obj == default_Entity{entity_id = entity_id obj} then P.Nothing else P.Just $ default_Entity{entity_id = entity_id obj}- , if obj == default_Entity{entity_mentionIdList = entity_mentionIdList obj} then P.Nothing else P.Just $ default_Entity{entity_mentionIdList = entity_mentionIdList obj}- , if obj == default_Entity{entity_rawMentionList = entity_rawMentionList obj} then P.Nothing else P.Just $ default_Entity{entity_rawMentionList = entity_rawMentionList obj}- , if obj == default_Entity{entity_type = entity_type obj} then P.Nothing else P.Just $ default_Entity{entity_type = entity_type obj}- , if obj == default_Entity{entity_confidence = entity_confidence obj} then P.Nothing else P.Just $ default_Entity{entity_confidence = entity_confidence obj}- , if obj == default_Entity{entity_canonicalName = entity_canonicalName obj} then P.Nothing else P.Just $ default_Entity{entity_canonicalName = entity_canonicalName obj}- ]-from_Entity :: Entity -> T.ThriftVal-from_Entity record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v2))) $ entity_uuid record- , (\_v2 -> P.Just (2, ("mentionIdList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v4 -> Uuid_Types.from_UUID _v4) $ Vector.toList _v2))) $ entity_mentionIdList record- , (\_v2 -> (3, ("type",T.TString $ E.encodeUtf8 _v2))) <$> entity_type record- , (\_v2 -> (4, ("confidence",T.TDouble _v2))) <$> entity_confidence record- , (\_v2 -> (5, ("canonicalName",T.TString $ E.encodeUtf8 _v2))) <$> entity_canonicalName record- , (\_v2 -> (6, ("id",T.TString $ E.encodeUtf8 _v2))) <$> entity_id record- , (\_v2 -> (7, ("rawMentionList",T.TList (T.T_STRUCT Structure_Types.typemap_TokenRefSequence) $ P.map (\_v6 -> Structure_Types.from_TokenRefSequence _v6) $ Vector.toList _v2))) <$> entity_rawMentionList record- ]-write_Entity :: (T.Protocol p, T.Transport t) => p t -> Entity -> P.IO ()-write_Entity oprot record = T.writeVal oprot $ from_Entity record-encode_Entity :: (T.Protocol p, T.Transport t) => p t -> Entity -> LBS.ByteString-encode_Entity oprot record = T.serializeVal oprot $ from_Entity record-to_Entity :: T.ThriftVal -> Entity-to_Entity (T.TStruct fields) = Entity{- entity_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val8) -> (case _val8 of {T.TStruct _val9 -> (Uuid_Types.to_UUID (T.TStruct _val9)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- entity_id = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TString _val10 -> E.decodeUtf8 _val10; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- entity_mentionIdList = P.maybe (P.error "Missing required field: mentionIdList") (\(_,_val8) -> (case _val8 of {T.TList _ _val11 -> (Vector.fromList $ P.map (\_v12 -> (case _v12 of {T.TStruct _val13 -> (Uuid_Types.to_UUID (T.TStruct _val13)); _ -> P.error "wrong type"})) _val11); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- entity_rawMentionList = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TList _ _val14 -> (Vector.fromList $ P.map (\_v15 -> (case _v15 of {T.TStruct _val16 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val16)); _ -> P.error "wrong type"})) _val14); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- entity_type = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TString _val17 -> E.decodeUtf8 _val17; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- entity_confidence = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TDouble _val18 -> _val18; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- entity_canonicalName = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TString _val19 -> E.decodeUtf8 _val19; _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_Entity _ = P.error "not a struct"-read_Entity :: (T.Transport t, T.Protocol p) => p t -> P.IO Entity-read_Entity iprot = to_Entity <$> T.readVal iprot (T.T_STRUCT typemap_Entity)-decode_Entity :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Entity-decode_Entity iprot bs = to_Entity $ T.deserializeVal iprot (T.T_STRUCT typemap_Entity) bs-typemap_Entity :: T.TypeMap-typemap_Entity = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("mentionIdList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(3,("type",T.T_STRING)),(4,("confidence",T.T_DOUBLE)),(5,("canonicalName",T.T_STRING)),(6,("id",T.T_STRING)),(7,("rawMentionList",(T.T_LIST (T.T_STRUCT Structure_Types.typemap_TokenRefSequence))))]-default_Entity :: Entity-default_Entity = Entity{- entity_uuid = Uuid_Types.default_UUID,- entity_mentionIdList = Vector.empty,- entity_type = P.Nothing,- entity_confidence = P.Nothing,- entity_canonicalName = P.Nothing,- entity_id = P.Nothing,- entity_rawMentionList = P.Nothing}-data EntitySet = EntitySet { entitySet_uuid :: Uuid_Types.UUID- , entitySet_metadata :: Metadata_Types.AnnotationMetadata- , entitySet_entityList :: (Vector.Vector Entity)- , entitySet_linkingList :: P.Maybe (Vector.Vector Linking_Types.Linking)- , entitySet_mentionSetId :: P.Maybe Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable EntitySet where- hashWithSalt salt record = salt `H.hashWithSalt` entitySet_uuid record `H.hashWithSalt` entitySet_metadata record `H.hashWithSalt` entitySet_entityList record `H.hashWithSalt` entitySet_linkingList record `H.hashWithSalt` entitySet_mentionSetId record -instance QC.Arbitrary EntitySet where - arbitrary = M.liftM EntitySet (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_EntitySet = []- | P.otherwise = M.catMaybes- [ if obj == default_EntitySet{entitySet_uuid = entitySet_uuid obj} then P.Nothing else P.Just $ default_EntitySet{entitySet_uuid = entitySet_uuid obj}- , if obj == default_EntitySet{entitySet_metadata = entitySet_metadata obj} then P.Nothing else P.Just $ default_EntitySet{entitySet_metadata = entitySet_metadata obj}- , if obj == default_EntitySet{entitySet_entityList = entitySet_entityList obj} then P.Nothing else P.Just $ default_EntitySet{entitySet_entityList = entitySet_entityList obj}- , if obj == default_EntitySet{entitySet_linkingList = entitySet_linkingList obj} then P.Nothing else P.Just $ default_EntitySet{entitySet_linkingList = entitySet_linkingList obj}- , if obj == default_EntitySet{entitySet_mentionSetId = entitySet_mentionSetId obj} then P.Nothing else P.Just $ default_EntitySet{entitySet_mentionSetId = entitySet_mentionSetId obj}- ]-from_EntitySet :: EntitySet -> T.ThriftVal-from_EntitySet record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v22 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v22))) $ entitySet_uuid record- , (\_v22 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v22))) $ entitySet_metadata record- , (\_v22 -> P.Just (3, ("entityList",T.TList (T.T_STRUCT typemap_Entity) $ P.map (\_v24 -> from_Entity _v24) $ Vector.toList _v22))) $ entitySet_entityList record- , (\_v22 -> (4, ("linkingList",T.TList (T.T_STRUCT Linking_Types.typemap_Linking) $ P.map (\_v26 -> Linking_Types.from_Linking _v26) $ Vector.toList _v22))) <$> entitySet_linkingList record- , (\_v22 -> (5, ("mentionSetId",Uuid_Types.from_UUID _v22))) <$> entitySet_mentionSetId record- ]-write_EntitySet :: (T.Protocol p, T.Transport t) => p t -> EntitySet -> P.IO ()-write_EntitySet oprot record = T.writeVal oprot $ from_EntitySet record-encode_EntitySet :: (T.Protocol p, T.Transport t) => p t -> EntitySet -> LBS.ByteString-encode_EntitySet oprot record = T.serializeVal oprot $ from_EntitySet record-to_EntitySet :: T.ThriftVal -> EntitySet-to_EntitySet (T.TStruct fields) = EntitySet{- entitySet_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val28) -> (case _val28 of {T.TStruct _val29 -> (Uuid_Types.to_UUID (T.TStruct _val29)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- entitySet_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val28) -> (case _val28 of {T.TStruct _val30 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val30)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- entitySet_entityList = P.maybe (P.error "Missing required field: entityList") (\(_,_val28) -> (case _val28 of {T.TList _ _val31 -> (Vector.fromList $ P.map (\_v32 -> (case _v32 of {T.TStruct _val33 -> (to_Entity (T.TStruct _val33)); _ -> P.error "wrong type"})) _val31); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- entitySet_linkingList = P.maybe (P.Nothing) (\(_,_val28) -> P.Just (case _val28 of {T.TList _ _val34 -> (Vector.fromList $ P.map (\_v35 -> (case _v35 of {T.TStruct _val36 -> (Linking_Types.to_Linking (T.TStruct _val36)); _ -> P.error "wrong type"})) _val34); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- entitySet_mentionSetId = P.maybe (P.Nothing) (\(_,_val28) -> P.Just (case _val28 of {T.TStruct _val37 -> (Uuid_Types.to_UUID (T.TStruct _val37)); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_EntitySet _ = P.error "not a struct"-read_EntitySet :: (T.Transport t, T.Protocol p) => p t -> P.IO EntitySet-read_EntitySet iprot = to_EntitySet <$> T.readVal iprot (T.T_STRUCT typemap_EntitySet)-decode_EntitySet :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> EntitySet-decode_EntitySet iprot bs = to_EntitySet $ T.deserializeVal iprot (T.T_STRUCT typemap_EntitySet) bs-typemap_EntitySet :: T.TypeMap-typemap_EntitySet = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("entityList",(T.T_LIST (T.T_STRUCT typemap_Entity)))),(4,("linkingList",(T.T_LIST (T.T_STRUCT Linking_Types.typemap_Linking)))),(5,("mentionSetId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_EntitySet :: EntitySet-default_EntitySet = EntitySet{- entitySet_uuid = Uuid_Types.default_UUID,- entitySet_metadata = Metadata_Types.default_AnnotationMetadata,- entitySet_entityList = Vector.empty,- entitySet_linkingList = P.Nothing,- entitySet_mentionSetId = P.Nothing}-data EntityMention = EntityMention { entityMention_uuid :: Uuid_Types.UUID- , entityMention_tokens :: Structure_Types.TokenRefSequence- , entityMention_entityType :: P.Maybe LT.Text- , entityMention_phraseType :: P.Maybe LT.Text- , entityMention_confidence :: P.Maybe P.Double- , entityMention_text :: P.Maybe LT.Text- , entityMention_childMentionIdList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable EntityMention where- hashWithSalt salt record = salt `H.hashWithSalt` entityMention_uuid record `H.hashWithSalt` entityMention_tokens record `H.hashWithSalt` entityMention_entityType record `H.hashWithSalt` entityMention_phraseType record `H.hashWithSalt` entityMention_confidence record `H.hashWithSalt` entityMention_text record `H.hashWithSalt` entityMention_childMentionIdList record -instance QC.Arbitrary EntityMention where - arbitrary = M.liftM EntityMention (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_EntityMention = []- | P.otherwise = M.catMaybes- [ if obj == default_EntityMention{entityMention_uuid = entityMention_uuid obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_uuid = entityMention_uuid obj}- , if obj == default_EntityMention{entityMention_tokens = entityMention_tokens obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_tokens = entityMention_tokens obj}- , if obj == default_EntityMention{entityMention_entityType = entityMention_entityType obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_entityType = entityMention_entityType obj}- , if obj == default_EntityMention{entityMention_phraseType = entityMention_phraseType obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_phraseType = entityMention_phraseType obj}- , if obj == default_EntityMention{entityMention_confidence = entityMention_confidence obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_confidence = entityMention_confidence obj}- , if obj == default_EntityMention{entityMention_text = entityMention_text obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_text = entityMention_text obj}- , if obj == default_EntityMention{entityMention_childMentionIdList = entityMention_childMentionIdList obj} then P.Nothing else P.Just $ default_EntityMention{entityMention_childMentionIdList = entityMention_childMentionIdList obj}- ]-from_EntityMention :: EntityMention -> T.ThriftVal-from_EntityMention record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v40 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v40))) $ entityMention_uuid record- , (\_v40 -> P.Just (2, ("tokens",Structure_Types.from_TokenRefSequence _v40))) $ entityMention_tokens record- , (\_v40 -> (3, ("entityType",T.TString $ E.encodeUtf8 _v40))) <$> entityMention_entityType record- , (\_v40 -> (4, ("phraseType",T.TString $ E.encodeUtf8 _v40))) <$> entityMention_phraseType record- , (\_v40 -> (5, ("confidence",T.TDouble _v40))) <$> entityMention_confidence record- , (\_v40 -> (6, ("text",T.TString $ E.encodeUtf8 _v40))) <$> entityMention_text record- , (\_v40 -> (7, ("childMentionIdList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v42 -> Uuid_Types.from_UUID _v42) $ Vector.toList _v40))) <$> entityMention_childMentionIdList record- ]-write_EntityMention :: (T.Protocol p, T.Transport t) => p t -> EntityMention -> P.IO ()-write_EntityMention oprot record = T.writeVal oprot $ from_EntityMention record-encode_EntityMention :: (T.Protocol p, T.Transport t) => p t -> EntityMention -> LBS.ByteString-encode_EntityMention oprot record = T.serializeVal oprot $ from_EntityMention record-to_EntityMention :: T.ThriftVal -> EntityMention-to_EntityMention (T.TStruct fields) = EntityMention{- entityMention_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val44) -> (case _val44 of {T.TStruct _val45 -> (Uuid_Types.to_UUID (T.TStruct _val45)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- entityMention_tokens = P.maybe (P.error "Missing required field: tokens") (\(_,_val44) -> (case _val44 of {T.TStruct _val46 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val46)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- entityMention_entityType = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TString _val47 -> E.decodeUtf8 _val47; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- entityMention_phraseType = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TString _val48 -> E.decodeUtf8 _val48; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- entityMention_confidence = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TDouble _val49 -> _val49; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- entityMention_text = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TString _val50 -> E.decodeUtf8 _val50; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- entityMention_childMentionIdList = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TList _ _val51 -> (Vector.fromList $ P.map (\_v52 -> (case _v52 of {T.TStruct _val53 -> (Uuid_Types.to_UUID (T.TStruct _val53)); _ -> P.error "wrong type"})) _val51); _ -> P.error "wrong type"})) (Map.lookup (7) fields)- }-to_EntityMention _ = P.error "not a struct"-read_EntityMention :: (T.Transport t, T.Protocol p) => p t -> P.IO EntityMention-read_EntityMention iprot = to_EntityMention <$> T.readVal iprot (T.T_STRUCT typemap_EntityMention)-decode_EntityMention :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> EntityMention-decode_EntityMention iprot bs = to_EntityMention $ T.deserializeVal iprot (T.T_STRUCT typemap_EntityMention) bs-typemap_EntityMention :: T.TypeMap-typemap_EntityMention = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("tokens",(T.T_STRUCT Structure_Types.typemap_TokenRefSequence))),(3,("entityType",T.T_STRING)),(4,("phraseType",T.T_STRING)),(5,("confidence",T.T_DOUBLE)),(6,("text",T.T_STRING)),(7,("childMentionIdList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID))))]-default_EntityMention :: EntityMention-default_EntityMention = EntityMention{- entityMention_uuid = Uuid_Types.default_UUID,- entityMention_tokens = Structure_Types.default_TokenRefSequence,- entityMention_entityType = P.Nothing,- entityMention_phraseType = P.Nothing,- entityMention_confidence = P.Nothing,- entityMention_text = P.Nothing,- entityMention_childMentionIdList = P.Nothing}-data EntityMentionSet = EntityMentionSet { entityMentionSet_uuid :: Uuid_Types.UUID- , entityMentionSet_metadata :: Metadata_Types.AnnotationMetadata- , entityMentionSet_mentionList :: (Vector.Vector EntityMention)- , entityMentionSet_linkingList :: P.Maybe (Vector.Vector Linking_Types.Linking)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable EntityMentionSet where- hashWithSalt salt record = salt `H.hashWithSalt` entityMentionSet_uuid record `H.hashWithSalt` entityMentionSet_metadata record `H.hashWithSalt` entityMentionSet_mentionList record `H.hashWithSalt` entityMentionSet_linkingList record -instance QC.Arbitrary EntityMentionSet where - arbitrary = M.liftM EntityMentionSet (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_EntityMentionSet = []- | P.otherwise = M.catMaybes- [ if obj == default_EntityMentionSet{entityMentionSet_uuid = entityMentionSet_uuid obj} then P.Nothing else P.Just $ default_EntityMentionSet{entityMentionSet_uuid = entityMentionSet_uuid obj}- , if obj == default_EntityMentionSet{entityMentionSet_metadata = entityMentionSet_metadata obj} then P.Nothing else P.Just $ default_EntityMentionSet{entityMentionSet_metadata = entityMentionSet_metadata obj}- , if obj == default_EntityMentionSet{entityMentionSet_mentionList = entityMentionSet_mentionList obj} then P.Nothing else P.Just $ default_EntityMentionSet{entityMentionSet_mentionList = entityMentionSet_mentionList obj}- , if obj == default_EntityMentionSet{entityMentionSet_linkingList = entityMentionSet_linkingList obj} then P.Nothing else P.Just $ default_EntityMentionSet{entityMentionSet_linkingList = entityMentionSet_linkingList obj}- ]-from_EntityMentionSet :: EntityMentionSet -> T.ThriftVal-from_EntityMentionSet record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v56 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v56))) $ entityMentionSet_uuid record- , (\_v56 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v56))) $ entityMentionSet_metadata record- , (\_v56 -> P.Just (3, ("mentionList",T.TList (T.T_STRUCT typemap_EntityMention) $ P.map (\_v58 -> from_EntityMention _v58) $ Vector.toList _v56))) $ entityMentionSet_mentionList record- , (\_v56 -> (4, ("linkingList",T.TList (T.T_STRUCT Linking_Types.typemap_Linking) $ P.map (\_v60 -> Linking_Types.from_Linking _v60) $ Vector.toList _v56))) <$> entityMentionSet_linkingList record- ]-write_EntityMentionSet :: (T.Protocol p, T.Transport t) => p t -> EntityMentionSet -> P.IO ()-write_EntityMentionSet oprot record = T.writeVal oprot $ from_EntityMentionSet record-encode_EntityMentionSet :: (T.Protocol p, T.Transport t) => p t -> EntityMentionSet -> LBS.ByteString-encode_EntityMentionSet oprot record = T.serializeVal oprot $ from_EntityMentionSet record-to_EntityMentionSet :: T.ThriftVal -> EntityMentionSet-to_EntityMentionSet (T.TStruct fields) = EntityMentionSet{- entityMentionSet_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val62) -> (case _val62 of {T.TStruct _val63 -> (Uuid_Types.to_UUID (T.TStruct _val63)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- entityMentionSet_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val62) -> (case _val62 of {T.TStruct _val64 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val64)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- entityMentionSet_mentionList = P.maybe (P.error "Missing required field: mentionList") (\(_,_val62) -> (case _val62 of {T.TList _ _val65 -> (Vector.fromList $ P.map (\_v66 -> (case _v66 of {T.TStruct _val67 -> (to_EntityMention (T.TStruct _val67)); _ -> P.error "wrong type"})) _val65); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- entityMentionSet_linkingList = P.maybe (P.Nothing) (\(_,_val62) -> P.Just (case _val62 of {T.TList _ _val68 -> (Vector.fromList $ P.map (\_v69 -> (case _v69 of {T.TStruct _val70 -> (Linking_Types.to_Linking (T.TStruct _val70)); _ -> P.error "wrong type"})) _val68); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_EntityMentionSet _ = P.error "not a struct"-read_EntityMentionSet :: (T.Transport t, T.Protocol p) => p t -> P.IO EntityMentionSet-read_EntityMentionSet iprot = to_EntityMentionSet <$> T.readVal iprot (T.T_STRUCT typemap_EntityMentionSet)-decode_EntityMentionSet :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> EntityMentionSet-decode_EntityMentionSet iprot bs = to_EntityMentionSet $ T.deserializeVal iprot (T.T_STRUCT typemap_EntityMentionSet) bs-typemap_EntityMentionSet :: T.TypeMap-typemap_EntityMentionSet = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("mentionList",(T.T_LIST (T.T_STRUCT typemap_EntityMention)))),(4,("linkingList",(T.T_LIST (T.T_STRUCT Linking_Types.typemap_Linking))))]-default_EntityMentionSet :: EntityMentionSet-default_EntityMentionSet = EntityMentionSet{- entityMentionSet_uuid = Uuid_Types.default_UUID,- entityMentionSet_metadata = Metadata_Types.default_AnnotationMetadata,- entityMentionSet_mentionList = Vector.empty,- entityMentionSet_linkingList = P.Nothing}
− src/Ex_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Ex_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Ex_Types
− src/Ex_Types.hs
@@ -1,79 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Ex_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data ConcreteThriftException = ConcreteThriftException { concreteThriftException_message :: LT.Text- , concreteThriftException_serEx :: P.Maybe LBS.ByteString- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance X.Exception ConcreteThriftException-instance H.Hashable ConcreteThriftException where- hashWithSalt salt record = salt `H.hashWithSalt` concreteThriftException_message record `H.hashWithSalt` concreteThriftException_serEx record -instance QC.Arbitrary ConcreteThriftException where - arbitrary = M.liftM ConcreteThriftException (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_ConcreteThriftException = []- | P.otherwise = M.catMaybes- [ if obj == default_ConcreteThriftException{concreteThriftException_message = concreteThriftException_message obj} then P.Nothing else P.Just $ default_ConcreteThriftException{concreteThriftException_message = concreteThriftException_message obj}- , if obj == default_ConcreteThriftException{concreteThriftException_serEx = concreteThriftException_serEx obj} then P.Nothing else P.Just $ default_ConcreteThriftException{concreteThriftException_serEx = concreteThriftException_serEx obj}- ]-from_ConcreteThriftException :: ConcreteThriftException -> T.ThriftVal-from_ConcreteThriftException record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("message",T.TString $ E.encodeUtf8 _v2))) $ concreteThriftException_message record- , (\_v2 -> (2, ("serEx",T.TBinary _v2))) <$> concreteThriftException_serEx record- ]-write_ConcreteThriftException :: (T.Protocol p, T.Transport t) => p t -> ConcreteThriftException -> P.IO ()-write_ConcreteThriftException oprot record = T.writeVal oprot $ from_ConcreteThriftException record-encode_ConcreteThriftException :: (T.Protocol p, T.Transport t) => p t -> ConcreteThriftException -> LBS.ByteString-encode_ConcreteThriftException oprot record = T.serializeVal oprot $ from_ConcreteThriftException record-to_ConcreteThriftException :: T.ThriftVal -> ConcreteThriftException-to_ConcreteThriftException (T.TStruct fields) = ConcreteThriftException{- concreteThriftException_message = P.maybe (P.error "Missing required field: message") (\(_,_val4) -> (case _val4 of {T.TString _val5 -> E.decodeUtf8 _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- concreteThriftException_serEx = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBinary _val6 -> _val6; T.TString _val6 -> _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_ConcreteThriftException _ = P.error "not a struct"-read_ConcreteThriftException :: (T.Transport t, T.Protocol p) => p t -> P.IO ConcreteThriftException-read_ConcreteThriftException iprot = to_ConcreteThriftException <$> T.readVal iprot (T.T_STRUCT typemap_ConcreteThriftException)-decode_ConcreteThriftException :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> ConcreteThriftException-decode_ConcreteThriftException iprot bs = to_ConcreteThriftException $ T.deserializeVal iprot (T.T_STRUCT typemap_ConcreteThriftException) bs-typemap_ConcreteThriftException :: T.TypeMap-typemap_ConcreteThriftException = Map.fromList [(1,("message",T.T_STRING)),(2,("serEx",T.T_BINARY))]-default_ConcreteThriftException :: ConcreteThriftException-default_ConcreteThriftException = ConcreteThriftException{- concreteThriftException_message = "",- concreteThriftException_serEx = P.Nothing}
− src/FeedbackService.hs
@@ -1,359 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module FeedbackService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import qualified Service-import Search_Types-import qualified FeedbackService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data StartFeedback_args = StartFeedback_args { startFeedback_args_results :: SearchResult- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartFeedback_args where- hashWithSalt salt record = salt `H.hashWithSalt` startFeedback_args_results record -instance QC.Arbitrary StartFeedback_args where - arbitrary = M.liftM StartFeedback_args (QC.arbitrary)- shrink obj | obj == default_StartFeedback_args = []- | P.otherwise = M.catMaybes- [ if obj == default_StartFeedback_args{startFeedback_args_results = startFeedback_args_results obj} then P.Nothing else P.Just $ default_StartFeedback_args{startFeedback_args_results = startFeedback_args_results obj}- ]-from_StartFeedback_args :: StartFeedback_args -> T.ThriftVal-from_StartFeedback_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v173 -> P.Just (1, ("results",from_SearchResult _v173))) $ startFeedback_args_results record- ]-write_StartFeedback_args :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_args -> P.IO ()-write_StartFeedback_args oprot record = T.writeVal oprot $ from_StartFeedback_args record-encode_StartFeedback_args :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_args -> LBS.ByteString-encode_StartFeedback_args oprot record = T.serializeVal oprot $ from_StartFeedback_args record-to_StartFeedback_args :: T.ThriftVal -> StartFeedback_args-to_StartFeedback_args (T.TStruct fields) = StartFeedback_args{- startFeedback_args_results = P.maybe (startFeedback_args_results default_StartFeedback_args) (\(_,_val175) -> (case _val175 of {T.TStruct _val176 -> (to_SearchResult (T.TStruct _val176)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StartFeedback_args _ = P.error "not a struct"-read_StartFeedback_args :: (T.Transport t, T.Protocol p) => p t -> P.IO StartFeedback_args-read_StartFeedback_args iprot = to_StartFeedback_args <$> T.readVal iprot (T.T_STRUCT typemap_StartFeedback_args)-decode_StartFeedback_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartFeedback_args-decode_StartFeedback_args iprot bs = to_StartFeedback_args $ T.deserializeVal iprot (T.T_STRUCT typemap_StartFeedback_args) bs-typemap_StartFeedback_args :: T.TypeMap-typemap_StartFeedback_args = Map.fromList [(1,("results",(T.T_STRUCT typemap_SearchResult)))]-default_StartFeedback_args :: StartFeedback_args-default_StartFeedback_args = StartFeedback_args{- startFeedback_args_results = default_SearchResult}-data StartFeedback_result = StartFeedback_result { startFeedback_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartFeedback_result where- hashWithSalt salt record = salt `H.hashWithSalt` startFeedback_result_ex record -instance QC.Arbitrary StartFeedback_result where - arbitrary = M.liftM StartFeedback_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_StartFeedback_result = []- | P.otherwise = M.catMaybes- [ if obj == default_StartFeedback_result{startFeedback_result_ex = startFeedback_result_ex obj} then P.Nothing else P.Just $ default_StartFeedback_result{startFeedback_result_ex = startFeedback_result_ex obj}- ]-from_StartFeedback_result :: StartFeedback_result -> T.ThriftVal-from_StartFeedback_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v179 -> (1, ("ex",Services_Types.from_ServicesException _v179))) <$> startFeedback_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v179 -> (1, ("ex",Services_Types.from_ServicesException _v179))) <$> startFeedback_result_ex record- ]- )-write_StartFeedback_result :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_result -> P.IO ()-write_StartFeedback_result oprot record = T.writeVal oprot $ from_StartFeedback_result record-encode_StartFeedback_result :: (T.Protocol p, T.Transport t) => p t -> StartFeedback_result -> LBS.ByteString-encode_StartFeedback_result oprot record = T.serializeVal oprot $ from_StartFeedback_result record-to_StartFeedback_result :: T.ThriftVal -> StartFeedback_result-to_StartFeedback_result (T.TStruct fields) = StartFeedback_result{- startFeedback_result_ex = P.maybe (P.Nothing) (\(_,_val181) -> P.Just (case _val181 of {T.TStruct _val182 -> (Services_Types.to_ServicesException (T.TStruct _val182)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StartFeedback_result _ = P.error "not a struct"-read_StartFeedback_result :: (T.Transport t, T.Protocol p) => p t -> P.IO StartFeedback_result-read_StartFeedback_result iprot = to_StartFeedback_result <$> T.readVal iprot (T.T_STRUCT typemap_StartFeedback_result)-decode_StartFeedback_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartFeedback_result-decode_StartFeedback_result iprot bs = to_StartFeedback_result $ T.deserializeVal iprot (T.T_STRUCT typemap_StartFeedback_result) bs-typemap_StartFeedback_result :: T.TypeMap-typemap_StartFeedback_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_StartFeedback_result :: StartFeedback_result-default_StartFeedback_result = StartFeedback_result{- startFeedback_result_ex = P.Nothing}-data AddCommunicationFeedback_args = AddCommunicationFeedback_args { addCommunicationFeedback_args_searchResultsId :: Uuid_Types.UUID- , addCommunicationFeedback_args_communicationId :: LT.Text- , addCommunicationFeedback_args_feedback :: SearchFeedback- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddCommunicationFeedback_args where- hashWithSalt salt record = salt `H.hashWithSalt` addCommunicationFeedback_args_searchResultsId record `H.hashWithSalt` addCommunicationFeedback_args_communicationId record `H.hashWithSalt` addCommunicationFeedback_args_feedback record -instance QC.Arbitrary AddCommunicationFeedback_args where - arbitrary = M.liftM AddCommunicationFeedback_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AddCommunicationFeedback_args = []- | P.otherwise = M.catMaybes- [ if obj == default_AddCommunicationFeedback_args{addCommunicationFeedback_args_searchResultsId = addCommunicationFeedback_args_searchResultsId obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_args{addCommunicationFeedback_args_searchResultsId = addCommunicationFeedback_args_searchResultsId obj}- , if obj == default_AddCommunicationFeedback_args{addCommunicationFeedback_args_communicationId = addCommunicationFeedback_args_communicationId obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_args{addCommunicationFeedback_args_communicationId = addCommunicationFeedback_args_communicationId obj}- , if obj == default_AddCommunicationFeedback_args{addCommunicationFeedback_args_feedback = addCommunicationFeedback_args_feedback obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_args{addCommunicationFeedback_args_feedback = addCommunicationFeedback_args_feedback obj}- ]-from_AddCommunicationFeedback_args :: AddCommunicationFeedback_args -> T.ThriftVal-from_AddCommunicationFeedback_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v185 -> P.Just (1, ("searchResultsId",Uuid_Types.from_UUID _v185))) $ addCommunicationFeedback_args_searchResultsId record- , (\_v185 -> P.Just (2, ("communicationId",T.TString $ E.encodeUtf8 _v185))) $ addCommunicationFeedback_args_communicationId record- , (\_v185 -> P.Just (3, ("feedback",T.TI32 $ P.fromIntegral $ P.fromEnum _v185))) $ addCommunicationFeedback_args_feedback record- ]-write_AddCommunicationFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_args -> P.IO ()-write_AddCommunicationFeedback_args oprot record = T.writeVal oprot $ from_AddCommunicationFeedback_args record-encode_AddCommunicationFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_args -> LBS.ByteString-encode_AddCommunicationFeedback_args oprot record = T.serializeVal oprot $ from_AddCommunicationFeedback_args record-to_AddCommunicationFeedback_args :: T.ThriftVal -> AddCommunicationFeedback_args-to_AddCommunicationFeedback_args (T.TStruct fields) = AddCommunicationFeedback_args{- addCommunicationFeedback_args_searchResultsId = P.maybe (addCommunicationFeedback_args_searchResultsId default_AddCommunicationFeedback_args) (\(_,_val187) -> (case _val187 of {T.TStruct _val188 -> (Uuid_Types.to_UUID (T.TStruct _val188)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- addCommunicationFeedback_args_communicationId = P.maybe (addCommunicationFeedback_args_communicationId default_AddCommunicationFeedback_args) (\(_,_val187) -> (case _val187 of {T.TString _val189 -> E.decodeUtf8 _val189; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- addCommunicationFeedback_args_feedback = P.maybe (addCommunicationFeedback_args_feedback default_AddCommunicationFeedback_args) (\(_,_val187) -> (case _val187 of {T.TI32 _val190 -> P.toEnum $ P.fromIntegral _val190; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_AddCommunicationFeedback_args _ = P.error "not a struct"-read_AddCommunicationFeedback_args :: (T.Transport t, T.Protocol p) => p t -> P.IO AddCommunicationFeedback_args-read_AddCommunicationFeedback_args iprot = to_AddCommunicationFeedback_args <$> T.readVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_args)-decode_AddCommunicationFeedback_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddCommunicationFeedback_args-decode_AddCommunicationFeedback_args iprot bs = to_AddCommunicationFeedback_args $ T.deserializeVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_args) bs-typemap_AddCommunicationFeedback_args :: T.TypeMap-typemap_AddCommunicationFeedback_args = Map.fromList [(1,("searchResultsId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("communicationId",T.T_STRING)),(3,("feedback",T.T_I32))]-default_AddCommunicationFeedback_args :: AddCommunicationFeedback_args-default_AddCommunicationFeedback_args = AddCommunicationFeedback_args{- addCommunicationFeedback_args_searchResultsId = Uuid_Types.default_UUID,- addCommunicationFeedback_args_communicationId = "",- addCommunicationFeedback_args_feedback = (P.toEnum 0)}-data AddCommunicationFeedback_result = AddCommunicationFeedback_result { addCommunicationFeedback_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddCommunicationFeedback_result where- hashWithSalt salt record = salt `H.hashWithSalt` addCommunicationFeedback_result_ex record -instance QC.Arbitrary AddCommunicationFeedback_result where - arbitrary = M.liftM AddCommunicationFeedback_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_AddCommunicationFeedback_result = []- | P.otherwise = M.catMaybes- [ if obj == default_AddCommunicationFeedback_result{addCommunicationFeedback_result_ex = addCommunicationFeedback_result_ex obj} then P.Nothing else P.Just $ default_AddCommunicationFeedback_result{addCommunicationFeedback_result_ex = addCommunicationFeedback_result_ex obj}- ]-from_AddCommunicationFeedback_result :: AddCommunicationFeedback_result -> T.ThriftVal-from_AddCommunicationFeedback_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v193 -> (1, ("ex",Services_Types.from_ServicesException _v193))) <$> addCommunicationFeedback_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v193 -> (1, ("ex",Services_Types.from_ServicesException _v193))) <$> addCommunicationFeedback_result_ex record- ]- )-write_AddCommunicationFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_result -> P.IO ()-write_AddCommunicationFeedback_result oprot record = T.writeVal oprot $ from_AddCommunicationFeedback_result record-encode_AddCommunicationFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddCommunicationFeedback_result -> LBS.ByteString-encode_AddCommunicationFeedback_result oprot record = T.serializeVal oprot $ from_AddCommunicationFeedback_result record-to_AddCommunicationFeedback_result :: T.ThriftVal -> AddCommunicationFeedback_result-to_AddCommunicationFeedback_result (T.TStruct fields) = AddCommunicationFeedback_result{- addCommunicationFeedback_result_ex = P.maybe (P.Nothing) (\(_,_val195) -> P.Just (case _val195 of {T.TStruct _val196 -> (Services_Types.to_ServicesException (T.TStruct _val196)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_AddCommunicationFeedback_result _ = P.error "not a struct"-read_AddCommunicationFeedback_result :: (T.Transport t, T.Protocol p) => p t -> P.IO AddCommunicationFeedback_result-read_AddCommunicationFeedback_result iprot = to_AddCommunicationFeedback_result <$> T.readVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_result)-decode_AddCommunicationFeedback_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddCommunicationFeedback_result-decode_AddCommunicationFeedback_result iprot bs = to_AddCommunicationFeedback_result $ T.deserializeVal iprot (T.T_STRUCT typemap_AddCommunicationFeedback_result) bs-typemap_AddCommunicationFeedback_result :: T.TypeMap-typemap_AddCommunicationFeedback_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_AddCommunicationFeedback_result :: AddCommunicationFeedback_result-default_AddCommunicationFeedback_result = AddCommunicationFeedback_result{- addCommunicationFeedback_result_ex = P.Nothing}-data AddSentenceFeedback_args = AddSentenceFeedback_args { addSentenceFeedback_args_searchResultsId :: Uuid_Types.UUID- , addSentenceFeedback_args_communicationId :: LT.Text- , addSentenceFeedback_args_sentenceId :: Uuid_Types.UUID- , addSentenceFeedback_args_feedback :: SearchFeedback- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddSentenceFeedback_args where- hashWithSalt salt record = salt `H.hashWithSalt` addSentenceFeedback_args_searchResultsId record `H.hashWithSalt` addSentenceFeedback_args_communicationId record `H.hashWithSalt` addSentenceFeedback_args_sentenceId record `H.hashWithSalt` addSentenceFeedback_args_feedback record -instance QC.Arbitrary AddSentenceFeedback_args where - arbitrary = M.liftM AddSentenceFeedback_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AddSentenceFeedback_args = []- | P.otherwise = M.catMaybes- [ if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_searchResultsId = addSentenceFeedback_args_searchResultsId obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_searchResultsId = addSentenceFeedback_args_searchResultsId obj}- , if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_communicationId = addSentenceFeedback_args_communicationId obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_communicationId = addSentenceFeedback_args_communicationId obj}- , if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_sentenceId = addSentenceFeedback_args_sentenceId obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_sentenceId = addSentenceFeedback_args_sentenceId obj}- , if obj == default_AddSentenceFeedback_args{addSentenceFeedback_args_feedback = addSentenceFeedback_args_feedback obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_args{addSentenceFeedback_args_feedback = addSentenceFeedback_args_feedback obj}- ]-from_AddSentenceFeedback_args :: AddSentenceFeedback_args -> T.ThriftVal-from_AddSentenceFeedback_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v199 -> P.Just (1, ("searchResultsId",Uuid_Types.from_UUID _v199))) $ addSentenceFeedback_args_searchResultsId record- , (\_v199 -> P.Just (2, ("communicationId",T.TString $ E.encodeUtf8 _v199))) $ addSentenceFeedback_args_communicationId record- , (\_v199 -> P.Just (3, ("sentenceId",Uuid_Types.from_UUID _v199))) $ addSentenceFeedback_args_sentenceId record- , (\_v199 -> P.Just (4, ("feedback",T.TI32 $ P.fromIntegral $ P.fromEnum _v199))) $ addSentenceFeedback_args_feedback record- ]-write_AddSentenceFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_args -> P.IO ()-write_AddSentenceFeedback_args oprot record = T.writeVal oprot $ from_AddSentenceFeedback_args record-encode_AddSentenceFeedback_args :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_args -> LBS.ByteString-encode_AddSentenceFeedback_args oprot record = T.serializeVal oprot $ from_AddSentenceFeedback_args record-to_AddSentenceFeedback_args :: T.ThriftVal -> AddSentenceFeedback_args-to_AddSentenceFeedback_args (T.TStruct fields) = AddSentenceFeedback_args{- addSentenceFeedback_args_searchResultsId = P.maybe (addSentenceFeedback_args_searchResultsId default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TStruct _val202 -> (Uuid_Types.to_UUID (T.TStruct _val202)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- addSentenceFeedback_args_communicationId = P.maybe (addSentenceFeedback_args_communicationId default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TString _val203 -> E.decodeUtf8 _val203; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- addSentenceFeedback_args_sentenceId = P.maybe (addSentenceFeedback_args_sentenceId default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TStruct _val204 -> (Uuid_Types.to_UUID (T.TStruct _val204)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- addSentenceFeedback_args_feedback = P.maybe (addSentenceFeedback_args_feedback default_AddSentenceFeedback_args) (\(_,_val201) -> (case _val201 of {T.TI32 _val205 -> P.toEnum $ P.fromIntegral _val205; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_AddSentenceFeedback_args _ = P.error "not a struct"-read_AddSentenceFeedback_args :: (T.Transport t, T.Protocol p) => p t -> P.IO AddSentenceFeedback_args-read_AddSentenceFeedback_args iprot = to_AddSentenceFeedback_args <$> T.readVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_args)-decode_AddSentenceFeedback_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddSentenceFeedback_args-decode_AddSentenceFeedback_args iprot bs = to_AddSentenceFeedback_args $ T.deserializeVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_args) bs-typemap_AddSentenceFeedback_args :: T.TypeMap-typemap_AddSentenceFeedback_args = Map.fromList [(1,("searchResultsId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("communicationId",T.T_STRING)),(3,("sentenceId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(4,("feedback",T.T_I32))]-default_AddSentenceFeedback_args :: AddSentenceFeedback_args-default_AddSentenceFeedback_args = AddSentenceFeedback_args{- addSentenceFeedback_args_searchResultsId = Uuid_Types.default_UUID,- addSentenceFeedback_args_communicationId = "",- addSentenceFeedback_args_sentenceId = Uuid_Types.default_UUID,- addSentenceFeedback_args_feedback = (P.toEnum 0)}-data AddSentenceFeedback_result = AddSentenceFeedback_result { addSentenceFeedback_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AddSentenceFeedback_result where- hashWithSalt salt record = salt `H.hashWithSalt` addSentenceFeedback_result_ex record -instance QC.Arbitrary AddSentenceFeedback_result where - arbitrary = M.liftM AddSentenceFeedback_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_AddSentenceFeedback_result = []- | P.otherwise = M.catMaybes- [ if obj == default_AddSentenceFeedback_result{addSentenceFeedback_result_ex = addSentenceFeedback_result_ex obj} then P.Nothing else P.Just $ default_AddSentenceFeedback_result{addSentenceFeedback_result_ex = addSentenceFeedback_result_ex obj}- ]-from_AddSentenceFeedback_result :: AddSentenceFeedback_result -> T.ThriftVal-from_AddSentenceFeedback_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v208 -> (1, ("ex",Services_Types.from_ServicesException _v208))) <$> addSentenceFeedback_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v208 -> (1, ("ex",Services_Types.from_ServicesException _v208))) <$> addSentenceFeedback_result_ex record- ]- )-write_AddSentenceFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_result -> P.IO ()-write_AddSentenceFeedback_result oprot record = T.writeVal oprot $ from_AddSentenceFeedback_result record-encode_AddSentenceFeedback_result :: (T.Protocol p, T.Transport t) => p t -> AddSentenceFeedback_result -> LBS.ByteString-encode_AddSentenceFeedback_result oprot record = T.serializeVal oprot $ from_AddSentenceFeedback_result record-to_AddSentenceFeedback_result :: T.ThriftVal -> AddSentenceFeedback_result-to_AddSentenceFeedback_result (T.TStruct fields) = AddSentenceFeedback_result{- addSentenceFeedback_result_ex = P.maybe (P.Nothing) (\(_,_val210) -> P.Just (case _val210 of {T.TStruct _val211 -> (Services_Types.to_ServicesException (T.TStruct _val211)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_AddSentenceFeedback_result _ = P.error "not a struct"-read_AddSentenceFeedback_result :: (T.Transport t, T.Protocol p) => p t -> P.IO AddSentenceFeedback_result-read_AddSentenceFeedback_result iprot = to_AddSentenceFeedback_result <$> T.readVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_result)-decode_AddSentenceFeedback_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AddSentenceFeedback_result-decode_AddSentenceFeedback_result iprot bs = to_AddSentenceFeedback_result $ T.deserializeVal iprot (T.T_STRUCT typemap_AddSentenceFeedback_result) bs-typemap_AddSentenceFeedback_result :: T.TypeMap-typemap_AddSentenceFeedback_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_AddSentenceFeedback_result :: AddSentenceFeedback_result-default_AddSentenceFeedback_result = AddSentenceFeedback_result{- addSentenceFeedback_result_ex = P.Nothing}-process_startFeedback (seqid, iprot, oprot, handler) = do- args <- read_StartFeedback_args iprot- (X.catch- (X.catch- (do- Iface.startFeedback handler (startFeedback_args_results args)- let res = default_StartFeedback_result- T.writeMessageBegin oprot ("startFeedback", T.M_REPLY, seqid)- write_StartFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_StartFeedback_result{startFeedback_result_ex = P.Just e}- T.writeMessageBegin oprot ("startFeedback", T.M_REPLY, seqid)- write_StartFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("startFeedback", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_addCommunicationFeedback (seqid, iprot, oprot, handler) = do- args <- read_AddCommunicationFeedback_args iprot- (X.catch- (X.catch- (do- Iface.addCommunicationFeedback handler (addCommunicationFeedback_args_searchResultsId args) (addCommunicationFeedback_args_communicationId args) (addCommunicationFeedback_args_feedback args)- let res = default_AddCommunicationFeedback_result- T.writeMessageBegin oprot ("addCommunicationFeedback", T.M_REPLY, seqid)- write_AddCommunicationFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_AddCommunicationFeedback_result{addCommunicationFeedback_result_ex = P.Just e}- T.writeMessageBegin oprot ("addCommunicationFeedback", T.M_REPLY, seqid)- write_AddCommunicationFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("addCommunicationFeedback", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_addSentenceFeedback (seqid, iprot, oprot, handler) = do- args <- read_AddSentenceFeedback_args iprot- (X.catch- (X.catch- (do- Iface.addSentenceFeedback handler (addSentenceFeedback_args_searchResultsId args) (addSentenceFeedback_args_communicationId args) (addSentenceFeedback_args_sentenceId args) (addSentenceFeedback_args_feedback args)- let res = default_AddSentenceFeedback_result- T.writeMessageBegin oprot ("addSentenceFeedback", T.M_REPLY, seqid)- write_AddSentenceFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_AddSentenceFeedback_result{addSentenceFeedback_result_ex = P.Just e}- T.writeMessageBegin oprot ("addSentenceFeedback", T.M_REPLY, seqid)- write_AddSentenceFeedback_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("addSentenceFeedback", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "startFeedback" -> process_startFeedback (seqid,iprot,oprot,handler)- "addCommunicationFeedback" -> process_addCommunicationFeedback (seqid,iprot,oprot,handler)- "addSentenceFeedback" -> process_addSentenceFeedback (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/FeedbackService_Client.hs
@@ -1,103 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module FeedbackService_Client(startFeedback,addCommunicationFeedback,addSentenceFeedback) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types-import FeedbackService-seqid = R.newIORef 0-startFeedback (ip,op) arg_results = do- send_startFeedback op arg_results- recv_startFeedback ip-send_startFeedback op arg_results = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("startFeedback", T.M_CALL, seqn)- write_StartFeedback_args op (StartFeedback_args{startFeedback_args_results=arg_results})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_startFeedback ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_StartFeedback_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (startFeedback_result_ex res)- P.return ()-addCommunicationFeedback (ip,op) arg_searchResultsId arg_communicationId arg_feedback = do- send_addCommunicationFeedback op arg_searchResultsId arg_communicationId arg_feedback- recv_addCommunicationFeedback ip-send_addCommunicationFeedback op arg_searchResultsId arg_communicationId arg_feedback = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("addCommunicationFeedback", T.M_CALL, seqn)- write_AddCommunicationFeedback_args op (AddCommunicationFeedback_args{addCommunicationFeedback_args_searchResultsId=arg_searchResultsId,addCommunicationFeedback_args_communicationId=arg_communicationId,addCommunicationFeedback_args_feedback=arg_feedback})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_addCommunicationFeedback ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_AddCommunicationFeedback_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (addCommunicationFeedback_result_ex res)- P.return ()-addSentenceFeedback (ip,op) arg_searchResultsId arg_communicationId arg_sentenceId arg_feedback = do- send_addSentenceFeedback op arg_searchResultsId arg_communicationId arg_sentenceId arg_feedback- recv_addSentenceFeedback ip-send_addSentenceFeedback op arg_searchResultsId arg_communicationId arg_sentenceId arg_feedback = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("addSentenceFeedback", T.M_CALL, seqn)- write_AddSentenceFeedback_args op (AddSentenceFeedback_args{addSentenceFeedback_args_searchResultsId=arg_searchResultsId,addSentenceFeedback_args_communicationId=arg_communicationId,addSentenceFeedback_args_sentenceId=arg_sentenceId,addSentenceFeedback_args_feedback=arg_feedback})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_addSentenceFeedback ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_AddSentenceFeedback_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (addSentenceFeedback_result_ex res)- P.return ()
− src/FeedbackService_Iface.hs
@@ -1,54 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module FeedbackService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types--import Service_Iface-class Service_Iface a => FeedbackService_Iface a where- startFeedback :: a -> SearchResult -> P.IO ()- addCommunicationFeedback :: a -> Uuid_Types.UUID -> LT.Text -> SearchFeedback -> P.IO ()- addSentenceFeedback :: a -> Uuid_Types.UUID -> LT.Text -> Uuid_Types.UUID -> SearchFeedback -> P.IO ()
− src/FetchCommunicationService.hs
@@ -1,343 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module FetchCommunicationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import qualified Service-import Access_Types-import qualified FetchCommunicationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Fetch_args = Fetch_args { fetch_args_request :: FetchRequest- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Fetch_args where- hashWithSalt salt record = salt `H.hashWithSalt` fetch_args_request record -instance QC.Arbitrary Fetch_args where - arbitrary = M.liftM Fetch_args (QC.arbitrary)- shrink obj | obj == default_Fetch_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Fetch_args{fetch_args_request = fetch_args_request obj} then P.Nothing else P.Just $ default_Fetch_args{fetch_args_request = fetch_args_request obj}- ]-from_Fetch_args :: Fetch_args -> T.ThriftVal-from_Fetch_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v23 -> P.Just (1, ("request",from_FetchRequest _v23))) $ fetch_args_request record- ]-write_Fetch_args :: (T.Protocol p, T.Transport t) => p t -> Fetch_args -> P.IO ()-write_Fetch_args oprot record = T.writeVal oprot $ from_Fetch_args record-encode_Fetch_args :: (T.Protocol p, T.Transport t) => p t -> Fetch_args -> LBS.ByteString-encode_Fetch_args oprot record = T.serializeVal oprot $ from_Fetch_args record-to_Fetch_args :: T.ThriftVal -> Fetch_args-to_Fetch_args (T.TStruct fields) = Fetch_args{- fetch_args_request = P.maybe (fetch_args_request default_Fetch_args) (\(_,_val25) -> (case _val25 of {T.TStruct _val26 -> (to_FetchRequest (T.TStruct _val26)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Fetch_args _ = P.error "not a struct"-read_Fetch_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Fetch_args-read_Fetch_args iprot = to_Fetch_args <$> T.readVal iprot (T.T_STRUCT typemap_Fetch_args)-decode_Fetch_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Fetch_args-decode_Fetch_args iprot bs = to_Fetch_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Fetch_args) bs-typemap_Fetch_args :: T.TypeMap-typemap_Fetch_args = Map.fromList [(1,("request",(T.T_STRUCT typemap_FetchRequest)))]-default_Fetch_args :: Fetch_args-default_Fetch_args = Fetch_args{- fetch_args_request = default_FetchRequest}-data Fetch_result = Fetch_result { fetch_result_success :: FetchResult- , fetch_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Fetch_result where- hashWithSalt salt record = salt `H.hashWithSalt` fetch_result_success record `H.hashWithSalt` fetch_result_ex record -instance QC.Arbitrary Fetch_result where - arbitrary = M.liftM Fetch_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Fetch_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Fetch_result{fetch_result_success = fetch_result_success obj} then P.Nothing else P.Just $ default_Fetch_result{fetch_result_success = fetch_result_success obj}- , if obj == default_Fetch_result{fetch_result_ex = fetch_result_ex obj} then P.Nothing else P.Just $ default_Fetch_result{fetch_result_ex = fetch_result_ex obj}- ]-from_Fetch_result :: Fetch_result -> T.ThriftVal-from_Fetch_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v29 -> (1, ("ex",Services_Types.from_ServicesException _v29))) <$> fetch_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v29 -> P.Just (0, ("success",from_FetchResult _v29))) $ fetch_result_success record- , (\_v29 -> (1, ("ex",Services_Types.from_ServicesException _v29))) <$> fetch_result_ex record- ]- )-write_Fetch_result :: (T.Protocol p, T.Transport t) => p t -> Fetch_result -> P.IO ()-write_Fetch_result oprot record = T.writeVal oprot $ from_Fetch_result record-encode_Fetch_result :: (T.Protocol p, T.Transport t) => p t -> Fetch_result -> LBS.ByteString-encode_Fetch_result oprot record = T.serializeVal oprot $ from_Fetch_result record-to_Fetch_result :: T.ThriftVal -> Fetch_result-to_Fetch_result (T.TStruct fields) = Fetch_result{- fetch_result_success = P.maybe (fetch_result_success default_Fetch_result) (\(_,_val31) -> (case _val31 of {T.TStruct _val32 -> (to_FetchResult (T.TStruct _val32)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- fetch_result_ex = P.maybe (P.Nothing) (\(_,_val31) -> P.Just (case _val31 of {T.TStruct _val33 -> (Services_Types.to_ServicesException (T.TStruct _val33)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Fetch_result _ = P.error "not a struct"-read_Fetch_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Fetch_result-read_Fetch_result iprot = to_Fetch_result <$> T.readVal iprot (T.T_STRUCT typemap_Fetch_result)-decode_Fetch_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Fetch_result-decode_Fetch_result iprot bs = to_Fetch_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Fetch_result) bs-typemap_Fetch_result :: T.TypeMap-typemap_Fetch_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_FetchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Fetch_result :: Fetch_result-default_Fetch_result = Fetch_result{- fetch_result_success = default_FetchResult,- fetch_result_ex = P.Nothing}-data GetCommunicationIDs_args = GetCommunicationIDs_args { getCommunicationIDs_args_offset :: I.Int64- , getCommunicationIDs_args_count :: I.Int64- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationIDs_args where- hashWithSalt salt record = salt `H.hashWithSalt` getCommunicationIDs_args_offset record `H.hashWithSalt` getCommunicationIDs_args_count record -instance QC.Arbitrary GetCommunicationIDs_args where - arbitrary = M.liftM GetCommunicationIDs_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_GetCommunicationIDs_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCommunicationIDs_args{getCommunicationIDs_args_offset = getCommunicationIDs_args_offset obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_args{getCommunicationIDs_args_offset = getCommunicationIDs_args_offset obj}- , if obj == default_GetCommunicationIDs_args{getCommunicationIDs_args_count = getCommunicationIDs_args_count obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_args{getCommunicationIDs_args_count = getCommunicationIDs_args_count obj}- ]-from_GetCommunicationIDs_args :: GetCommunicationIDs_args -> T.ThriftVal-from_GetCommunicationIDs_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v36 -> P.Just (1, ("offset",T.TI64 _v36))) $ getCommunicationIDs_args_offset record- , (\_v36 -> P.Just (2, ("count",T.TI64 _v36))) $ getCommunicationIDs_args_count record- ]-write_GetCommunicationIDs_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_args -> P.IO ()-write_GetCommunicationIDs_args oprot record = T.writeVal oprot $ from_GetCommunicationIDs_args record-encode_GetCommunicationIDs_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_args -> LBS.ByteString-encode_GetCommunicationIDs_args oprot record = T.serializeVal oprot $ from_GetCommunicationIDs_args record-to_GetCommunicationIDs_args :: T.ThriftVal -> GetCommunicationIDs_args-to_GetCommunicationIDs_args (T.TStruct fields) = GetCommunicationIDs_args{- getCommunicationIDs_args_offset = P.maybe (getCommunicationIDs_args_offset default_GetCommunicationIDs_args) (\(_,_val38) -> (case _val38 of {T.TI64 _val39 -> _val39; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- getCommunicationIDs_args_count = P.maybe (getCommunicationIDs_args_count default_GetCommunicationIDs_args) (\(_,_val38) -> (case _val38 of {T.TI64 _val40 -> _val40; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_GetCommunicationIDs_args _ = P.error "not a struct"-read_GetCommunicationIDs_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationIDs_args-read_GetCommunicationIDs_args iprot = to_GetCommunicationIDs_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_args)-decode_GetCommunicationIDs_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationIDs_args-decode_GetCommunicationIDs_args iprot bs = to_GetCommunicationIDs_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_args) bs-typemap_GetCommunicationIDs_args :: T.TypeMap-typemap_GetCommunicationIDs_args = Map.fromList [(1,("offset",T.T_I64)),(2,("count",T.T_I64))]-default_GetCommunicationIDs_args :: GetCommunicationIDs_args-default_GetCommunicationIDs_args = GetCommunicationIDs_args{- getCommunicationIDs_args_offset = 0,- getCommunicationIDs_args_count = 0}-data GetCommunicationIDs_result = GetCommunicationIDs_result { getCommunicationIDs_result_success :: (Vector.Vector LT.Text)- , getCommunicationIDs_result_ex :: P.Maybe Services_Types.NotImplementedException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationIDs_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCommunicationIDs_result_success record `H.hashWithSalt` getCommunicationIDs_result_ex record -instance QC.Arbitrary GetCommunicationIDs_result where - arbitrary = M.liftM GetCommunicationIDs_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCommunicationIDs_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCommunicationIDs_result{getCommunicationIDs_result_success = getCommunicationIDs_result_success obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_result{getCommunicationIDs_result_success = getCommunicationIDs_result_success obj}- , if obj == default_GetCommunicationIDs_result{getCommunicationIDs_result_ex = getCommunicationIDs_result_ex obj} then P.Nothing else P.Just $ default_GetCommunicationIDs_result{getCommunicationIDs_result_ex = getCommunicationIDs_result_ex obj}- ]-from_GetCommunicationIDs_result :: GetCommunicationIDs_result -> T.ThriftVal-from_GetCommunicationIDs_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v43 -> (1, ("ex",Services_Types.from_NotImplementedException _v43))) <$> getCommunicationIDs_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v43 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v45 -> T.TString $ E.encodeUtf8 _v45) $ Vector.toList _v43))) $ getCommunicationIDs_result_success record- , (\_v43 -> (1, ("ex",Services_Types.from_NotImplementedException _v43))) <$> getCommunicationIDs_result_ex record- ]- )-write_GetCommunicationIDs_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_result -> P.IO ()-write_GetCommunicationIDs_result oprot record = T.writeVal oprot $ from_GetCommunicationIDs_result record-encode_GetCommunicationIDs_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationIDs_result -> LBS.ByteString-encode_GetCommunicationIDs_result oprot record = T.serializeVal oprot $ from_GetCommunicationIDs_result record-to_GetCommunicationIDs_result :: T.ThriftVal -> GetCommunicationIDs_result-to_GetCommunicationIDs_result (T.TStruct fields) = GetCommunicationIDs_result{- getCommunicationIDs_result_success = P.maybe (getCommunicationIDs_result_success default_GetCommunicationIDs_result) (\(_,_val47) -> (case _val47 of {T.TList _ _val48 -> (Vector.fromList $ P.map (\_v49 -> (case _v49 of {T.TString _val50 -> E.decodeUtf8 _val50; _ -> P.error "wrong type"})) _val48); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCommunicationIDs_result_ex = P.maybe (P.Nothing) (\(_,_val47) -> P.Just (case _val47 of {T.TStruct _val51 -> (Services_Types.to_NotImplementedException (T.TStruct _val51)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCommunicationIDs_result _ = P.error "not a struct"-read_GetCommunicationIDs_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationIDs_result-read_GetCommunicationIDs_result iprot = to_GetCommunicationIDs_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_result)-decode_GetCommunicationIDs_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationIDs_result-decode_GetCommunicationIDs_result iprot bs = to_GetCommunicationIDs_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationIDs_result) bs-typemap_GetCommunicationIDs_result :: T.TypeMap-typemap_GetCommunicationIDs_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_NotImplementedException)))]-default_GetCommunicationIDs_result :: GetCommunicationIDs_result-default_GetCommunicationIDs_result = GetCommunicationIDs_result{- getCommunicationIDs_result_success = Vector.empty,- getCommunicationIDs_result_ex = P.Nothing}-data GetCommunicationCount_args = GetCommunicationCount_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationCount_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCommunicationCount_args where - arbitrary = QC.elements [GetCommunicationCount_args]-from_GetCommunicationCount_args :: GetCommunicationCount_args -> T.ThriftVal-from_GetCommunicationCount_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCommunicationCount_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_args -> P.IO ()-write_GetCommunicationCount_args oprot record = T.writeVal oprot $ from_GetCommunicationCount_args record-encode_GetCommunicationCount_args :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_args -> LBS.ByteString-encode_GetCommunicationCount_args oprot record = T.serializeVal oprot $ from_GetCommunicationCount_args record-to_GetCommunicationCount_args :: T.ThriftVal -> GetCommunicationCount_args-to_GetCommunicationCount_args (T.TStruct fields) = GetCommunicationCount_args{-- }-to_GetCommunicationCount_args _ = P.error "not a struct"-read_GetCommunicationCount_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationCount_args-read_GetCommunicationCount_args iprot = to_GetCommunicationCount_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationCount_args)-decode_GetCommunicationCount_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationCount_args-decode_GetCommunicationCount_args iprot bs = to_GetCommunicationCount_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationCount_args) bs-typemap_GetCommunicationCount_args :: T.TypeMap-typemap_GetCommunicationCount_args = Map.fromList []-default_GetCommunicationCount_args :: GetCommunicationCount_args-default_GetCommunicationCount_args = GetCommunicationCount_args{-}-data GetCommunicationCount_result = GetCommunicationCount_result { getCommunicationCount_result_success :: I.Int64- , getCommunicationCount_result_ex :: P.Maybe Services_Types.NotImplementedException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCommunicationCount_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCommunicationCount_result_success record `H.hashWithSalt` getCommunicationCount_result_ex record -instance QC.Arbitrary GetCommunicationCount_result where - arbitrary = M.liftM GetCommunicationCount_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCommunicationCount_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCommunicationCount_result{getCommunicationCount_result_success = getCommunicationCount_result_success obj} then P.Nothing else P.Just $ default_GetCommunicationCount_result{getCommunicationCount_result_success = getCommunicationCount_result_success obj}- , if obj == default_GetCommunicationCount_result{getCommunicationCount_result_ex = getCommunicationCount_result_ex obj} then P.Nothing else P.Just $ default_GetCommunicationCount_result{getCommunicationCount_result_ex = getCommunicationCount_result_ex obj}- ]-from_GetCommunicationCount_result :: GetCommunicationCount_result -> T.ThriftVal-from_GetCommunicationCount_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v59 -> (1, ("ex",Services_Types.from_NotImplementedException _v59))) <$> getCommunicationCount_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v59 -> P.Just (0, ("success",T.TI64 _v59))) $ getCommunicationCount_result_success record- , (\_v59 -> (1, ("ex",Services_Types.from_NotImplementedException _v59))) <$> getCommunicationCount_result_ex record- ]- )-write_GetCommunicationCount_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_result -> P.IO ()-write_GetCommunicationCount_result oprot record = T.writeVal oprot $ from_GetCommunicationCount_result record-encode_GetCommunicationCount_result :: (T.Protocol p, T.Transport t) => p t -> GetCommunicationCount_result -> LBS.ByteString-encode_GetCommunicationCount_result oprot record = T.serializeVal oprot $ from_GetCommunicationCount_result record-to_GetCommunicationCount_result :: T.ThriftVal -> GetCommunicationCount_result-to_GetCommunicationCount_result (T.TStruct fields) = GetCommunicationCount_result{- getCommunicationCount_result_success = P.maybe (getCommunicationCount_result_success default_GetCommunicationCount_result) (\(_,_val61) -> (case _val61 of {T.TI64 _val62 -> _val62; _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCommunicationCount_result_ex = P.maybe (P.Nothing) (\(_,_val61) -> P.Just (case _val61 of {T.TStruct _val63 -> (Services_Types.to_NotImplementedException (T.TStruct _val63)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCommunicationCount_result _ = P.error "not a struct"-read_GetCommunicationCount_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCommunicationCount_result-read_GetCommunicationCount_result iprot = to_GetCommunicationCount_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCommunicationCount_result)-decode_GetCommunicationCount_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCommunicationCount_result-decode_GetCommunicationCount_result iprot bs = to_GetCommunicationCount_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCommunicationCount_result) bs-typemap_GetCommunicationCount_result :: T.TypeMap-typemap_GetCommunicationCount_result = Map.fromList [(0,("success",T.T_I64)),(1,("ex",(T.T_STRUCT Services_Types.typemap_NotImplementedException)))]-default_GetCommunicationCount_result :: GetCommunicationCount_result-default_GetCommunicationCount_result = GetCommunicationCount_result{- getCommunicationCount_result_success = 0,- getCommunicationCount_result_ex = P.Nothing}-process_fetch (seqid, iprot, oprot, handler) = do- args <- read_Fetch_args iprot- (X.catch- (X.catch- (do- val <- Iface.fetch handler (fetch_args_request args)- let res = default_Fetch_result{fetch_result_success = val}- T.writeMessageBegin oprot ("fetch", T.M_REPLY, seqid)- write_Fetch_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Fetch_result{fetch_result_ex = P.Just e}- T.writeMessageBegin oprot ("fetch", T.M_REPLY, seqid)- write_Fetch_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("fetch", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCommunicationIDs (seqid, iprot, oprot, handler) = do- args <- read_GetCommunicationIDs_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCommunicationIDs handler (getCommunicationIDs_args_offset args) (getCommunicationIDs_args_count args)- let res = default_GetCommunicationIDs_result{getCommunicationIDs_result_success = val}- T.writeMessageBegin oprot ("getCommunicationIDs", T.M_REPLY, seqid)- write_GetCommunicationIDs_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCommunicationIDs_result{getCommunicationIDs_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCommunicationIDs", T.M_REPLY, seqid)- write_GetCommunicationIDs_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCommunicationIDs", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCommunicationCount (seqid, iprot, oprot, handler) = do- args <- read_GetCommunicationCount_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCommunicationCount handler- let res = default_GetCommunicationCount_result{getCommunicationCount_result_success = val}- T.writeMessageBegin oprot ("getCommunicationCount", T.M_REPLY, seqid)- write_GetCommunicationCount_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCommunicationCount_result{getCommunicationCount_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCommunicationCount", T.M_REPLY, seqid)- write_GetCommunicationCount_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCommunicationCount", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "fetch" -> process_fetch (seqid,iprot,oprot,handler)- "getCommunicationIDs" -> process_getCommunicationIDs (seqid,iprot,oprot,handler)- "getCommunicationCount" -> process_getCommunicationCount (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/FetchCommunicationService_Client.hs
@@ -1,99 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module FetchCommunicationService_Client(fetch,getCommunicationIDs,getCommunicationCount) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types-import FetchCommunicationService-seqid = R.newIORef 0-fetch (ip,op) arg_request = do- send_fetch op arg_request- recv_fetch ip-send_fetch op arg_request = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("fetch", T.M_CALL, seqn)- write_Fetch_args op (Fetch_args{fetch_args_request=arg_request})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_fetch ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Fetch_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (fetch_result_ex res)- P.return $ fetch_result_success res-getCommunicationIDs (ip,op) arg_offset arg_count = do- send_getCommunicationIDs op arg_offset arg_count- recv_getCommunicationIDs ip-send_getCommunicationIDs op arg_offset arg_count = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCommunicationIDs", T.M_CALL, seqn)- write_GetCommunicationIDs_args op (GetCommunicationIDs_args{getCommunicationIDs_args_offset=arg_offset,getCommunicationIDs_args_count=arg_count})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCommunicationIDs ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCommunicationIDs_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCommunicationIDs_result_ex res)- P.return $ getCommunicationIDs_result_success res-getCommunicationCount (ip,op) = do- send_getCommunicationCount op- recv_getCommunicationCount ip-send_getCommunicationCount op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCommunicationCount", T.M_CALL, seqn)- write_GetCommunicationCount_args op (GetCommunicationCount_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCommunicationCount ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCommunicationCount_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCommunicationCount_result_ex res)- P.return $ getCommunicationCount_result_success res
− src/FetchCommunicationService_Iface.hs
@@ -1,50 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module FetchCommunicationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types--import Service_Iface-class Service_Iface a => FetchCommunicationService_Iface a where- fetch :: a -> FetchRequest -> P.IO FetchResult- getCommunicationIDs :: a -> I.Int64 -> I.Int64 -> P.IO (Vector.Vector LT.Text)- getCommunicationCount :: a -> P.IO I.Int64
− src/Language_Consts.hs
@@ -1,44 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Language_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Uuid_Types---import Language_Types
− src/Language_Types.hs
@@ -1,87 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Language_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Uuid_Types---data LanguageIdentification = LanguageIdentification { languageIdentification_uuid :: Uuid_Types.UUID- , languageIdentification_metadata :: Metadata_Types.AnnotationMetadata- , languageIdentification_languageToProbabilityMap :: (Map.HashMap LT.Text P.Double)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable LanguageIdentification where- hashWithSalt salt record = salt `H.hashWithSalt` languageIdentification_uuid record `H.hashWithSalt` languageIdentification_metadata record `H.hashWithSalt` languageIdentification_languageToProbabilityMap record -instance QC.Arbitrary LanguageIdentification where - arbitrary = M.liftM LanguageIdentification (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_LanguageIdentification = []- | P.otherwise = M.catMaybes- [ if obj == default_LanguageIdentification{languageIdentification_uuid = languageIdentification_uuid obj} then P.Nothing else P.Just $ default_LanguageIdentification{languageIdentification_uuid = languageIdentification_uuid obj}- , if obj == default_LanguageIdentification{languageIdentification_metadata = languageIdentification_metadata obj} then P.Nothing else P.Just $ default_LanguageIdentification{languageIdentification_metadata = languageIdentification_metadata obj}- , if obj == default_LanguageIdentification{languageIdentification_languageToProbabilityMap = languageIdentification_languageToProbabilityMap obj} then P.Nothing else P.Just $ default_LanguageIdentification{languageIdentification_languageToProbabilityMap = languageIdentification_languageToProbabilityMap obj}- ]-from_LanguageIdentification :: LanguageIdentification -> T.ThriftVal-from_LanguageIdentification record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v2))) $ languageIdentification_uuid record- , (\_v2 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v2))) $ languageIdentification_metadata record- , (\_v2 -> P.Just (3, ("languageToProbabilityMap",T.TMap T.T_STRING T.T_DOUBLE $ P.map (\(_k3,_v4) -> (T.TString $ E.encodeUtf8 _k3, T.TDouble _v4)) $ Map.toList _v2))) $ languageIdentification_languageToProbabilityMap record- ]-write_LanguageIdentification :: (T.Protocol p, T.Transport t) => p t -> LanguageIdentification -> P.IO ()-write_LanguageIdentification oprot record = T.writeVal oprot $ from_LanguageIdentification record-encode_LanguageIdentification :: (T.Protocol p, T.Transport t) => p t -> LanguageIdentification -> LBS.ByteString-encode_LanguageIdentification oprot record = T.serializeVal oprot $ from_LanguageIdentification record-to_LanguageIdentification :: T.ThriftVal -> LanguageIdentification-to_LanguageIdentification (T.TStruct fields) = LanguageIdentification{- languageIdentification_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val6) -> (case _val6 of {T.TStruct _val7 -> (Uuid_Types.to_UUID (T.TStruct _val7)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- languageIdentification_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val6) -> (case _val6 of {T.TStruct _val8 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val8)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- languageIdentification_languageToProbabilityMap = P.maybe (P.error "Missing required field: languageToProbabilityMap") (\(_,_val6) -> (case _val6 of {T.TMap _ _ _val9 -> (Map.fromList $ P.map (\(_k11,_v10) -> ((case _k11 of {T.TString _val12 -> E.decodeUtf8 _val12; _ -> P.error "wrong type"}),(case _v10 of {T.TDouble _val13 -> _val13; _ -> P.error "wrong type"}))) _val9); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_LanguageIdentification _ = P.error "not a struct"-read_LanguageIdentification :: (T.Transport t, T.Protocol p) => p t -> P.IO LanguageIdentification-read_LanguageIdentification iprot = to_LanguageIdentification <$> T.readVal iprot (T.T_STRUCT typemap_LanguageIdentification)-decode_LanguageIdentification :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> LanguageIdentification-decode_LanguageIdentification iprot bs = to_LanguageIdentification $ T.deserializeVal iprot (T.T_STRUCT typemap_LanguageIdentification) bs-typemap_LanguageIdentification :: T.TypeMap-typemap_LanguageIdentification = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("languageToProbabilityMap",(T.T_MAP T.T_STRING T.T_DOUBLE)))]-default_LanguageIdentification :: LanguageIdentification-default_LanguageIdentification = LanguageIdentification{- languageIdentification_uuid = Uuid_Types.default_UUID,- languageIdentification_metadata = Metadata_Types.default_AnnotationMetadata,- languageIdentification_languageToProbabilityMap = Map.empty}
− src/Learn_Consts.hs
@@ -1,45 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Learn_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---import Learn_Types
− src/Learn_Types.hs
@@ -1,132 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Learn_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Communication_Types---data AnnotationTask = AnnotationTask { annotationTask_type :: Services_Types.AnnotationTaskType- , annotationTask_language :: P.Maybe LT.Text- , annotationTask_unitType :: Services_Types.AnnotationUnitType- , annotationTask_units :: (Vector.Vector Services_Types.AnnotationUnitIdentifier)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AnnotationTask where- hashWithSalt salt record = salt `H.hashWithSalt` annotationTask_type record `H.hashWithSalt` annotationTask_language record `H.hashWithSalt` annotationTask_unitType record `H.hashWithSalt` annotationTask_units record -instance QC.Arbitrary AnnotationTask where - arbitrary = M.liftM AnnotationTask (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AnnotationTask = []- | P.otherwise = M.catMaybes- [ if obj == default_AnnotationTask{annotationTask_type = annotationTask_type obj} then P.Nothing else P.Just $ default_AnnotationTask{annotationTask_type = annotationTask_type obj}- , if obj == default_AnnotationTask{annotationTask_language = annotationTask_language obj} then P.Nothing else P.Just $ default_AnnotationTask{annotationTask_language = annotationTask_language obj}- , if obj == default_AnnotationTask{annotationTask_unitType = annotationTask_unitType obj} then P.Nothing else P.Just $ default_AnnotationTask{annotationTask_unitType = annotationTask_unitType obj}- , if obj == default_AnnotationTask{annotationTask_units = annotationTask_units obj} then P.Nothing else P.Just $ default_AnnotationTask{annotationTask_units = annotationTask_units obj}- ]-from_AnnotationTask :: AnnotationTask -> T.ThriftVal-from_AnnotationTask record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("type",T.TI32 $ P.fromIntegral $ P.fromEnum _v2))) $ annotationTask_type record- , (\_v2 -> (2, ("language",T.TString $ E.encodeUtf8 _v2))) <$> annotationTask_language record- , (\_v2 -> P.Just (3, ("unitType",T.TI32 $ P.fromIntegral $ P.fromEnum _v2))) $ annotationTask_unitType record- , (\_v2 -> P.Just (4, ("units",T.TList (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier) $ P.map (\_v4 -> Services_Types.from_AnnotationUnitIdentifier _v4) $ Vector.toList _v2))) $ annotationTask_units record- ]-write_AnnotationTask :: (T.Protocol p, T.Transport t) => p t -> AnnotationTask -> P.IO ()-write_AnnotationTask oprot record = T.writeVal oprot $ from_AnnotationTask record-encode_AnnotationTask :: (T.Protocol p, T.Transport t) => p t -> AnnotationTask -> LBS.ByteString-encode_AnnotationTask oprot record = T.serializeVal oprot $ from_AnnotationTask record-to_AnnotationTask :: T.ThriftVal -> AnnotationTask-to_AnnotationTask (T.TStruct fields) = AnnotationTask{- annotationTask_type = P.maybe (P.error "Missing required field: type") (\(_,_val6) -> (case _val6 of {T.TI32 _val7 -> P.toEnum $ P.fromIntegral _val7; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- annotationTask_language = P.maybe (P.Nothing) (\(_,_val6) -> P.Just (case _val6 of {T.TString _val8 -> E.decodeUtf8 _val8; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- annotationTask_unitType = P.maybe (P.error "Missing required field: unitType") (\(_,_val6) -> (case _val6 of {T.TI32 _val9 -> P.toEnum $ P.fromIntegral _val9; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- annotationTask_units = P.maybe (P.error "Missing required field: units") (\(_,_val6) -> (case _val6 of {T.TList _ _val10 -> (Vector.fromList $ P.map (\_v11 -> (case _v11 of {T.TStruct _val12 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val12)); _ -> P.error "wrong type"})) _val10); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_AnnotationTask _ = P.error "not a struct"-read_AnnotationTask :: (T.Transport t, T.Protocol p) => p t -> P.IO AnnotationTask-read_AnnotationTask iprot = to_AnnotationTask <$> T.readVal iprot (T.T_STRUCT typemap_AnnotationTask)-decode_AnnotationTask :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AnnotationTask-decode_AnnotationTask iprot bs = to_AnnotationTask $ T.deserializeVal iprot (T.T_STRUCT typemap_AnnotationTask) bs-typemap_AnnotationTask :: T.TypeMap-typemap_AnnotationTask = Map.fromList [(1,("type",T.T_I32)),(2,("language",T.T_STRING)),(3,("unitType",T.T_I32)),(4,("units",(T.T_LIST (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier))))]-default_AnnotationTask :: AnnotationTask-default_AnnotationTask = AnnotationTask{- annotationTask_type = (P.toEnum 0),- annotationTask_language = P.Nothing,- annotationTask_unitType = (P.toEnum 0),- annotationTask_units = Vector.empty}-data Annotation = Annotation { annotation_id :: Services_Types.AnnotationUnitIdentifier- , annotation_communication :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Annotation where- hashWithSalt salt record = salt `H.hashWithSalt` annotation_id record `H.hashWithSalt` annotation_communication record -instance QC.Arbitrary Annotation where - arbitrary = M.liftM Annotation (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Annotation = []- | P.otherwise = M.catMaybes- [ if obj == default_Annotation{annotation_id = annotation_id obj} then P.Nothing else P.Just $ default_Annotation{annotation_id = annotation_id obj}- , if obj == default_Annotation{annotation_communication = annotation_communication obj} then P.Nothing else P.Just $ default_Annotation{annotation_communication = annotation_communication obj}- ]-from_Annotation :: Annotation -> T.ThriftVal-from_Annotation record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v15 -> P.Just (1, ("id",Services_Types.from_AnnotationUnitIdentifier _v15))) $ annotation_id record- , (\_v15 -> P.Just (2, ("communication",Communication_Types.from_Communication _v15))) $ annotation_communication record- ]-write_Annotation :: (T.Protocol p, T.Transport t) => p t -> Annotation -> P.IO ()-write_Annotation oprot record = T.writeVal oprot $ from_Annotation record-encode_Annotation :: (T.Protocol p, T.Transport t) => p t -> Annotation -> LBS.ByteString-encode_Annotation oprot record = T.serializeVal oprot $ from_Annotation record-to_Annotation :: T.ThriftVal -> Annotation-to_Annotation (T.TStruct fields) = Annotation{- annotation_id = P.maybe (P.error "Missing required field: id") (\(_,_val17) -> (case _val17 of {T.TStruct _val18 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val18)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- annotation_communication = P.maybe (P.error "Missing required field: communication") (\(_,_val17) -> (case _val17 of {T.TStruct _val19 -> (Communication_Types.to_Communication (T.TStruct _val19)); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_Annotation _ = P.error "not a struct"-read_Annotation :: (T.Transport t, T.Protocol p) => p t -> P.IO Annotation-read_Annotation iprot = to_Annotation <$> T.readVal iprot (T.T_STRUCT typemap_Annotation)-decode_Annotation :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Annotation-decode_Annotation iprot bs = to_Annotation $ T.deserializeVal iprot (T.T_STRUCT typemap_Annotation) bs-typemap_Annotation :: T.TypeMap-typemap_Annotation = Map.fromList [(1,("id",(T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier))),(2,("communication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_Annotation :: Annotation-default_Annotation = Annotation{- annotation_id = Services_Types.default_AnnotationUnitIdentifier,- annotation_communication = Communication_Types.default_Communication}
− src/Linking_Consts.hs
@@ -1,44 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Linking_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Metadata_Types---import Linking_Types
− src/Linking_Types.hs
@@ -1,169 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Linking_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Metadata_Types---data LinkTarget = LinkTarget { linkTarget_confidence :: P.Maybe P.Double- , linkTarget_targetId :: P.Maybe Uuid_Types.UUID- , linkTarget_dbId :: P.Maybe LT.Text- , linkTarget_dbName :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable LinkTarget where- hashWithSalt salt record = salt `H.hashWithSalt` linkTarget_confidence record `H.hashWithSalt` linkTarget_targetId record `H.hashWithSalt` linkTarget_dbId record `H.hashWithSalt` linkTarget_dbName record -instance QC.Arbitrary LinkTarget where - arbitrary = M.liftM LinkTarget (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_LinkTarget = []- | P.otherwise = M.catMaybes- [ if obj == default_LinkTarget{linkTarget_confidence = linkTarget_confidence obj} then P.Nothing else P.Just $ default_LinkTarget{linkTarget_confidence = linkTarget_confidence obj}- , if obj == default_LinkTarget{linkTarget_targetId = linkTarget_targetId obj} then P.Nothing else P.Just $ default_LinkTarget{linkTarget_targetId = linkTarget_targetId obj}- , if obj == default_LinkTarget{linkTarget_dbId = linkTarget_dbId obj} then P.Nothing else P.Just $ default_LinkTarget{linkTarget_dbId = linkTarget_dbId obj}- , if obj == default_LinkTarget{linkTarget_dbName = linkTarget_dbName obj} then P.Nothing else P.Just $ default_LinkTarget{linkTarget_dbName = linkTarget_dbName obj}- ]-from_LinkTarget :: LinkTarget -> T.ThriftVal-from_LinkTarget record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("confidence",T.TDouble _v2))) <$> linkTarget_confidence record- , (\_v2 -> (2, ("targetId",Uuid_Types.from_UUID _v2))) <$> linkTarget_targetId record- , (\_v2 -> (3, ("dbId",T.TString $ E.encodeUtf8 _v2))) <$> linkTarget_dbId record- , (\_v2 -> (4, ("dbName",T.TString $ E.encodeUtf8 _v2))) <$> linkTarget_dbName record- ]-write_LinkTarget :: (T.Protocol p, T.Transport t) => p t -> LinkTarget -> P.IO ()-write_LinkTarget oprot record = T.writeVal oprot $ from_LinkTarget record-encode_LinkTarget :: (T.Protocol p, T.Transport t) => p t -> LinkTarget -> LBS.ByteString-encode_LinkTarget oprot record = T.serializeVal oprot $ from_LinkTarget record-to_LinkTarget :: T.ThriftVal -> LinkTarget-to_LinkTarget (T.TStruct fields) = LinkTarget{- linkTarget_confidence = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TDouble _val5 -> _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- linkTarget_targetId = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TStruct _val6 -> (Uuid_Types.to_UUID (T.TStruct _val6)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- linkTarget_dbId = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val7 -> E.decodeUtf8 _val7; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- linkTarget_dbName = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val8 -> E.decodeUtf8 _val8; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_LinkTarget _ = P.error "not a struct"-read_LinkTarget :: (T.Transport t, T.Protocol p) => p t -> P.IO LinkTarget-read_LinkTarget iprot = to_LinkTarget <$> T.readVal iprot (T.T_STRUCT typemap_LinkTarget)-decode_LinkTarget :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> LinkTarget-decode_LinkTarget iprot bs = to_LinkTarget $ T.deserializeVal iprot (T.T_STRUCT typemap_LinkTarget) bs-typemap_LinkTarget :: T.TypeMap-typemap_LinkTarget = Map.fromList [(1,("confidence",T.T_DOUBLE)),(2,("targetId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("dbId",T.T_STRING)),(4,("dbName",T.T_STRING))]-default_LinkTarget :: LinkTarget-default_LinkTarget = LinkTarget{- linkTarget_confidence = P.Nothing,- linkTarget_targetId = P.Nothing,- linkTarget_dbId = P.Nothing,- linkTarget_dbName = P.Nothing}-data Link = Link { link_sourceId :: Uuid_Types.UUID- , link_linkTargetList :: (Vector.Vector LinkTarget)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Link where- hashWithSalt salt record = salt `H.hashWithSalt` link_sourceId record `H.hashWithSalt` link_linkTargetList record -instance QC.Arbitrary Link where - arbitrary = M.liftM Link (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Link = []- | P.otherwise = M.catMaybes- [ if obj == default_Link{link_sourceId = link_sourceId obj} then P.Nothing else P.Just $ default_Link{link_sourceId = link_sourceId obj}- , if obj == default_Link{link_linkTargetList = link_linkTargetList obj} then P.Nothing else P.Just $ default_Link{link_linkTargetList = link_linkTargetList obj}- ]-from_Link :: Link -> T.ThriftVal-from_Link record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v11 -> P.Just (1, ("sourceId",Uuid_Types.from_UUID _v11))) $ link_sourceId record- , (\_v11 -> P.Just (2, ("linkTargetList",T.TList (T.T_STRUCT typemap_LinkTarget) $ P.map (\_v13 -> from_LinkTarget _v13) $ Vector.toList _v11))) $ link_linkTargetList record- ]-write_Link :: (T.Protocol p, T.Transport t) => p t -> Link -> P.IO ()-write_Link oprot record = T.writeVal oprot $ from_Link record-encode_Link :: (T.Protocol p, T.Transport t) => p t -> Link -> LBS.ByteString-encode_Link oprot record = T.serializeVal oprot $ from_Link record-to_Link :: T.ThriftVal -> Link-to_Link (T.TStruct fields) = Link{- link_sourceId = P.maybe (P.error "Missing required field: sourceId") (\(_,_val15) -> (case _val15 of {T.TStruct _val16 -> (Uuid_Types.to_UUID (T.TStruct _val16)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- link_linkTargetList = P.maybe (P.error "Missing required field: linkTargetList") (\(_,_val15) -> (case _val15 of {T.TList _ _val17 -> (Vector.fromList $ P.map (\_v18 -> (case _v18 of {T.TStruct _val19 -> (to_LinkTarget (T.TStruct _val19)); _ -> P.error "wrong type"})) _val17); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_Link _ = P.error "not a struct"-read_Link :: (T.Transport t, T.Protocol p) => p t -> P.IO Link-read_Link iprot = to_Link <$> T.readVal iprot (T.T_STRUCT typemap_Link)-decode_Link :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Link-decode_Link iprot bs = to_Link $ T.deserializeVal iprot (T.T_STRUCT typemap_Link) bs-typemap_Link :: T.TypeMap-typemap_Link = Map.fromList [(1,("sourceId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("linkTargetList",(T.T_LIST (T.T_STRUCT typemap_LinkTarget))))]-default_Link :: Link-default_Link = Link{- link_sourceId = Uuid_Types.default_UUID,- link_linkTargetList = Vector.empty}-data Linking = Linking { linking_metadata :: Metadata_Types.AnnotationMetadata- , linking_linkList :: (Vector.Vector Link)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Linking where- hashWithSalt salt record = salt `H.hashWithSalt` linking_metadata record `H.hashWithSalt` linking_linkList record -instance QC.Arbitrary Linking where - arbitrary = M.liftM Linking (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Linking = []- | P.otherwise = M.catMaybes- [ if obj == default_Linking{linking_metadata = linking_metadata obj} then P.Nothing else P.Just $ default_Linking{linking_metadata = linking_metadata obj}- , if obj == default_Linking{linking_linkList = linking_linkList obj} then P.Nothing else P.Just $ default_Linking{linking_linkList = linking_linkList obj}- ]-from_Linking :: Linking -> T.ThriftVal-from_Linking record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v22 -> P.Just (1, ("metadata",Metadata_Types.from_AnnotationMetadata _v22))) $ linking_metadata record- , (\_v22 -> P.Just (2, ("linkList",T.TList (T.T_STRUCT typemap_Link) $ P.map (\_v24 -> from_Link _v24) $ Vector.toList _v22))) $ linking_linkList record- ]-write_Linking :: (T.Protocol p, T.Transport t) => p t -> Linking -> P.IO ()-write_Linking oprot record = T.writeVal oprot $ from_Linking record-encode_Linking :: (T.Protocol p, T.Transport t) => p t -> Linking -> LBS.ByteString-encode_Linking oprot record = T.serializeVal oprot $ from_Linking record-to_Linking :: T.ThriftVal -> Linking-to_Linking (T.TStruct fields) = Linking{- linking_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val26) -> (case _val26 of {T.TStruct _val27 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val27)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- linking_linkList = P.maybe (P.error "Missing required field: linkList") (\(_,_val26) -> (case _val26 of {T.TList _ _val28 -> (Vector.fromList $ P.map (\_v29 -> (case _v29 of {T.TStruct _val30 -> (to_Link (T.TStruct _val30)); _ -> P.error "wrong type"})) _val28); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_Linking _ = P.error "not a struct"-read_Linking :: (T.Transport t, T.Protocol p) => p t -> P.IO Linking-read_Linking iprot = to_Linking <$> T.readVal iprot (T.T_STRUCT typemap_Linking)-decode_Linking :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Linking-decode_Linking iprot bs = to_Linking $ T.deserializeVal iprot (T.T_STRUCT typemap_Linking) bs-typemap_Linking :: T.TypeMap-typemap_Linking = Map.fromList [(1,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(2,("linkList",(T.T_LIST (T.T_STRUCT typemap_Link))))]-default_Linking :: Linking-default_Linking = Linking{- linking_metadata = Metadata_Types.default_AnnotationMetadata,- linking_linkList = Vector.empty}
− src/Metadata_Consts.hs
@@ -1,46 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Metadata_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Twitter_Types-import qualified Email_Types-import qualified Nitf_Types---import Metadata_Types
− src/Metadata_Types.hs
@@ -1,329 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Metadata_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types-import qualified Twitter_Types-import qualified Email_Types-import qualified Nitf_Types---data TheoryDependencies = TheoryDependencies { theoryDependencies_sectionTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_sentenceTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_tokenizationTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_posTagTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_nerTagTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_lemmaTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_langIdTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_parseTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_dependencyParseTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_tokenAnnotationTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_entityMentionSetTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_entitySetTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_situationMentionSetTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_situationSetTheoryList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , theoryDependencies_communicationsList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TheoryDependencies where- hashWithSalt salt record = salt `H.hashWithSalt` theoryDependencies_sectionTheoryList record `H.hashWithSalt` theoryDependencies_sentenceTheoryList record `H.hashWithSalt` theoryDependencies_tokenizationTheoryList record `H.hashWithSalt` theoryDependencies_posTagTheoryList record `H.hashWithSalt` theoryDependencies_nerTagTheoryList record `H.hashWithSalt` theoryDependencies_lemmaTheoryList record `H.hashWithSalt` theoryDependencies_langIdTheoryList record `H.hashWithSalt` theoryDependencies_parseTheoryList record `H.hashWithSalt` theoryDependencies_dependencyParseTheoryList record `H.hashWithSalt` theoryDependencies_tokenAnnotationTheoryList record `H.hashWithSalt` theoryDependencies_entityMentionSetTheoryList record `H.hashWithSalt` theoryDependencies_entitySetTheoryList record `H.hashWithSalt` theoryDependencies_situationMentionSetTheoryList record `H.hashWithSalt` theoryDependencies_situationSetTheoryList record `H.hashWithSalt` theoryDependencies_communicationsList record -instance QC.Arbitrary TheoryDependencies where - arbitrary = M.liftM TheoryDependencies (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TheoryDependencies = []- | P.otherwise = M.catMaybes- [ if obj == default_TheoryDependencies{theoryDependencies_sectionTheoryList = theoryDependencies_sectionTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_sectionTheoryList = theoryDependencies_sectionTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_sentenceTheoryList = theoryDependencies_sentenceTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_sentenceTheoryList = theoryDependencies_sentenceTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_tokenizationTheoryList = theoryDependencies_tokenizationTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_tokenizationTheoryList = theoryDependencies_tokenizationTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_posTagTheoryList = theoryDependencies_posTagTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_posTagTheoryList = theoryDependencies_posTagTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_nerTagTheoryList = theoryDependencies_nerTagTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_nerTagTheoryList = theoryDependencies_nerTagTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_lemmaTheoryList = theoryDependencies_lemmaTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_lemmaTheoryList = theoryDependencies_lemmaTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_langIdTheoryList = theoryDependencies_langIdTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_langIdTheoryList = theoryDependencies_langIdTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_parseTheoryList = theoryDependencies_parseTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_parseTheoryList = theoryDependencies_parseTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_dependencyParseTheoryList = theoryDependencies_dependencyParseTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_dependencyParseTheoryList = theoryDependencies_dependencyParseTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_tokenAnnotationTheoryList = theoryDependencies_tokenAnnotationTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_tokenAnnotationTheoryList = theoryDependencies_tokenAnnotationTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_entityMentionSetTheoryList = theoryDependencies_entityMentionSetTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_entityMentionSetTheoryList = theoryDependencies_entityMentionSetTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_entitySetTheoryList = theoryDependencies_entitySetTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_entitySetTheoryList = theoryDependencies_entitySetTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_situationMentionSetTheoryList = theoryDependencies_situationMentionSetTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_situationMentionSetTheoryList = theoryDependencies_situationMentionSetTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_situationSetTheoryList = theoryDependencies_situationSetTheoryList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_situationSetTheoryList = theoryDependencies_situationSetTheoryList obj}- , if obj == default_TheoryDependencies{theoryDependencies_communicationsList = theoryDependencies_communicationsList obj} then P.Nothing else P.Just $ default_TheoryDependencies{theoryDependencies_communicationsList = theoryDependencies_communicationsList obj}- ]-from_TheoryDependencies :: TheoryDependencies -> T.ThriftVal-from_TheoryDependencies record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("sectionTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v4 -> Uuid_Types.from_UUID _v4) $ Vector.toList _v2))) <$> theoryDependencies_sectionTheoryList record- , (\_v2 -> (2, ("sentenceTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v6 -> Uuid_Types.from_UUID _v6) $ Vector.toList _v2))) <$> theoryDependencies_sentenceTheoryList record- , (\_v2 -> (3, ("tokenizationTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v8 -> Uuid_Types.from_UUID _v8) $ Vector.toList _v2))) <$> theoryDependencies_tokenizationTheoryList record- , (\_v2 -> (4, ("posTagTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v10 -> Uuid_Types.from_UUID _v10) $ Vector.toList _v2))) <$> theoryDependencies_posTagTheoryList record- , (\_v2 -> (5, ("nerTagTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v12 -> Uuid_Types.from_UUID _v12) $ Vector.toList _v2))) <$> theoryDependencies_nerTagTheoryList record- , (\_v2 -> (6, ("lemmaTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v14 -> Uuid_Types.from_UUID _v14) $ Vector.toList _v2))) <$> theoryDependencies_lemmaTheoryList record- , (\_v2 -> (7, ("langIdTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v16 -> Uuid_Types.from_UUID _v16) $ Vector.toList _v2))) <$> theoryDependencies_langIdTheoryList record- , (\_v2 -> (8, ("parseTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v18 -> Uuid_Types.from_UUID _v18) $ Vector.toList _v2))) <$> theoryDependencies_parseTheoryList record- , (\_v2 -> (9, ("dependencyParseTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v20 -> Uuid_Types.from_UUID _v20) $ Vector.toList _v2))) <$> theoryDependencies_dependencyParseTheoryList record- , (\_v2 -> (10, ("tokenAnnotationTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v22 -> Uuid_Types.from_UUID _v22) $ Vector.toList _v2))) <$> theoryDependencies_tokenAnnotationTheoryList record- , (\_v2 -> (11, ("entityMentionSetTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v24 -> Uuid_Types.from_UUID _v24) $ Vector.toList _v2))) <$> theoryDependencies_entityMentionSetTheoryList record- , (\_v2 -> (12, ("entitySetTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v26 -> Uuid_Types.from_UUID _v26) $ Vector.toList _v2))) <$> theoryDependencies_entitySetTheoryList record- , (\_v2 -> (13, ("situationMentionSetTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v28 -> Uuid_Types.from_UUID _v28) $ Vector.toList _v2))) <$> theoryDependencies_situationMentionSetTheoryList record- , (\_v2 -> (14, ("situationSetTheoryList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v30 -> Uuid_Types.from_UUID _v30) $ Vector.toList _v2))) <$> theoryDependencies_situationSetTheoryList record- , (\_v2 -> (15, ("communicationsList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v32 -> Uuid_Types.from_UUID _v32) $ Vector.toList _v2))) <$> theoryDependencies_communicationsList record- ]-write_TheoryDependencies :: (T.Protocol p, T.Transport t) => p t -> TheoryDependencies -> P.IO ()-write_TheoryDependencies oprot record = T.writeVal oprot $ from_TheoryDependencies record-encode_TheoryDependencies :: (T.Protocol p, T.Transport t) => p t -> TheoryDependencies -> LBS.ByteString-encode_TheoryDependencies oprot record = T.serializeVal oprot $ from_TheoryDependencies record-to_TheoryDependencies :: T.ThriftVal -> TheoryDependencies-to_TheoryDependencies (T.TStruct fields) = TheoryDependencies{- theoryDependencies_sectionTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val35 -> (Vector.fromList $ P.map (\_v36 -> (case _v36 of {T.TStruct _val37 -> (Uuid_Types.to_UUID (T.TStruct _val37)); _ -> P.error "wrong type"})) _val35); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- theoryDependencies_sentenceTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val38 -> (Vector.fromList $ P.map (\_v39 -> (case _v39 of {T.TStruct _val40 -> (Uuid_Types.to_UUID (T.TStruct _val40)); _ -> P.error "wrong type"})) _val38); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- theoryDependencies_tokenizationTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val41 -> (Vector.fromList $ P.map (\_v42 -> (case _v42 of {T.TStruct _val43 -> (Uuid_Types.to_UUID (T.TStruct _val43)); _ -> P.error "wrong type"})) _val41); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- theoryDependencies_posTagTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val44 -> (Vector.fromList $ P.map (\_v45 -> (case _v45 of {T.TStruct _val46 -> (Uuid_Types.to_UUID (T.TStruct _val46)); _ -> P.error "wrong type"})) _val44); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- theoryDependencies_nerTagTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val47 -> (Vector.fromList $ P.map (\_v48 -> (case _v48 of {T.TStruct _val49 -> (Uuid_Types.to_UUID (T.TStruct _val49)); _ -> P.error "wrong type"})) _val47); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- theoryDependencies_lemmaTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val50 -> (Vector.fromList $ P.map (\_v51 -> (case _v51 of {T.TStruct _val52 -> (Uuid_Types.to_UUID (T.TStruct _val52)); _ -> P.error "wrong type"})) _val50); _ -> P.error "wrong type"})) (Map.lookup (6) fields),- theoryDependencies_langIdTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val53 -> (Vector.fromList $ P.map (\_v54 -> (case _v54 of {T.TStruct _val55 -> (Uuid_Types.to_UUID (T.TStruct _val55)); _ -> P.error "wrong type"})) _val53); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- theoryDependencies_parseTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val56 -> (Vector.fromList $ P.map (\_v57 -> (case _v57 of {T.TStruct _val58 -> (Uuid_Types.to_UUID (T.TStruct _val58)); _ -> P.error "wrong type"})) _val56); _ -> P.error "wrong type"})) (Map.lookup (8) fields),- theoryDependencies_dependencyParseTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val59 -> (Vector.fromList $ P.map (\_v60 -> (case _v60 of {T.TStruct _val61 -> (Uuid_Types.to_UUID (T.TStruct _val61)); _ -> P.error "wrong type"})) _val59); _ -> P.error "wrong type"})) (Map.lookup (9) fields),- theoryDependencies_tokenAnnotationTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val62 -> (Vector.fromList $ P.map (\_v63 -> (case _v63 of {T.TStruct _val64 -> (Uuid_Types.to_UUID (T.TStruct _val64)); _ -> P.error "wrong type"})) _val62); _ -> P.error "wrong type"})) (Map.lookup (10) fields),- theoryDependencies_entityMentionSetTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val65 -> (Vector.fromList $ P.map (\_v66 -> (case _v66 of {T.TStruct _val67 -> (Uuid_Types.to_UUID (T.TStruct _val67)); _ -> P.error "wrong type"})) _val65); _ -> P.error "wrong type"})) (Map.lookup (11) fields),- theoryDependencies_entitySetTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val68 -> (Vector.fromList $ P.map (\_v69 -> (case _v69 of {T.TStruct _val70 -> (Uuid_Types.to_UUID (T.TStruct _val70)); _ -> P.error "wrong type"})) _val68); _ -> P.error "wrong type"})) (Map.lookup (12) fields),- theoryDependencies_situationMentionSetTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val71 -> (Vector.fromList $ P.map (\_v72 -> (case _v72 of {T.TStruct _val73 -> (Uuid_Types.to_UUID (T.TStruct _val73)); _ -> P.error "wrong type"})) _val71); _ -> P.error "wrong type"})) (Map.lookup (13) fields),- theoryDependencies_situationSetTheoryList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val74 -> (Vector.fromList $ P.map (\_v75 -> (case _v75 of {T.TStruct _val76 -> (Uuid_Types.to_UUID (T.TStruct _val76)); _ -> P.error "wrong type"})) _val74); _ -> P.error "wrong type"})) (Map.lookup (14) fields),- theoryDependencies_communicationsList = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TList _ _val77 -> (Vector.fromList $ P.map (\_v78 -> (case _v78 of {T.TStruct _val79 -> (Uuid_Types.to_UUID (T.TStruct _val79)); _ -> P.error "wrong type"})) _val77); _ -> P.error "wrong type"})) (Map.lookup (15) fields)- }-to_TheoryDependencies _ = P.error "not a struct"-read_TheoryDependencies :: (T.Transport t, T.Protocol p) => p t -> P.IO TheoryDependencies-read_TheoryDependencies iprot = to_TheoryDependencies <$> T.readVal iprot (T.T_STRUCT typemap_TheoryDependencies)-decode_TheoryDependencies :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TheoryDependencies-decode_TheoryDependencies iprot bs = to_TheoryDependencies $ T.deserializeVal iprot (T.T_STRUCT typemap_TheoryDependencies) bs-typemap_TheoryDependencies :: T.TypeMap-typemap_TheoryDependencies = Map.fromList [(1,("sectionTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(2,("sentenceTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(3,("tokenizationTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(4,("posTagTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(5,("nerTagTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(6,("lemmaTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(7,("langIdTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(8,("parseTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(9,("dependencyParseTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(10,("tokenAnnotationTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(11,("entityMentionSetTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(12,("entitySetTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(13,("situationMentionSetTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(14,("situationSetTheoryList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(15,("communicationsList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID))))]-default_TheoryDependencies :: TheoryDependencies-default_TheoryDependencies = TheoryDependencies{- theoryDependencies_sectionTheoryList = P.Nothing,- theoryDependencies_sentenceTheoryList = P.Nothing,- theoryDependencies_tokenizationTheoryList = P.Nothing,- theoryDependencies_posTagTheoryList = P.Nothing,- theoryDependencies_nerTagTheoryList = P.Nothing,- theoryDependencies_lemmaTheoryList = P.Nothing,- theoryDependencies_langIdTheoryList = P.Nothing,- theoryDependencies_parseTheoryList = P.Nothing,- theoryDependencies_dependencyParseTheoryList = P.Nothing,- theoryDependencies_tokenAnnotationTheoryList = P.Nothing,- theoryDependencies_entityMentionSetTheoryList = P.Nothing,- theoryDependencies_entitySetTheoryList = P.Nothing,- theoryDependencies_situationMentionSetTheoryList = P.Nothing,- theoryDependencies_situationSetTheoryList = P.Nothing,- theoryDependencies_communicationsList = P.Nothing}-data Digest = Digest { digest_bytesValue :: P.Maybe LBS.ByteString- , digest_int64Value :: P.Maybe I.Int64- , digest_doubleValue :: P.Maybe P.Double- , digest_stringValue :: P.Maybe LT.Text- , digest_int64List :: P.Maybe (Vector.Vector I.Int64)- , digest_doubleList :: P.Maybe (Vector.Vector P.Double)- , digest_stringList :: P.Maybe (Vector.Vector LT.Text)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Digest where- hashWithSalt salt record = salt `H.hashWithSalt` digest_bytesValue record `H.hashWithSalt` digest_int64Value record `H.hashWithSalt` digest_doubleValue record `H.hashWithSalt` digest_stringValue record `H.hashWithSalt` digest_int64List record `H.hashWithSalt` digest_doubleList record `H.hashWithSalt` digest_stringList record -instance QC.Arbitrary Digest where - arbitrary = M.liftM Digest (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Digest = []- | P.otherwise = M.catMaybes- [ if obj == default_Digest{digest_bytesValue = digest_bytesValue obj} then P.Nothing else P.Just $ default_Digest{digest_bytesValue = digest_bytesValue obj}- , if obj == default_Digest{digest_int64Value = digest_int64Value obj} then P.Nothing else P.Just $ default_Digest{digest_int64Value = digest_int64Value obj}- , if obj == default_Digest{digest_doubleValue = digest_doubleValue obj} then P.Nothing else P.Just $ default_Digest{digest_doubleValue = digest_doubleValue obj}- , if obj == default_Digest{digest_stringValue = digest_stringValue obj} then P.Nothing else P.Just $ default_Digest{digest_stringValue = digest_stringValue obj}- , if obj == default_Digest{digest_int64List = digest_int64List obj} then P.Nothing else P.Just $ default_Digest{digest_int64List = digest_int64List obj}- , if obj == default_Digest{digest_doubleList = digest_doubleList obj} then P.Nothing else P.Just $ default_Digest{digest_doubleList = digest_doubleList obj}- , if obj == default_Digest{digest_stringList = digest_stringList obj} then P.Nothing else P.Just $ default_Digest{digest_stringList = digest_stringList obj}- ]-from_Digest :: Digest -> T.ThriftVal-from_Digest record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v82 -> (1, ("bytesValue",T.TBinary _v82))) <$> digest_bytesValue record- , (\_v82 -> (2, ("int64Value",T.TI64 _v82))) <$> digest_int64Value record- , (\_v82 -> (3, ("doubleValue",T.TDouble _v82))) <$> digest_doubleValue record- , (\_v82 -> (4, ("stringValue",T.TString $ E.encodeUtf8 _v82))) <$> digest_stringValue record- , (\_v82 -> (5, ("int64List",T.TList T.T_I64 $ P.map (\_v84 -> T.TI64 _v84) $ Vector.toList _v82))) <$> digest_int64List record- , (\_v82 -> (6, ("doubleList",T.TList T.T_DOUBLE $ P.map (\_v86 -> T.TDouble _v86) $ Vector.toList _v82))) <$> digest_doubleList record- , (\_v82 -> (7, ("stringList",T.TList T.T_STRING $ P.map (\_v88 -> T.TString $ E.encodeUtf8 _v88) $ Vector.toList _v82))) <$> digest_stringList record- ]-write_Digest :: (T.Protocol p, T.Transport t) => p t -> Digest -> P.IO ()-write_Digest oprot record = T.writeVal oprot $ from_Digest record-encode_Digest :: (T.Protocol p, T.Transport t) => p t -> Digest -> LBS.ByteString-encode_Digest oprot record = T.serializeVal oprot $ from_Digest record-to_Digest :: T.ThriftVal -> Digest-to_Digest (T.TStruct fields) = Digest{- digest_bytesValue = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TBinary _val91 -> _val91; T.TString _val91 -> _val91; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- digest_int64Value = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TI64 _val92 -> _val92; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- digest_doubleValue = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TDouble _val93 -> _val93; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- digest_stringValue = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TString _val94 -> E.decodeUtf8 _val94; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- digest_int64List = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TList _ _val95 -> (Vector.fromList $ P.map (\_v96 -> (case _v96 of {T.TI64 _val97 -> _val97; _ -> P.error "wrong type"})) _val95); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- digest_doubleList = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TList _ _val98 -> (Vector.fromList $ P.map (\_v99 -> (case _v99 of {T.TDouble _val100 -> _val100; _ -> P.error "wrong type"})) _val98); _ -> P.error "wrong type"})) (Map.lookup (6) fields),- digest_stringList = P.maybe (P.Nothing) (\(_,_val90) -> P.Just (case _val90 of {T.TList _ _val101 -> (Vector.fromList $ P.map (\_v102 -> (case _v102 of {T.TString _val103 -> E.decodeUtf8 _val103; _ -> P.error "wrong type"})) _val101); _ -> P.error "wrong type"})) (Map.lookup (7) fields)- }-to_Digest _ = P.error "not a struct"-read_Digest :: (T.Transport t, T.Protocol p) => p t -> P.IO Digest-read_Digest iprot = to_Digest <$> T.readVal iprot (T.T_STRUCT typemap_Digest)-decode_Digest :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Digest-decode_Digest iprot bs = to_Digest $ T.deserializeVal iprot (T.T_STRUCT typemap_Digest) bs-typemap_Digest :: T.TypeMap-typemap_Digest = Map.fromList [(1,("bytesValue",T.T_BINARY)),(2,("int64Value",T.T_I64)),(3,("doubleValue",T.T_DOUBLE)),(4,("stringValue",T.T_STRING)),(5,("int64List",(T.T_LIST T.T_I64))),(6,("doubleList",(T.T_LIST T.T_DOUBLE))),(7,("stringList",(T.T_LIST T.T_STRING)))]-default_Digest :: Digest-default_Digest = Digest{- digest_bytesValue = P.Nothing,- digest_int64Value = P.Nothing,- digest_doubleValue = P.Nothing,- digest_stringValue = P.Nothing,- digest_int64List = P.Nothing,- digest_doubleList = P.Nothing,- digest_stringList = P.Nothing}-data AnnotationMetadata = AnnotationMetadata { annotationMetadata_tool :: LT.Text- , annotationMetadata_timestamp :: I.Int64- , annotationMetadata_digest :: P.Maybe Digest- , annotationMetadata_dependencies :: P.Maybe TheoryDependencies- , annotationMetadata_kBest :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AnnotationMetadata where- hashWithSalt salt record = salt `H.hashWithSalt` annotationMetadata_tool record `H.hashWithSalt` annotationMetadata_timestamp record `H.hashWithSalt` annotationMetadata_digest record `H.hashWithSalt` annotationMetadata_dependencies record `H.hashWithSalt` annotationMetadata_kBest record -instance QC.Arbitrary AnnotationMetadata where - arbitrary = M.liftM AnnotationMetadata (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AnnotationMetadata = []- | P.otherwise = M.catMaybes- [ if obj == default_AnnotationMetadata{annotationMetadata_tool = annotationMetadata_tool obj} then P.Nothing else P.Just $ default_AnnotationMetadata{annotationMetadata_tool = annotationMetadata_tool obj}- , if obj == default_AnnotationMetadata{annotationMetadata_timestamp = annotationMetadata_timestamp obj} then P.Nothing else P.Just $ default_AnnotationMetadata{annotationMetadata_timestamp = annotationMetadata_timestamp obj}- , if obj == default_AnnotationMetadata{annotationMetadata_digest = annotationMetadata_digest obj} then P.Nothing else P.Just $ default_AnnotationMetadata{annotationMetadata_digest = annotationMetadata_digest obj}- , if obj == default_AnnotationMetadata{annotationMetadata_dependencies = annotationMetadata_dependencies obj} then P.Nothing else P.Just $ default_AnnotationMetadata{annotationMetadata_dependencies = annotationMetadata_dependencies obj}- , if obj == default_AnnotationMetadata{annotationMetadata_kBest = annotationMetadata_kBest obj} then P.Nothing else P.Just $ default_AnnotationMetadata{annotationMetadata_kBest = annotationMetadata_kBest obj}- ]-from_AnnotationMetadata :: AnnotationMetadata -> T.ThriftVal-from_AnnotationMetadata record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v106 -> P.Just (1, ("tool",T.TString $ E.encodeUtf8 _v106))) $ annotationMetadata_tool record- , (\_v106 -> P.Just (2, ("timestamp",T.TI64 _v106))) $ annotationMetadata_timestamp record- , (\_v106 -> (4, ("digest",from_Digest _v106))) <$> annotationMetadata_digest record- , (\_v106 -> (5, ("dependencies",from_TheoryDependencies _v106))) <$> annotationMetadata_dependencies record- , (\_v106 -> P.Just (6, ("kBest",T.TI32 _v106))) $ annotationMetadata_kBest record- ]-write_AnnotationMetadata :: (T.Protocol p, T.Transport t) => p t -> AnnotationMetadata -> P.IO ()-write_AnnotationMetadata oprot record = T.writeVal oprot $ from_AnnotationMetadata record-encode_AnnotationMetadata :: (T.Protocol p, T.Transport t) => p t -> AnnotationMetadata -> LBS.ByteString-encode_AnnotationMetadata oprot record = T.serializeVal oprot $ from_AnnotationMetadata record-to_AnnotationMetadata :: T.ThriftVal -> AnnotationMetadata-to_AnnotationMetadata (T.TStruct fields) = AnnotationMetadata{- annotationMetadata_tool = P.maybe (P.error "Missing required field: tool") (\(_,_val108) -> (case _val108 of {T.TString _val109 -> E.decodeUtf8 _val109; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- annotationMetadata_timestamp = P.maybe (P.error "Missing required field: timestamp") (\(_,_val108) -> (case _val108 of {T.TI64 _val110 -> _val110; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- annotationMetadata_digest = P.maybe (P.Nothing) (\(_,_val108) -> P.Just (case _val108 of {T.TStruct _val111 -> (to_Digest (T.TStruct _val111)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- annotationMetadata_dependencies = P.maybe (P.Nothing) (\(_,_val108) -> P.Just (case _val108 of {T.TStruct _val112 -> (to_TheoryDependencies (T.TStruct _val112)); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- annotationMetadata_kBest = P.maybe (P.error "Missing required field: kBest") (\(_,_val108) -> (case _val108 of {T.TI32 _val113 -> _val113; _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_AnnotationMetadata _ = P.error "not a struct"-read_AnnotationMetadata :: (T.Transport t, T.Protocol p) => p t -> P.IO AnnotationMetadata-read_AnnotationMetadata iprot = to_AnnotationMetadata <$> T.readVal iprot (T.T_STRUCT typemap_AnnotationMetadata)-decode_AnnotationMetadata :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AnnotationMetadata-decode_AnnotationMetadata iprot bs = to_AnnotationMetadata $ T.deserializeVal iprot (T.T_STRUCT typemap_AnnotationMetadata) bs-typemap_AnnotationMetadata :: T.TypeMap-typemap_AnnotationMetadata = Map.fromList [(1,("tool",T.T_STRING)),(2,("timestamp",T.T_I64)),(4,("digest",(T.T_STRUCT typemap_Digest))),(5,("dependencies",(T.T_STRUCT typemap_TheoryDependencies))),(6,("kBest",T.T_I32))]-default_AnnotationMetadata :: AnnotationMetadata-default_AnnotationMetadata = AnnotationMetadata{- annotationMetadata_tool = "",- annotationMetadata_timestamp = 0,- annotationMetadata_digest = P.Nothing,- annotationMetadata_dependencies = P.Nothing,- annotationMetadata_kBest = (1)}-data CommunicationMetadata = CommunicationMetadata { communicationMetadata_tweetInfo :: P.Maybe Twitter_Types.TweetInfo- , communicationMetadata_emailInfo :: P.Maybe Email_Types.EmailCommunicationInfo- , communicationMetadata_nitfInfo :: P.Maybe Nitf_Types.NITFInfo- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable CommunicationMetadata where- hashWithSalt salt record = salt `H.hashWithSalt` communicationMetadata_tweetInfo record `H.hashWithSalt` communicationMetadata_emailInfo record `H.hashWithSalt` communicationMetadata_nitfInfo record -instance QC.Arbitrary CommunicationMetadata where - arbitrary = M.liftM CommunicationMetadata (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_CommunicationMetadata = []- | P.otherwise = M.catMaybes- [ if obj == default_CommunicationMetadata{communicationMetadata_tweetInfo = communicationMetadata_tweetInfo obj} then P.Nothing else P.Just $ default_CommunicationMetadata{communicationMetadata_tweetInfo = communicationMetadata_tweetInfo obj}- , if obj == default_CommunicationMetadata{communicationMetadata_emailInfo = communicationMetadata_emailInfo obj} then P.Nothing else P.Just $ default_CommunicationMetadata{communicationMetadata_emailInfo = communicationMetadata_emailInfo obj}- , if obj == default_CommunicationMetadata{communicationMetadata_nitfInfo = communicationMetadata_nitfInfo obj} then P.Nothing else P.Just $ default_CommunicationMetadata{communicationMetadata_nitfInfo = communicationMetadata_nitfInfo obj}- ]-from_CommunicationMetadata :: CommunicationMetadata -> T.ThriftVal-from_CommunicationMetadata record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v116 -> (1, ("tweetInfo",Twitter_Types.from_TweetInfo _v116))) <$> communicationMetadata_tweetInfo record- , (\_v116 -> (2, ("emailInfo",Email_Types.from_EmailCommunicationInfo _v116))) <$> communicationMetadata_emailInfo record- , (\_v116 -> (3, ("nitfInfo",Nitf_Types.from_NITFInfo _v116))) <$> communicationMetadata_nitfInfo record- ]-write_CommunicationMetadata :: (T.Protocol p, T.Transport t) => p t -> CommunicationMetadata -> P.IO ()-write_CommunicationMetadata oprot record = T.writeVal oprot $ from_CommunicationMetadata record-encode_CommunicationMetadata :: (T.Protocol p, T.Transport t) => p t -> CommunicationMetadata -> LBS.ByteString-encode_CommunicationMetadata oprot record = T.serializeVal oprot $ from_CommunicationMetadata record-to_CommunicationMetadata :: T.ThriftVal -> CommunicationMetadata-to_CommunicationMetadata (T.TStruct fields) = CommunicationMetadata{- communicationMetadata_tweetInfo = P.maybe (P.Nothing) (\(_,_val118) -> P.Just (case _val118 of {T.TStruct _val119 -> (Twitter_Types.to_TweetInfo (T.TStruct _val119)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- communicationMetadata_emailInfo = P.maybe (P.Nothing) (\(_,_val118) -> P.Just (case _val118 of {T.TStruct _val120 -> (Email_Types.to_EmailCommunicationInfo (T.TStruct _val120)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- communicationMetadata_nitfInfo = P.maybe (P.Nothing) (\(_,_val118) -> P.Just (case _val118 of {T.TStruct _val121 -> (Nitf_Types.to_NITFInfo (T.TStruct _val121)); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_CommunicationMetadata _ = P.error "not a struct"-read_CommunicationMetadata :: (T.Transport t, T.Protocol p) => p t -> P.IO CommunicationMetadata-read_CommunicationMetadata iprot = to_CommunicationMetadata <$> T.readVal iprot (T.T_STRUCT typemap_CommunicationMetadata)-decode_CommunicationMetadata :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> CommunicationMetadata-decode_CommunicationMetadata iprot bs = to_CommunicationMetadata $ T.deserializeVal iprot (T.T_STRUCT typemap_CommunicationMetadata) bs-typemap_CommunicationMetadata :: T.TypeMap-typemap_CommunicationMetadata = Map.fromList [(1,("tweetInfo",(T.T_STRUCT Twitter_Types.typemap_TweetInfo))),(2,("emailInfo",(T.T_STRUCT Email_Types.typemap_EmailCommunicationInfo))),(3,("nitfInfo",(T.T_STRUCT Nitf_Types.typemap_NITFInfo)))]-default_CommunicationMetadata :: CommunicationMetadata-default_CommunicationMetadata = CommunicationMetadata{- communicationMetadata_tweetInfo = P.Nothing,- communicationMetadata_emailInfo = P.Nothing,- communicationMetadata_nitfInfo = P.Nothing}
− src/Nitf_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Nitf_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Nitf_Types
− src/Nitf_Types.hs
@@ -1,330 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Nitf_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data NITFInfo = NITFInfo { nITFInfo_alternateURL :: P.Maybe LT.Text- , nITFInfo_articleAbstract :: P.Maybe LT.Text- , nITFInfo_authorBiography :: P.Maybe LT.Text- , nITFInfo_banner :: P.Maybe LT.Text- , nITFInfo_biographicalCategoryList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_columnName :: P.Maybe LT.Text- , nITFInfo_columnNumber :: P.Maybe I.Int32- , nITFInfo_correctionDate :: P.Maybe I.Int64- , nITFInfo_correctionText :: P.Maybe LT.Text- , nITFInfo_credit :: P.Maybe LT.Text- , nITFInfo_dayOfWeek :: P.Maybe LT.Text- , nITFInfo_descriptorList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_featurePage :: P.Maybe LT.Text- , nITFInfo_generalOnlineDescriptorList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_guid :: P.Maybe I.Int32- , nITFInfo_kicker :: P.Maybe LT.Text- , nITFInfo_leadParagraphList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_locationList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_nameList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_newsDesk :: P.Maybe LT.Text- , nITFInfo_normalizedByline :: P.Maybe LT.Text- , nITFInfo_onlineDescriptorList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_onlineHeadline :: P.Maybe LT.Text- , nITFInfo_onlineLeadParagraph :: P.Maybe LT.Text- , nITFInfo_onlineLocationList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_onlineOrganizationList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_onlinePeople :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_onlineSectionList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_onlineTitleList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_organizationList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_page :: P.Maybe I.Int32- , nITFInfo_peopleList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_publicationDate :: P.Maybe I.Int64- , nITFInfo_publicationDayOfMonth :: P.Maybe I.Int32- , nITFInfo_publicationMonth :: P.Maybe I.Int32- , nITFInfo_publicationYear :: P.Maybe I.Int32- , nITFInfo_section :: P.Maybe LT.Text- , nITFInfo_seriesName :: P.Maybe LT.Text- , nITFInfo_slug :: P.Maybe LT.Text- , nITFInfo_taxonomicClassifierList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_titleList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_typesOfMaterialList :: P.Maybe (Vector.Vector LT.Text)- , nITFInfo_url :: P.Maybe LT.Text- , nITFInfo_wordCount :: P.Maybe I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable NITFInfo where- hashWithSalt salt record = salt `H.hashWithSalt` nITFInfo_alternateURL record `H.hashWithSalt` nITFInfo_articleAbstract record `H.hashWithSalt` nITFInfo_authorBiography record `H.hashWithSalt` nITFInfo_banner record `H.hashWithSalt` nITFInfo_biographicalCategoryList record `H.hashWithSalt` nITFInfo_columnName record `H.hashWithSalt` nITFInfo_columnNumber record `H.hashWithSalt` nITFInfo_correctionDate record `H.hashWithSalt` nITFInfo_correctionText record `H.hashWithSalt` nITFInfo_credit record `H.hashWithSalt` nITFInfo_dayOfWeek record `H.hashWithSalt` nITFInfo_descriptorList record `H.hashWithSalt` nITFInfo_featurePage record `H.hashWithSalt` nITFInfo_generalOnlineDescriptorList record `H.hashWithSalt` nITFInfo_guid record `H.hashWithSalt` nITFInfo_kicker record `H.hashWithSalt` nITFInfo_leadParagraphList record `H.hashWithSalt` nITFInfo_locationList record `H.hashWithSalt` nITFInfo_nameList record `H.hashWithSalt` nITFInfo_newsDesk record `H.hashWithSalt` nITFInfo_normalizedByline record `H.hashWithSalt` nITFInfo_onlineDescriptorList record `H.hashWithSalt` nITFInfo_onlineHeadline record `H.hashWithSalt` nITFInfo_onlineLeadParagraph record `H.hashWithSalt` nITFInfo_onlineLocationList record `H.hashWithSalt` nITFInfo_onlineOrganizationList record `H.hashWithSalt` nITFInfo_onlinePeople record `H.hashWithSalt` nITFInfo_onlineSectionList record `H.hashWithSalt` nITFInfo_onlineTitleList record `H.hashWithSalt` nITFInfo_organizationList record `H.hashWithSalt` nITFInfo_page record `H.hashWithSalt` nITFInfo_peopleList record `H.hashWithSalt` nITFInfo_publicationDate record `H.hashWithSalt` nITFInfo_publicationDayOfMonth record `H.hashWithSalt` nITFInfo_publicationMonth record `H.hashWithSalt` nITFInfo_publicationYear record `H.hashWithSalt` nITFInfo_section record `H.hashWithSalt` nITFInfo_seriesName record `H.hashWithSalt` nITFInfo_slug record `H.hashWithSalt` nITFInfo_taxonomicClassifierList record `H.hashWithSalt` nITFInfo_titleList record `H.hashWithSalt` nITFInfo_typesOfMaterialList record `H.hashWithSalt` nITFInfo_url record `H.hashWithSalt` nITFInfo_wordCount record -instance QC.Arbitrary NITFInfo where - arbitrary = M.liftM NITFInfo (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_NITFInfo = []- | P.otherwise = M.catMaybes- [ if obj == default_NITFInfo{nITFInfo_alternateURL = nITFInfo_alternateURL obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_alternateURL = nITFInfo_alternateURL obj}- , if obj == default_NITFInfo{nITFInfo_articleAbstract = nITFInfo_articleAbstract obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_articleAbstract = nITFInfo_articleAbstract obj}- , if obj == default_NITFInfo{nITFInfo_authorBiography = nITFInfo_authorBiography obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_authorBiography = nITFInfo_authorBiography obj}- , if obj == default_NITFInfo{nITFInfo_banner = nITFInfo_banner obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_banner = nITFInfo_banner obj}- , if obj == default_NITFInfo{nITFInfo_biographicalCategoryList = nITFInfo_biographicalCategoryList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_biographicalCategoryList = nITFInfo_biographicalCategoryList obj}- , if obj == default_NITFInfo{nITFInfo_columnName = nITFInfo_columnName obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_columnName = nITFInfo_columnName obj}- , if obj == default_NITFInfo{nITFInfo_columnNumber = nITFInfo_columnNumber obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_columnNumber = nITFInfo_columnNumber obj}- , if obj == default_NITFInfo{nITFInfo_correctionDate = nITFInfo_correctionDate obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_correctionDate = nITFInfo_correctionDate obj}- , if obj == default_NITFInfo{nITFInfo_correctionText = nITFInfo_correctionText obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_correctionText = nITFInfo_correctionText obj}- , if obj == default_NITFInfo{nITFInfo_credit = nITFInfo_credit obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_credit = nITFInfo_credit obj}- , if obj == default_NITFInfo{nITFInfo_dayOfWeek = nITFInfo_dayOfWeek obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_dayOfWeek = nITFInfo_dayOfWeek obj}- , if obj == default_NITFInfo{nITFInfo_descriptorList = nITFInfo_descriptorList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_descriptorList = nITFInfo_descriptorList obj}- , if obj == default_NITFInfo{nITFInfo_featurePage = nITFInfo_featurePage obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_featurePage = nITFInfo_featurePage obj}- , if obj == default_NITFInfo{nITFInfo_generalOnlineDescriptorList = nITFInfo_generalOnlineDescriptorList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_generalOnlineDescriptorList = nITFInfo_generalOnlineDescriptorList obj}- , if obj == default_NITFInfo{nITFInfo_guid = nITFInfo_guid obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_guid = nITFInfo_guid obj}- , if obj == default_NITFInfo{nITFInfo_kicker = nITFInfo_kicker obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_kicker = nITFInfo_kicker obj}- , if obj == default_NITFInfo{nITFInfo_leadParagraphList = nITFInfo_leadParagraphList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_leadParagraphList = nITFInfo_leadParagraphList obj}- , if obj == default_NITFInfo{nITFInfo_locationList = nITFInfo_locationList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_locationList = nITFInfo_locationList obj}- , if obj == default_NITFInfo{nITFInfo_nameList = nITFInfo_nameList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_nameList = nITFInfo_nameList obj}- , if obj == default_NITFInfo{nITFInfo_newsDesk = nITFInfo_newsDesk obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_newsDesk = nITFInfo_newsDesk obj}- , if obj == default_NITFInfo{nITFInfo_normalizedByline = nITFInfo_normalizedByline obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_normalizedByline = nITFInfo_normalizedByline obj}- , if obj == default_NITFInfo{nITFInfo_onlineDescriptorList = nITFInfo_onlineDescriptorList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineDescriptorList = nITFInfo_onlineDescriptorList obj}- , if obj == default_NITFInfo{nITFInfo_onlineHeadline = nITFInfo_onlineHeadline obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineHeadline = nITFInfo_onlineHeadline obj}- , if obj == default_NITFInfo{nITFInfo_onlineLeadParagraph = nITFInfo_onlineLeadParagraph obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineLeadParagraph = nITFInfo_onlineLeadParagraph obj}- , if obj == default_NITFInfo{nITFInfo_onlineLocationList = nITFInfo_onlineLocationList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineLocationList = nITFInfo_onlineLocationList obj}- , if obj == default_NITFInfo{nITFInfo_onlineOrganizationList = nITFInfo_onlineOrganizationList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineOrganizationList = nITFInfo_onlineOrganizationList obj}- , if obj == default_NITFInfo{nITFInfo_onlinePeople = nITFInfo_onlinePeople obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlinePeople = nITFInfo_onlinePeople obj}- , if obj == default_NITFInfo{nITFInfo_onlineSectionList = nITFInfo_onlineSectionList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineSectionList = nITFInfo_onlineSectionList obj}- , if obj == default_NITFInfo{nITFInfo_onlineTitleList = nITFInfo_onlineTitleList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_onlineTitleList = nITFInfo_onlineTitleList obj}- , if obj == default_NITFInfo{nITFInfo_organizationList = nITFInfo_organizationList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_organizationList = nITFInfo_organizationList obj}- , if obj == default_NITFInfo{nITFInfo_page = nITFInfo_page obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_page = nITFInfo_page obj}- , if obj == default_NITFInfo{nITFInfo_peopleList = nITFInfo_peopleList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_peopleList = nITFInfo_peopleList obj}- , if obj == default_NITFInfo{nITFInfo_publicationDate = nITFInfo_publicationDate obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_publicationDate = nITFInfo_publicationDate obj}- , if obj == default_NITFInfo{nITFInfo_publicationDayOfMonth = nITFInfo_publicationDayOfMonth obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_publicationDayOfMonth = nITFInfo_publicationDayOfMonth obj}- , if obj == default_NITFInfo{nITFInfo_publicationMonth = nITFInfo_publicationMonth obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_publicationMonth = nITFInfo_publicationMonth obj}- , if obj == default_NITFInfo{nITFInfo_publicationYear = nITFInfo_publicationYear obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_publicationYear = nITFInfo_publicationYear obj}- , if obj == default_NITFInfo{nITFInfo_section = nITFInfo_section obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_section = nITFInfo_section obj}- , if obj == default_NITFInfo{nITFInfo_seriesName = nITFInfo_seriesName obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_seriesName = nITFInfo_seriesName obj}- , if obj == default_NITFInfo{nITFInfo_slug = nITFInfo_slug obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_slug = nITFInfo_slug obj}- , if obj == default_NITFInfo{nITFInfo_taxonomicClassifierList = nITFInfo_taxonomicClassifierList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_taxonomicClassifierList = nITFInfo_taxonomicClassifierList obj}- , if obj == default_NITFInfo{nITFInfo_titleList = nITFInfo_titleList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_titleList = nITFInfo_titleList obj}- , if obj == default_NITFInfo{nITFInfo_typesOfMaterialList = nITFInfo_typesOfMaterialList obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_typesOfMaterialList = nITFInfo_typesOfMaterialList obj}- , if obj == default_NITFInfo{nITFInfo_url = nITFInfo_url obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_url = nITFInfo_url obj}- , if obj == default_NITFInfo{nITFInfo_wordCount = nITFInfo_wordCount obj} then P.Nothing else P.Just $ default_NITFInfo{nITFInfo_wordCount = nITFInfo_wordCount obj}- ]-from_NITFInfo :: NITFInfo -> T.ThriftVal-from_NITFInfo record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("alternateURL",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_alternateURL record- , (\_v2 -> (2, ("articleAbstract",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_articleAbstract record- , (\_v2 -> (3, ("authorBiography",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_authorBiography record- , (\_v2 -> (4, ("banner",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_banner record- , (\_v2 -> (5, ("biographicalCategoryList",T.TList T.T_STRING $ P.map (\_v4 -> T.TString $ E.encodeUtf8 _v4) $ Vector.toList _v2))) <$> nITFInfo_biographicalCategoryList record- , (\_v2 -> (6, ("columnName",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_columnName record- , (\_v2 -> (7, ("columnNumber",T.TI32 _v2))) <$> nITFInfo_columnNumber record- , (\_v2 -> (8, ("correctionDate",T.TI64 _v2))) <$> nITFInfo_correctionDate record- , (\_v2 -> (9, ("correctionText",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_correctionText record- , (\_v2 -> (10, ("credit",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_credit record- , (\_v2 -> (11, ("dayOfWeek",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_dayOfWeek record- , (\_v2 -> (12, ("descriptorList",T.TList T.T_STRING $ P.map (\_v6 -> T.TString $ E.encodeUtf8 _v6) $ Vector.toList _v2))) <$> nITFInfo_descriptorList record- , (\_v2 -> (13, ("featurePage",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_featurePage record- , (\_v2 -> (14, ("generalOnlineDescriptorList",T.TList T.T_STRING $ P.map (\_v8 -> T.TString $ E.encodeUtf8 _v8) $ Vector.toList _v2))) <$> nITFInfo_generalOnlineDescriptorList record- , (\_v2 -> (15, ("guid",T.TI32 _v2))) <$> nITFInfo_guid record- , (\_v2 -> (16, ("kicker",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_kicker record- , (\_v2 -> (17, ("leadParagraphList",T.TList T.T_STRING $ P.map (\_v10 -> T.TString $ E.encodeUtf8 _v10) $ Vector.toList _v2))) <$> nITFInfo_leadParagraphList record- , (\_v2 -> (18, ("locationList",T.TList T.T_STRING $ P.map (\_v12 -> T.TString $ E.encodeUtf8 _v12) $ Vector.toList _v2))) <$> nITFInfo_locationList record- , (\_v2 -> (19, ("nameList",T.TList T.T_STRING $ P.map (\_v14 -> T.TString $ E.encodeUtf8 _v14) $ Vector.toList _v2))) <$> nITFInfo_nameList record- , (\_v2 -> (20, ("newsDesk",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_newsDesk record- , (\_v2 -> (21, ("normalizedByline",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_normalizedByline record- , (\_v2 -> (22, ("onlineDescriptorList",T.TList T.T_STRING $ P.map (\_v16 -> T.TString $ E.encodeUtf8 _v16) $ Vector.toList _v2))) <$> nITFInfo_onlineDescriptorList record- , (\_v2 -> (23, ("onlineHeadline",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_onlineHeadline record- , (\_v2 -> (24, ("onlineLeadParagraph",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_onlineLeadParagraph record- , (\_v2 -> (25, ("onlineLocationList",T.TList T.T_STRING $ P.map (\_v18 -> T.TString $ E.encodeUtf8 _v18) $ Vector.toList _v2))) <$> nITFInfo_onlineLocationList record- , (\_v2 -> (26, ("onlineOrganizationList",T.TList T.T_STRING $ P.map (\_v20 -> T.TString $ E.encodeUtf8 _v20) $ Vector.toList _v2))) <$> nITFInfo_onlineOrganizationList record- , (\_v2 -> (27, ("onlinePeople",T.TList T.T_STRING $ P.map (\_v22 -> T.TString $ E.encodeUtf8 _v22) $ Vector.toList _v2))) <$> nITFInfo_onlinePeople record- , (\_v2 -> (28, ("onlineSectionList",T.TList T.T_STRING $ P.map (\_v24 -> T.TString $ E.encodeUtf8 _v24) $ Vector.toList _v2))) <$> nITFInfo_onlineSectionList record- , (\_v2 -> (29, ("onlineTitleList",T.TList T.T_STRING $ P.map (\_v26 -> T.TString $ E.encodeUtf8 _v26) $ Vector.toList _v2))) <$> nITFInfo_onlineTitleList record- , (\_v2 -> (30, ("organizationList",T.TList T.T_STRING $ P.map (\_v28 -> T.TString $ E.encodeUtf8 _v28) $ Vector.toList _v2))) <$> nITFInfo_organizationList record- , (\_v2 -> (31, ("page",T.TI32 _v2))) <$> nITFInfo_page record- , (\_v2 -> (32, ("peopleList",T.TList T.T_STRING $ P.map (\_v30 -> T.TString $ E.encodeUtf8 _v30) $ Vector.toList _v2))) <$> nITFInfo_peopleList record- , (\_v2 -> (33, ("publicationDate",T.TI64 _v2))) <$> nITFInfo_publicationDate record- , (\_v2 -> (34, ("publicationDayOfMonth",T.TI32 _v2))) <$> nITFInfo_publicationDayOfMonth record- , (\_v2 -> (35, ("publicationMonth",T.TI32 _v2))) <$> nITFInfo_publicationMonth record- , (\_v2 -> (36, ("publicationYear",T.TI32 _v2))) <$> nITFInfo_publicationYear record- , (\_v2 -> (37, ("section",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_section record- , (\_v2 -> (38, ("seriesName",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_seriesName record- , (\_v2 -> (39, ("slug",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_slug record- , (\_v2 -> (40, ("taxonomicClassifierList",T.TList T.T_STRING $ P.map (\_v32 -> T.TString $ E.encodeUtf8 _v32) $ Vector.toList _v2))) <$> nITFInfo_taxonomicClassifierList record- , (\_v2 -> (41, ("titleList",T.TList T.T_STRING $ P.map (\_v34 -> T.TString $ E.encodeUtf8 _v34) $ Vector.toList _v2))) <$> nITFInfo_titleList record- , (\_v2 -> (42, ("typesOfMaterialList",T.TList T.T_STRING $ P.map (\_v36 -> T.TString $ E.encodeUtf8 _v36) $ Vector.toList _v2))) <$> nITFInfo_typesOfMaterialList record- , (\_v2 -> (43, ("url",T.TString $ E.encodeUtf8 _v2))) <$> nITFInfo_url record- , (\_v2 -> (44, ("wordCount",T.TI32 _v2))) <$> nITFInfo_wordCount record- ]-write_NITFInfo :: (T.Protocol p, T.Transport t) => p t -> NITFInfo -> P.IO ()-write_NITFInfo oprot record = T.writeVal oprot $ from_NITFInfo record-encode_NITFInfo :: (T.Protocol p, T.Transport t) => p t -> NITFInfo -> LBS.ByteString-encode_NITFInfo oprot record = T.serializeVal oprot $ from_NITFInfo record-to_NITFInfo :: T.ThriftVal -> NITFInfo-to_NITFInfo (T.TStruct fields) = NITFInfo{- nITFInfo_alternateURL = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val39 -> E.decodeUtf8 _val39; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- nITFInfo_articleAbstract = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val40 -> E.decodeUtf8 _val40; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- nITFInfo_authorBiography = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val41 -> E.decodeUtf8 _val41; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- nITFInfo_banner = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val42 -> E.decodeUtf8 _val42; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- nITFInfo_biographicalCategoryList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val43 -> (Vector.fromList $ P.map (\_v44 -> (case _v44 of {T.TString _val45 -> E.decodeUtf8 _val45; _ -> P.error "wrong type"})) _val43); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- nITFInfo_columnName = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val46 -> E.decodeUtf8 _val46; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- nITFInfo_columnNumber = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val47 -> _val47; _ -> P.error "wrong type"})) (Map.lookup (7) fields),- nITFInfo_correctionDate = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI64 _val48 -> _val48; _ -> P.error "wrong type"})) (Map.lookup (8) fields),- nITFInfo_correctionText = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val49 -> E.decodeUtf8 _val49; _ -> P.error "wrong type"})) (Map.lookup (9) fields),- nITFInfo_credit = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val50 -> E.decodeUtf8 _val50; _ -> P.error "wrong type"})) (Map.lookup (10) fields),- nITFInfo_dayOfWeek = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val51 -> E.decodeUtf8 _val51; _ -> P.error "wrong type"})) (Map.lookup (11) fields),- nITFInfo_descriptorList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val52 -> (Vector.fromList $ P.map (\_v53 -> (case _v53 of {T.TString _val54 -> E.decodeUtf8 _val54; _ -> P.error "wrong type"})) _val52); _ -> P.error "wrong type"})) (Map.lookup (12) fields),- nITFInfo_featurePage = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val55 -> E.decodeUtf8 _val55; _ -> P.error "wrong type"})) (Map.lookup (13) fields),- nITFInfo_generalOnlineDescriptorList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val56 -> (Vector.fromList $ P.map (\_v57 -> (case _v57 of {T.TString _val58 -> E.decodeUtf8 _val58; _ -> P.error "wrong type"})) _val56); _ -> P.error "wrong type"})) (Map.lookup (14) fields),- nITFInfo_guid = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val59 -> _val59; _ -> P.error "wrong type"})) (Map.lookup (15) fields),- nITFInfo_kicker = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val60 -> E.decodeUtf8 _val60; _ -> P.error "wrong type"})) (Map.lookup (16) fields),- nITFInfo_leadParagraphList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val61 -> (Vector.fromList $ P.map (\_v62 -> (case _v62 of {T.TString _val63 -> E.decodeUtf8 _val63; _ -> P.error "wrong type"})) _val61); _ -> P.error "wrong type"})) (Map.lookup (17) fields),- nITFInfo_locationList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val64 -> (Vector.fromList $ P.map (\_v65 -> (case _v65 of {T.TString _val66 -> E.decodeUtf8 _val66; _ -> P.error "wrong type"})) _val64); _ -> P.error "wrong type"})) (Map.lookup (18) fields),- nITFInfo_nameList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val67 -> (Vector.fromList $ P.map (\_v68 -> (case _v68 of {T.TString _val69 -> E.decodeUtf8 _val69; _ -> P.error "wrong type"})) _val67); _ -> P.error "wrong type"})) (Map.lookup (19) fields),- nITFInfo_newsDesk = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val70 -> E.decodeUtf8 _val70; _ -> P.error "wrong type"})) (Map.lookup (20) fields),- nITFInfo_normalizedByline = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val71 -> E.decodeUtf8 _val71; _ -> P.error "wrong type"})) (Map.lookup (21) fields),- nITFInfo_onlineDescriptorList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val72 -> (Vector.fromList $ P.map (\_v73 -> (case _v73 of {T.TString _val74 -> E.decodeUtf8 _val74; _ -> P.error "wrong type"})) _val72); _ -> P.error "wrong type"})) (Map.lookup (22) fields),- nITFInfo_onlineHeadline = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val75 -> E.decodeUtf8 _val75; _ -> P.error "wrong type"})) (Map.lookup (23) fields),- nITFInfo_onlineLeadParagraph = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val76 -> E.decodeUtf8 _val76; _ -> P.error "wrong type"})) (Map.lookup (24) fields),- nITFInfo_onlineLocationList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val77 -> (Vector.fromList $ P.map (\_v78 -> (case _v78 of {T.TString _val79 -> E.decodeUtf8 _val79; _ -> P.error "wrong type"})) _val77); _ -> P.error "wrong type"})) (Map.lookup (25) fields),- nITFInfo_onlineOrganizationList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val80 -> (Vector.fromList $ P.map (\_v81 -> (case _v81 of {T.TString _val82 -> E.decodeUtf8 _val82; _ -> P.error "wrong type"})) _val80); _ -> P.error "wrong type"})) (Map.lookup (26) fields),- nITFInfo_onlinePeople = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val83 -> (Vector.fromList $ P.map (\_v84 -> (case _v84 of {T.TString _val85 -> E.decodeUtf8 _val85; _ -> P.error "wrong type"})) _val83); _ -> P.error "wrong type"})) (Map.lookup (27) fields),- nITFInfo_onlineSectionList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val86 -> (Vector.fromList $ P.map (\_v87 -> (case _v87 of {T.TString _val88 -> E.decodeUtf8 _val88; _ -> P.error "wrong type"})) _val86); _ -> P.error "wrong type"})) (Map.lookup (28) fields),- nITFInfo_onlineTitleList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val89 -> (Vector.fromList $ P.map (\_v90 -> (case _v90 of {T.TString _val91 -> E.decodeUtf8 _val91; _ -> P.error "wrong type"})) _val89); _ -> P.error "wrong type"})) (Map.lookup (29) fields),- nITFInfo_organizationList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val92 -> (Vector.fromList $ P.map (\_v93 -> (case _v93 of {T.TString _val94 -> E.decodeUtf8 _val94; _ -> P.error "wrong type"})) _val92); _ -> P.error "wrong type"})) (Map.lookup (30) fields),- nITFInfo_page = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val95 -> _val95; _ -> P.error "wrong type"})) (Map.lookup (31) fields),- nITFInfo_peopleList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val96 -> (Vector.fromList $ P.map (\_v97 -> (case _v97 of {T.TString _val98 -> E.decodeUtf8 _val98; _ -> P.error "wrong type"})) _val96); _ -> P.error "wrong type"})) (Map.lookup (32) fields),- nITFInfo_publicationDate = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI64 _val99 -> _val99; _ -> P.error "wrong type"})) (Map.lookup (33) fields),- nITFInfo_publicationDayOfMonth = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val100 -> _val100; _ -> P.error "wrong type"})) (Map.lookup (34) fields),- nITFInfo_publicationMonth = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val101 -> _val101; _ -> P.error "wrong type"})) (Map.lookup (35) fields),- nITFInfo_publicationYear = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val102 -> _val102; _ -> P.error "wrong type"})) (Map.lookup (36) fields),- nITFInfo_section = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val103 -> E.decodeUtf8 _val103; _ -> P.error "wrong type"})) (Map.lookup (37) fields),- nITFInfo_seriesName = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val104 -> E.decodeUtf8 _val104; _ -> P.error "wrong type"})) (Map.lookup (38) fields),- nITFInfo_slug = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val105 -> E.decodeUtf8 _val105; _ -> P.error "wrong type"})) (Map.lookup (39) fields),- nITFInfo_taxonomicClassifierList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val106 -> (Vector.fromList $ P.map (\_v107 -> (case _v107 of {T.TString _val108 -> E.decodeUtf8 _val108; _ -> P.error "wrong type"})) _val106); _ -> P.error "wrong type"})) (Map.lookup (40) fields),- nITFInfo_titleList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val109 -> (Vector.fromList $ P.map (\_v110 -> (case _v110 of {T.TString _val111 -> E.decodeUtf8 _val111; _ -> P.error "wrong type"})) _val109); _ -> P.error "wrong type"})) (Map.lookup (41) fields),- nITFInfo_typesOfMaterialList = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TList _ _val112 -> (Vector.fromList $ P.map (\_v113 -> (case _v113 of {T.TString _val114 -> E.decodeUtf8 _val114; _ -> P.error "wrong type"})) _val112); _ -> P.error "wrong type"})) (Map.lookup (42) fields),- nITFInfo_url = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TString _val115 -> E.decodeUtf8 _val115; _ -> P.error "wrong type"})) (Map.lookup (43) fields),- nITFInfo_wordCount = P.maybe (P.Nothing) (\(_,_val38) -> P.Just (case _val38 of {T.TI32 _val116 -> _val116; _ -> P.error "wrong type"})) (Map.lookup (44) fields)- }-to_NITFInfo _ = P.error "not a struct"-read_NITFInfo :: (T.Transport t, T.Protocol p) => p t -> P.IO NITFInfo-read_NITFInfo iprot = to_NITFInfo <$> T.readVal iprot (T.T_STRUCT typemap_NITFInfo)-decode_NITFInfo :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> NITFInfo-decode_NITFInfo iprot bs = to_NITFInfo $ T.deserializeVal iprot (T.T_STRUCT typemap_NITFInfo) bs-typemap_NITFInfo :: T.TypeMap-typemap_NITFInfo = Map.fromList [(1,("alternateURL",T.T_STRING)),(2,("articleAbstract",T.T_STRING)),(3,("authorBiography",T.T_STRING)),(4,("banner",T.T_STRING)),(5,("biographicalCategoryList",(T.T_LIST T.T_STRING))),(6,("columnName",T.T_STRING)),(7,("columnNumber",T.T_I32)),(8,("correctionDate",T.T_I64)),(9,("correctionText",T.T_STRING)),(10,("credit",T.T_STRING)),(11,("dayOfWeek",T.T_STRING)),(12,("descriptorList",(T.T_LIST T.T_STRING))),(13,("featurePage",T.T_STRING)),(14,("generalOnlineDescriptorList",(T.T_LIST T.T_STRING))),(15,("guid",T.T_I32)),(16,("kicker",T.T_STRING)),(17,("leadParagraphList",(T.T_LIST T.T_STRING))),(18,("locationList",(T.T_LIST T.T_STRING))),(19,("nameList",(T.T_LIST T.T_STRING))),(20,("newsDesk",T.T_STRING)),(21,("normalizedByline",T.T_STRING)),(22,("onlineDescriptorList",(T.T_LIST T.T_STRING))),(23,("onlineHeadline",T.T_STRING)),(24,("onlineLeadParagraph",T.T_STRING)),(25,("onlineLocationList",(T.T_LIST T.T_STRING))),(26,("onlineOrganizationList",(T.T_LIST T.T_STRING))),(27,("onlinePeople",(T.T_LIST T.T_STRING))),(28,("onlineSectionList",(T.T_LIST T.T_STRING))),(29,("onlineTitleList",(T.T_LIST T.T_STRING))),(30,("organizationList",(T.T_LIST T.T_STRING))),(31,("page",T.T_I32)),(32,("peopleList",(T.T_LIST T.T_STRING))),(33,("publicationDate",T.T_I64)),(34,("publicationDayOfMonth",T.T_I32)),(35,("publicationMonth",T.T_I32)),(36,("publicationYear",T.T_I32)),(37,("section",T.T_STRING)),(38,("seriesName",T.T_STRING)),(39,("slug",T.T_STRING)),(40,("taxonomicClassifierList",(T.T_LIST T.T_STRING))),(41,("titleList",(T.T_LIST T.T_STRING))),(42,("typesOfMaterialList",(T.T_LIST T.T_STRING))),(43,("url",T.T_STRING)),(44,("wordCount",T.T_I32))]-default_NITFInfo :: NITFInfo-default_NITFInfo = NITFInfo{- nITFInfo_alternateURL = P.Nothing,- nITFInfo_articleAbstract = P.Nothing,- nITFInfo_authorBiography = P.Nothing,- nITFInfo_banner = P.Nothing,- nITFInfo_biographicalCategoryList = P.Nothing,- nITFInfo_columnName = P.Nothing,- nITFInfo_columnNumber = P.Nothing,- nITFInfo_correctionDate = P.Nothing,- nITFInfo_correctionText = P.Nothing,- nITFInfo_credit = P.Nothing,- nITFInfo_dayOfWeek = P.Nothing,- nITFInfo_descriptorList = P.Nothing,- nITFInfo_featurePage = P.Nothing,- nITFInfo_generalOnlineDescriptorList = P.Nothing,- nITFInfo_guid = P.Nothing,- nITFInfo_kicker = P.Nothing,- nITFInfo_leadParagraphList = P.Nothing,- nITFInfo_locationList = P.Nothing,- nITFInfo_nameList = P.Nothing,- nITFInfo_newsDesk = P.Nothing,- nITFInfo_normalizedByline = P.Nothing,- nITFInfo_onlineDescriptorList = P.Nothing,- nITFInfo_onlineHeadline = P.Nothing,- nITFInfo_onlineLeadParagraph = P.Nothing,- nITFInfo_onlineLocationList = P.Nothing,- nITFInfo_onlineOrganizationList = P.Nothing,- nITFInfo_onlinePeople = P.Nothing,- nITFInfo_onlineSectionList = P.Nothing,- nITFInfo_onlineTitleList = P.Nothing,- nITFInfo_organizationList = P.Nothing,- nITFInfo_page = P.Nothing,- nITFInfo_peopleList = P.Nothing,- nITFInfo_publicationDate = P.Nothing,- nITFInfo_publicationDayOfMonth = P.Nothing,- nITFInfo_publicationMonth = P.Nothing,- nITFInfo_publicationYear = P.Nothing,- nITFInfo_section = P.Nothing,- nITFInfo_seriesName = P.Nothing,- nITFInfo_slug = P.Nothing,- nITFInfo_taxonomicClassifierList = P.Nothing,- nITFInfo_titleList = P.Nothing,- nITFInfo_typesOfMaterialList = P.Nothing,- nITFInfo_url = P.Nothing,- nITFInfo_wordCount = P.Nothing}
− src/ResultsServerService.hs
@@ -1,945 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ResultsServerService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import qualified Service-import Results_Types-import qualified ResultsServerService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data RegisterSearchResult_args = RegisterSearchResult_args { registerSearchResult_args_result :: Search_Types.SearchResult- , registerSearchResult_args_taskType :: Services_Types.AnnotationTaskType- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable RegisterSearchResult_args where- hashWithSalt salt record = salt `H.hashWithSalt` registerSearchResult_args_result record `H.hashWithSalt` registerSearchResult_args_taskType record -instance QC.Arbitrary RegisterSearchResult_args where - arbitrary = M.liftM RegisterSearchResult_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_RegisterSearchResult_args = []- | P.otherwise = M.catMaybes- [ if obj == default_RegisterSearchResult_args{registerSearchResult_args_result = registerSearchResult_args_result obj} then P.Nothing else P.Just $ default_RegisterSearchResult_args{registerSearchResult_args_result = registerSearchResult_args_result obj}- , if obj == default_RegisterSearchResult_args{registerSearchResult_args_taskType = registerSearchResult_args_taskType obj} then P.Nothing else P.Just $ default_RegisterSearchResult_args{registerSearchResult_args_taskType = registerSearchResult_args_taskType obj}- ]-from_RegisterSearchResult_args :: RegisterSearchResult_args -> T.ThriftVal-from_RegisterSearchResult_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("result",Search_Types.from_SearchResult _v2))) $ registerSearchResult_args_result record- , (\_v2 -> P.Just (2, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v2))) $ registerSearchResult_args_taskType record- ]-write_RegisterSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_args -> P.IO ()-write_RegisterSearchResult_args oprot record = T.writeVal oprot $ from_RegisterSearchResult_args record-encode_RegisterSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_args -> LBS.ByteString-encode_RegisterSearchResult_args oprot record = T.serializeVal oprot $ from_RegisterSearchResult_args record-to_RegisterSearchResult_args :: T.ThriftVal -> RegisterSearchResult_args-to_RegisterSearchResult_args (T.TStruct fields) = RegisterSearchResult_args{- registerSearchResult_args_result = P.maybe (registerSearchResult_args_result default_RegisterSearchResult_args) (\(_,_val4) -> (case _val4 of {T.TStruct _val5 -> (Search_Types.to_SearchResult (T.TStruct _val5)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- registerSearchResult_args_taskType = P.maybe (registerSearchResult_args_taskType default_RegisterSearchResult_args) (\(_,_val4) -> (case _val4 of {T.TI32 _val6 -> P.toEnum $ P.fromIntegral _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_RegisterSearchResult_args _ = P.error "not a struct"-read_RegisterSearchResult_args :: (T.Transport t, T.Protocol p) => p t -> P.IO RegisterSearchResult_args-read_RegisterSearchResult_args iprot = to_RegisterSearchResult_args <$> T.readVal iprot (T.T_STRUCT typemap_RegisterSearchResult_args)-decode_RegisterSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> RegisterSearchResult_args-decode_RegisterSearchResult_args iprot bs = to_RegisterSearchResult_args $ T.deserializeVal iprot (T.T_STRUCT typemap_RegisterSearchResult_args) bs-typemap_RegisterSearchResult_args :: T.TypeMap-typemap_RegisterSearchResult_args = Map.fromList [(1,("result",(T.T_STRUCT Search_Types.typemap_SearchResult))),(2,("taskType",T.T_I32))]-default_RegisterSearchResult_args :: RegisterSearchResult_args-default_RegisterSearchResult_args = RegisterSearchResult_args{- registerSearchResult_args_result = Search_Types.default_SearchResult,- registerSearchResult_args_taskType = (P.toEnum 0)}-data RegisterSearchResult_result = RegisterSearchResult_result { registerSearchResult_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable RegisterSearchResult_result where- hashWithSalt salt record = salt `H.hashWithSalt` registerSearchResult_result_ex record -instance QC.Arbitrary RegisterSearchResult_result where - arbitrary = M.liftM RegisterSearchResult_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_RegisterSearchResult_result = []- | P.otherwise = M.catMaybes- [ if obj == default_RegisterSearchResult_result{registerSearchResult_result_ex = registerSearchResult_result_ex obj} then P.Nothing else P.Just $ default_RegisterSearchResult_result{registerSearchResult_result_ex = registerSearchResult_result_ex obj}- ]-from_RegisterSearchResult_result :: RegisterSearchResult_result -> T.ThriftVal-from_RegisterSearchResult_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v9 -> (1, ("ex",Services_Types.from_ServicesException _v9))) <$> registerSearchResult_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v9 -> (1, ("ex",Services_Types.from_ServicesException _v9))) <$> registerSearchResult_result_ex record- ]- )-write_RegisterSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_result -> P.IO ()-write_RegisterSearchResult_result oprot record = T.writeVal oprot $ from_RegisterSearchResult_result record-encode_RegisterSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> RegisterSearchResult_result -> LBS.ByteString-encode_RegisterSearchResult_result oprot record = T.serializeVal oprot $ from_RegisterSearchResult_result record-to_RegisterSearchResult_result :: T.ThriftVal -> RegisterSearchResult_result-to_RegisterSearchResult_result (T.TStruct fields) = RegisterSearchResult_result{- registerSearchResult_result_ex = P.maybe (P.Nothing) (\(_,_val11) -> P.Just (case _val11 of {T.TStruct _val12 -> (Services_Types.to_ServicesException (T.TStruct _val12)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_RegisterSearchResult_result _ = P.error "not a struct"-read_RegisterSearchResult_result :: (T.Transport t, T.Protocol p) => p t -> P.IO RegisterSearchResult_result-read_RegisterSearchResult_result iprot = to_RegisterSearchResult_result <$> T.readVal iprot (T.T_STRUCT typemap_RegisterSearchResult_result)-decode_RegisterSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> RegisterSearchResult_result-decode_RegisterSearchResult_result iprot bs = to_RegisterSearchResult_result $ T.deserializeVal iprot (T.T_STRUCT typemap_RegisterSearchResult_result) bs-typemap_RegisterSearchResult_result :: T.TypeMap-typemap_RegisterSearchResult_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_RegisterSearchResult_result :: RegisterSearchResult_result-default_RegisterSearchResult_result = RegisterSearchResult_result{- registerSearchResult_result_ex = P.Nothing}-data GetSearchResults_args = GetSearchResults_args { getSearchResults_args_taskType :: Services_Types.AnnotationTaskType- , getSearchResults_args_limit :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResults_args where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResults_args_taskType record `H.hashWithSalt` getSearchResults_args_limit record -instance QC.Arbitrary GetSearchResults_args where - arbitrary = M.liftM GetSearchResults_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_GetSearchResults_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResults_args{getSearchResults_args_taskType = getSearchResults_args_taskType obj} then P.Nothing else P.Just $ default_GetSearchResults_args{getSearchResults_args_taskType = getSearchResults_args_taskType obj}- , if obj == default_GetSearchResults_args{getSearchResults_args_limit = getSearchResults_args_limit obj} then P.Nothing else P.Just $ default_GetSearchResults_args{getSearchResults_args_limit = getSearchResults_args_limit obj}- ]-from_GetSearchResults_args :: GetSearchResults_args -> T.ThriftVal-from_GetSearchResults_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v15 -> P.Just (1, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v15))) $ getSearchResults_args_taskType record- , (\_v15 -> P.Just (2, ("limit",T.TI32 _v15))) $ getSearchResults_args_limit record- ]-write_GetSearchResults_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_args -> P.IO ()-write_GetSearchResults_args oprot record = T.writeVal oprot $ from_GetSearchResults_args record-encode_GetSearchResults_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_args -> LBS.ByteString-encode_GetSearchResults_args oprot record = T.serializeVal oprot $ from_GetSearchResults_args record-to_GetSearchResults_args :: T.ThriftVal -> GetSearchResults_args-to_GetSearchResults_args (T.TStruct fields) = GetSearchResults_args{- getSearchResults_args_taskType = P.maybe (getSearchResults_args_taskType default_GetSearchResults_args) (\(_,_val17) -> (case _val17 of {T.TI32 _val18 -> P.toEnum $ P.fromIntegral _val18; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- getSearchResults_args_limit = P.maybe (getSearchResults_args_limit default_GetSearchResults_args) (\(_,_val17) -> (case _val17 of {T.TI32 _val19 -> _val19; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_GetSearchResults_args _ = P.error "not a struct"-read_GetSearchResults_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResults_args-read_GetSearchResults_args iprot = to_GetSearchResults_args <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResults_args)-decode_GetSearchResults_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResults_args-decode_GetSearchResults_args iprot bs = to_GetSearchResults_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResults_args) bs-typemap_GetSearchResults_args :: T.TypeMap-typemap_GetSearchResults_args = Map.fromList [(1,("taskType",T.T_I32)),(2,("limit",T.T_I32))]-default_GetSearchResults_args :: GetSearchResults_args-default_GetSearchResults_args = GetSearchResults_args{- getSearchResults_args_taskType = (P.toEnum 0),- getSearchResults_args_limit = 0}-data GetSearchResults_result = GetSearchResults_result { getSearchResults_result_success :: (Vector.Vector Search_Types.SearchResult)- , getSearchResults_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResults_result where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResults_result_success record `H.hashWithSalt` getSearchResults_result_ex record -instance QC.Arbitrary GetSearchResults_result where - arbitrary = M.liftM GetSearchResults_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetSearchResults_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResults_result{getSearchResults_result_success = getSearchResults_result_success obj} then P.Nothing else P.Just $ default_GetSearchResults_result{getSearchResults_result_success = getSearchResults_result_success obj}- , if obj == default_GetSearchResults_result{getSearchResults_result_ex = getSearchResults_result_ex obj} then P.Nothing else P.Just $ default_GetSearchResults_result{getSearchResults_result_ex = getSearchResults_result_ex obj}- ]-from_GetSearchResults_result :: GetSearchResults_result -> T.ThriftVal-from_GetSearchResults_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v22 -> (1, ("ex",Services_Types.from_ServicesException _v22))) <$> getSearchResults_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v22 -> P.Just (0, ("success",T.TList (T.T_STRUCT Search_Types.typemap_SearchResult) $ P.map (\_v24 -> Search_Types.from_SearchResult _v24) $ Vector.toList _v22))) $ getSearchResults_result_success record- , (\_v22 -> (1, ("ex",Services_Types.from_ServicesException _v22))) <$> getSearchResults_result_ex record- ]- )-write_GetSearchResults_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_result -> P.IO ()-write_GetSearchResults_result oprot record = T.writeVal oprot $ from_GetSearchResults_result record-encode_GetSearchResults_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResults_result -> LBS.ByteString-encode_GetSearchResults_result oprot record = T.serializeVal oprot $ from_GetSearchResults_result record-to_GetSearchResults_result :: T.ThriftVal -> GetSearchResults_result-to_GetSearchResults_result (T.TStruct fields) = GetSearchResults_result{- getSearchResults_result_success = P.maybe (getSearchResults_result_success default_GetSearchResults_result) (\(_,_val26) -> (case _val26 of {T.TList _ _val27 -> (Vector.fromList $ P.map (\_v28 -> (case _v28 of {T.TStruct _val29 -> (Search_Types.to_SearchResult (T.TStruct _val29)); _ -> P.error "wrong type"})) _val27); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getSearchResults_result_ex = P.maybe (P.Nothing) (\(_,_val26) -> P.Just (case _val26 of {T.TStruct _val30 -> (Services_Types.to_ServicesException (T.TStruct _val30)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResults_result _ = P.error "not a struct"-read_GetSearchResults_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResults_result-read_GetSearchResults_result iprot = to_GetSearchResults_result <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResults_result)-decode_GetSearchResults_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResults_result-decode_GetSearchResults_result iprot bs = to_GetSearchResults_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResults_result) bs-typemap_GetSearchResults_result :: T.TypeMap-typemap_GetSearchResults_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT Search_Types.typemap_SearchResult)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetSearchResults_result :: GetSearchResults_result-default_GetSearchResults_result = GetSearchResults_result{- getSearchResults_result_success = Vector.empty,- getSearchResults_result_ex = P.Nothing}-data GetSearchResultsByUser_args = GetSearchResultsByUser_args { getSearchResultsByUser_args_taskType :: Services_Types.AnnotationTaskType- , getSearchResultsByUser_args_userId :: LT.Text- , getSearchResultsByUser_args_limit :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResultsByUser_args where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResultsByUser_args_taskType record `H.hashWithSalt` getSearchResultsByUser_args_userId record `H.hashWithSalt` getSearchResultsByUser_args_limit record -instance QC.Arbitrary GetSearchResultsByUser_args where - arbitrary = M.liftM GetSearchResultsByUser_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_GetSearchResultsByUser_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResultsByUser_args{getSearchResultsByUser_args_taskType = getSearchResultsByUser_args_taskType obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_args{getSearchResultsByUser_args_taskType = getSearchResultsByUser_args_taskType obj}- , if obj == default_GetSearchResultsByUser_args{getSearchResultsByUser_args_userId = getSearchResultsByUser_args_userId obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_args{getSearchResultsByUser_args_userId = getSearchResultsByUser_args_userId obj}- , if obj == default_GetSearchResultsByUser_args{getSearchResultsByUser_args_limit = getSearchResultsByUser_args_limit obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_args{getSearchResultsByUser_args_limit = getSearchResultsByUser_args_limit obj}- ]-from_GetSearchResultsByUser_args :: GetSearchResultsByUser_args -> T.ThriftVal-from_GetSearchResultsByUser_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v33 -> P.Just (1, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v33))) $ getSearchResultsByUser_args_taskType record- , (\_v33 -> P.Just (2, ("userId",T.TString $ E.encodeUtf8 _v33))) $ getSearchResultsByUser_args_userId record- , (\_v33 -> P.Just (3, ("limit",T.TI32 _v33))) $ getSearchResultsByUser_args_limit record- ]-write_GetSearchResultsByUser_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_args -> P.IO ()-write_GetSearchResultsByUser_args oprot record = T.writeVal oprot $ from_GetSearchResultsByUser_args record-encode_GetSearchResultsByUser_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_args -> LBS.ByteString-encode_GetSearchResultsByUser_args oprot record = T.serializeVal oprot $ from_GetSearchResultsByUser_args record-to_GetSearchResultsByUser_args :: T.ThriftVal -> GetSearchResultsByUser_args-to_GetSearchResultsByUser_args (T.TStruct fields) = GetSearchResultsByUser_args{- getSearchResultsByUser_args_taskType = P.maybe (getSearchResultsByUser_args_taskType default_GetSearchResultsByUser_args) (\(_,_val35) -> (case _val35 of {T.TI32 _val36 -> P.toEnum $ P.fromIntegral _val36; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- getSearchResultsByUser_args_userId = P.maybe (getSearchResultsByUser_args_userId default_GetSearchResultsByUser_args) (\(_,_val35) -> (case _val35 of {T.TString _val37 -> E.decodeUtf8 _val37; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- getSearchResultsByUser_args_limit = P.maybe (getSearchResultsByUser_args_limit default_GetSearchResultsByUser_args) (\(_,_val35) -> (case _val35 of {T.TI32 _val38 -> _val38; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_GetSearchResultsByUser_args _ = P.error "not a struct"-read_GetSearchResultsByUser_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResultsByUser_args-read_GetSearchResultsByUser_args iprot = to_GetSearchResultsByUser_args <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_args)-decode_GetSearchResultsByUser_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResultsByUser_args-decode_GetSearchResultsByUser_args iprot bs = to_GetSearchResultsByUser_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_args) bs-typemap_GetSearchResultsByUser_args :: T.TypeMap-typemap_GetSearchResultsByUser_args = Map.fromList [(1,("taskType",T.T_I32)),(2,("userId",T.T_STRING)),(3,("limit",T.T_I32))]-default_GetSearchResultsByUser_args :: GetSearchResultsByUser_args-default_GetSearchResultsByUser_args = GetSearchResultsByUser_args{- getSearchResultsByUser_args_taskType = (P.toEnum 0),- getSearchResultsByUser_args_userId = "",- getSearchResultsByUser_args_limit = 0}-data GetSearchResultsByUser_result = GetSearchResultsByUser_result { getSearchResultsByUser_result_success :: (Vector.Vector Search_Types.SearchResult)- , getSearchResultsByUser_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResultsByUser_result where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResultsByUser_result_success record `H.hashWithSalt` getSearchResultsByUser_result_ex record -instance QC.Arbitrary GetSearchResultsByUser_result where - arbitrary = M.liftM GetSearchResultsByUser_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetSearchResultsByUser_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResultsByUser_result{getSearchResultsByUser_result_success = getSearchResultsByUser_result_success obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_result{getSearchResultsByUser_result_success = getSearchResultsByUser_result_success obj}- , if obj == default_GetSearchResultsByUser_result{getSearchResultsByUser_result_ex = getSearchResultsByUser_result_ex obj} then P.Nothing else P.Just $ default_GetSearchResultsByUser_result{getSearchResultsByUser_result_ex = getSearchResultsByUser_result_ex obj}- ]-from_GetSearchResultsByUser_result :: GetSearchResultsByUser_result -> T.ThriftVal-from_GetSearchResultsByUser_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v41 -> (1, ("ex",Services_Types.from_ServicesException _v41))) <$> getSearchResultsByUser_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v41 -> P.Just (0, ("success",T.TList (T.T_STRUCT Search_Types.typemap_SearchResult) $ P.map (\_v43 -> Search_Types.from_SearchResult _v43) $ Vector.toList _v41))) $ getSearchResultsByUser_result_success record- , (\_v41 -> (1, ("ex",Services_Types.from_ServicesException _v41))) <$> getSearchResultsByUser_result_ex record- ]- )-write_GetSearchResultsByUser_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_result -> P.IO ()-write_GetSearchResultsByUser_result oprot record = T.writeVal oprot $ from_GetSearchResultsByUser_result record-encode_GetSearchResultsByUser_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResultsByUser_result -> LBS.ByteString-encode_GetSearchResultsByUser_result oprot record = T.serializeVal oprot $ from_GetSearchResultsByUser_result record-to_GetSearchResultsByUser_result :: T.ThriftVal -> GetSearchResultsByUser_result-to_GetSearchResultsByUser_result (T.TStruct fields) = GetSearchResultsByUser_result{- getSearchResultsByUser_result_success = P.maybe (getSearchResultsByUser_result_success default_GetSearchResultsByUser_result) (\(_,_val45) -> (case _val45 of {T.TList _ _val46 -> (Vector.fromList $ P.map (\_v47 -> (case _v47 of {T.TStruct _val48 -> (Search_Types.to_SearchResult (T.TStruct _val48)); _ -> P.error "wrong type"})) _val46); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getSearchResultsByUser_result_ex = P.maybe (P.Nothing) (\(_,_val45) -> P.Just (case _val45 of {T.TStruct _val49 -> (Services_Types.to_ServicesException (T.TStruct _val49)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResultsByUser_result _ = P.error "not a struct"-read_GetSearchResultsByUser_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResultsByUser_result-read_GetSearchResultsByUser_result iprot = to_GetSearchResultsByUser_result <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_result)-decode_GetSearchResultsByUser_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResultsByUser_result-decode_GetSearchResultsByUser_result iprot bs = to_GetSearchResultsByUser_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResultsByUser_result) bs-typemap_GetSearchResultsByUser_result :: T.TypeMap-typemap_GetSearchResultsByUser_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT Search_Types.typemap_SearchResult)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetSearchResultsByUser_result :: GetSearchResultsByUser_result-default_GetSearchResultsByUser_result = GetSearchResultsByUser_result{- getSearchResultsByUser_result_success = Vector.empty,- getSearchResultsByUser_result_ex = P.Nothing}-data GetLatestSearchResult_args = GetLatestSearchResult_args { getLatestSearchResult_args_userId :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetLatestSearchResult_args where- hashWithSalt salt record = salt `H.hashWithSalt` getLatestSearchResult_args_userId record -instance QC.Arbitrary GetLatestSearchResult_args where - arbitrary = M.liftM GetLatestSearchResult_args (QC.arbitrary)- shrink obj | obj == default_GetLatestSearchResult_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetLatestSearchResult_args{getLatestSearchResult_args_userId = getLatestSearchResult_args_userId obj} then P.Nothing else P.Just $ default_GetLatestSearchResult_args{getLatestSearchResult_args_userId = getLatestSearchResult_args_userId obj}- ]-from_GetLatestSearchResult_args :: GetLatestSearchResult_args -> T.ThriftVal-from_GetLatestSearchResult_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v52 -> P.Just (1, ("userId",T.TString $ E.encodeUtf8 _v52))) $ getLatestSearchResult_args_userId record- ]-write_GetLatestSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_args -> P.IO ()-write_GetLatestSearchResult_args oprot record = T.writeVal oprot $ from_GetLatestSearchResult_args record-encode_GetLatestSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_args -> LBS.ByteString-encode_GetLatestSearchResult_args oprot record = T.serializeVal oprot $ from_GetLatestSearchResult_args record-to_GetLatestSearchResult_args :: T.ThriftVal -> GetLatestSearchResult_args-to_GetLatestSearchResult_args (T.TStruct fields) = GetLatestSearchResult_args{- getLatestSearchResult_args_userId = P.maybe (getLatestSearchResult_args_userId default_GetLatestSearchResult_args) (\(_,_val54) -> (case _val54 of {T.TString _val55 -> E.decodeUtf8 _val55; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetLatestSearchResult_args _ = P.error "not a struct"-read_GetLatestSearchResult_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetLatestSearchResult_args-read_GetLatestSearchResult_args iprot = to_GetLatestSearchResult_args <$> T.readVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_args)-decode_GetLatestSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetLatestSearchResult_args-decode_GetLatestSearchResult_args iprot bs = to_GetLatestSearchResult_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_args) bs-typemap_GetLatestSearchResult_args :: T.TypeMap-typemap_GetLatestSearchResult_args = Map.fromList [(1,("userId",T.T_STRING))]-default_GetLatestSearchResult_args :: GetLatestSearchResult_args-default_GetLatestSearchResult_args = GetLatestSearchResult_args{- getLatestSearchResult_args_userId = ""}-data GetLatestSearchResult_result = GetLatestSearchResult_result { getLatestSearchResult_result_success :: Search_Types.SearchResult- , getLatestSearchResult_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetLatestSearchResult_result where- hashWithSalt salt record = salt `H.hashWithSalt` getLatestSearchResult_result_success record `H.hashWithSalt` getLatestSearchResult_result_ex record -instance QC.Arbitrary GetLatestSearchResult_result where - arbitrary = M.liftM GetLatestSearchResult_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetLatestSearchResult_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetLatestSearchResult_result{getLatestSearchResult_result_success = getLatestSearchResult_result_success obj} then P.Nothing else P.Just $ default_GetLatestSearchResult_result{getLatestSearchResult_result_success = getLatestSearchResult_result_success obj}- , if obj == default_GetLatestSearchResult_result{getLatestSearchResult_result_ex = getLatestSearchResult_result_ex obj} then P.Nothing else P.Just $ default_GetLatestSearchResult_result{getLatestSearchResult_result_ex = getLatestSearchResult_result_ex obj}- ]-from_GetLatestSearchResult_result :: GetLatestSearchResult_result -> T.ThriftVal-from_GetLatestSearchResult_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v58 -> (1, ("ex",Services_Types.from_ServicesException _v58))) <$> getLatestSearchResult_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v58 -> P.Just (0, ("success",Search_Types.from_SearchResult _v58))) $ getLatestSearchResult_result_success record- , (\_v58 -> (1, ("ex",Services_Types.from_ServicesException _v58))) <$> getLatestSearchResult_result_ex record- ]- )-write_GetLatestSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_result -> P.IO ()-write_GetLatestSearchResult_result oprot record = T.writeVal oprot $ from_GetLatestSearchResult_result record-encode_GetLatestSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetLatestSearchResult_result -> LBS.ByteString-encode_GetLatestSearchResult_result oprot record = T.serializeVal oprot $ from_GetLatestSearchResult_result record-to_GetLatestSearchResult_result :: T.ThriftVal -> GetLatestSearchResult_result-to_GetLatestSearchResult_result (T.TStruct fields) = GetLatestSearchResult_result{- getLatestSearchResult_result_success = P.maybe (getLatestSearchResult_result_success default_GetLatestSearchResult_result) (\(_,_val60) -> (case _val60 of {T.TStruct _val61 -> (Search_Types.to_SearchResult (T.TStruct _val61)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getLatestSearchResult_result_ex = P.maybe (P.Nothing) (\(_,_val60) -> P.Just (case _val60 of {T.TStruct _val62 -> (Services_Types.to_ServicesException (T.TStruct _val62)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetLatestSearchResult_result _ = P.error "not a struct"-read_GetLatestSearchResult_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetLatestSearchResult_result-read_GetLatestSearchResult_result iprot = to_GetLatestSearchResult_result <$> T.readVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_result)-decode_GetLatestSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetLatestSearchResult_result-decode_GetLatestSearchResult_result iprot bs = to_GetLatestSearchResult_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetLatestSearchResult_result) bs-typemap_GetLatestSearchResult_result :: T.TypeMap-typemap_GetLatestSearchResult_result = Map.fromList [(0,("success",(T.T_STRUCT Search_Types.typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetLatestSearchResult_result :: GetLatestSearchResult_result-default_GetLatestSearchResult_result = GetLatestSearchResult_result{- getLatestSearchResult_result_success = Search_Types.default_SearchResult,- getLatestSearchResult_result_ex = P.Nothing}-data GetSearchResult_args = GetSearchResult_args { getSearchResult_args_searchResultId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResult_args where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResult_args_searchResultId record -instance QC.Arbitrary GetSearchResult_args where - arbitrary = M.liftM GetSearchResult_args (QC.arbitrary)- shrink obj | obj == default_GetSearchResult_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResult_args{getSearchResult_args_searchResultId = getSearchResult_args_searchResultId obj} then P.Nothing else P.Just $ default_GetSearchResult_args{getSearchResult_args_searchResultId = getSearchResult_args_searchResultId obj}- ]-from_GetSearchResult_args :: GetSearchResult_args -> T.ThriftVal-from_GetSearchResult_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v65 -> P.Just (1, ("searchResultId",Uuid_Types.from_UUID _v65))) $ getSearchResult_args_searchResultId record- ]-write_GetSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_args -> P.IO ()-write_GetSearchResult_args oprot record = T.writeVal oprot $ from_GetSearchResult_args record-encode_GetSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_args -> LBS.ByteString-encode_GetSearchResult_args oprot record = T.serializeVal oprot $ from_GetSearchResult_args record-to_GetSearchResult_args :: T.ThriftVal -> GetSearchResult_args-to_GetSearchResult_args (T.TStruct fields) = GetSearchResult_args{- getSearchResult_args_searchResultId = P.maybe (getSearchResult_args_searchResultId default_GetSearchResult_args) (\(_,_val67) -> (case _val67 of {T.TStruct _val68 -> (Uuid_Types.to_UUID (T.TStruct _val68)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResult_args _ = P.error "not a struct"-read_GetSearchResult_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResult_args-read_GetSearchResult_args iprot = to_GetSearchResult_args <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResult_args)-decode_GetSearchResult_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResult_args-decode_GetSearchResult_args iprot bs = to_GetSearchResult_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResult_args) bs-typemap_GetSearchResult_args :: T.TypeMap-typemap_GetSearchResult_args = Map.fromList [(1,("searchResultId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_GetSearchResult_args :: GetSearchResult_args-default_GetSearchResult_args = GetSearchResult_args{- getSearchResult_args_searchResultId = Uuid_Types.default_UUID}-data GetSearchResult_result = GetSearchResult_result { getSearchResult_result_success :: Search_Types.SearchResult- , getSearchResult_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetSearchResult_result where- hashWithSalt salt record = salt `H.hashWithSalt` getSearchResult_result_success record `H.hashWithSalt` getSearchResult_result_ex record -instance QC.Arbitrary GetSearchResult_result where - arbitrary = M.liftM GetSearchResult_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetSearchResult_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetSearchResult_result{getSearchResult_result_success = getSearchResult_result_success obj} then P.Nothing else P.Just $ default_GetSearchResult_result{getSearchResult_result_success = getSearchResult_result_success obj}- , if obj == default_GetSearchResult_result{getSearchResult_result_ex = getSearchResult_result_ex obj} then P.Nothing else P.Just $ default_GetSearchResult_result{getSearchResult_result_ex = getSearchResult_result_ex obj}- ]-from_GetSearchResult_result :: GetSearchResult_result -> T.ThriftVal-from_GetSearchResult_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v71 -> (1, ("ex",Services_Types.from_ServicesException _v71))) <$> getSearchResult_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v71 -> P.Just (0, ("success",Search_Types.from_SearchResult _v71))) $ getSearchResult_result_success record- , (\_v71 -> (1, ("ex",Services_Types.from_ServicesException _v71))) <$> getSearchResult_result_ex record- ]- )-write_GetSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_result -> P.IO ()-write_GetSearchResult_result oprot record = T.writeVal oprot $ from_GetSearchResult_result record-encode_GetSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> GetSearchResult_result -> LBS.ByteString-encode_GetSearchResult_result oprot record = T.serializeVal oprot $ from_GetSearchResult_result record-to_GetSearchResult_result :: T.ThriftVal -> GetSearchResult_result-to_GetSearchResult_result (T.TStruct fields) = GetSearchResult_result{- getSearchResult_result_success = P.maybe (getSearchResult_result_success default_GetSearchResult_result) (\(_,_val73) -> (case _val73 of {T.TStruct _val74 -> (Search_Types.to_SearchResult (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getSearchResult_result_ex = P.maybe (P.Nothing) (\(_,_val73) -> P.Just (case _val73 of {T.TStruct _val75 -> (Services_Types.to_ServicesException (T.TStruct _val75)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetSearchResult_result _ = P.error "not a struct"-read_GetSearchResult_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetSearchResult_result-read_GetSearchResult_result iprot = to_GetSearchResult_result <$> T.readVal iprot (T.T_STRUCT typemap_GetSearchResult_result)-decode_GetSearchResult_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetSearchResult_result-decode_GetSearchResult_result iprot bs = to_GetSearchResult_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetSearchResult_result) bs-typemap_GetSearchResult_result :: T.TypeMap-typemap_GetSearchResult_result = Map.fromList [(0,("success",(T.T_STRUCT Search_Types.typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetSearchResult_result :: GetSearchResult_result-default_GetSearchResult_result = GetSearchResult_result{- getSearchResult_result_success = Search_Types.default_SearchResult,- getSearchResult_result_ex = P.Nothing}-data StartSession_args = StartSession_args { startSession_args_searchResultId :: Uuid_Types.UUID- , startSession_args_taskType :: Services_Types.AnnotationTaskType- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartSession_args where- hashWithSalt salt record = salt `H.hashWithSalt` startSession_args_searchResultId record `H.hashWithSalt` startSession_args_taskType record -instance QC.Arbitrary StartSession_args where - arbitrary = M.liftM StartSession_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_StartSession_args = []- | P.otherwise = M.catMaybes- [ if obj == default_StartSession_args{startSession_args_searchResultId = startSession_args_searchResultId obj} then P.Nothing else P.Just $ default_StartSession_args{startSession_args_searchResultId = startSession_args_searchResultId obj}- , if obj == default_StartSession_args{startSession_args_taskType = startSession_args_taskType obj} then P.Nothing else P.Just $ default_StartSession_args{startSession_args_taskType = startSession_args_taskType obj}- ]-from_StartSession_args :: StartSession_args -> T.ThriftVal-from_StartSession_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v78 -> P.Just (1, ("searchResultId",Uuid_Types.from_UUID _v78))) $ startSession_args_searchResultId record- , (\_v78 -> P.Just (2, ("taskType",T.TI32 $ P.fromIntegral $ P.fromEnum _v78))) $ startSession_args_taskType record- ]-write_StartSession_args :: (T.Protocol p, T.Transport t) => p t -> StartSession_args -> P.IO ()-write_StartSession_args oprot record = T.writeVal oprot $ from_StartSession_args record-encode_StartSession_args :: (T.Protocol p, T.Transport t) => p t -> StartSession_args -> LBS.ByteString-encode_StartSession_args oprot record = T.serializeVal oprot $ from_StartSession_args record-to_StartSession_args :: T.ThriftVal -> StartSession_args-to_StartSession_args (T.TStruct fields) = StartSession_args{- startSession_args_searchResultId = P.maybe (startSession_args_searchResultId default_StartSession_args) (\(_,_val80) -> (case _val80 of {T.TStruct _val81 -> (Uuid_Types.to_UUID (T.TStruct _val81)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- startSession_args_taskType = P.maybe (startSession_args_taskType default_StartSession_args) (\(_,_val80) -> (case _val80 of {T.TI32 _val82 -> P.toEnum $ P.fromIntegral _val82; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_StartSession_args _ = P.error "not a struct"-read_StartSession_args :: (T.Transport t, T.Protocol p) => p t -> P.IO StartSession_args-read_StartSession_args iprot = to_StartSession_args <$> T.readVal iprot (T.T_STRUCT typemap_StartSession_args)-decode_StartSession_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartSession_args-decode_StartSession_args iprot bs = to_StartSession_args $ T.deserializeVal iprot (T.T_STRUCT typemap_StartSession_args) bs-typemap_StartSession_args :: T.TypeMap-typemap_StartSession_args = Map.fromList [(1,("searchResultId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("taskType",T.T_I32))]-default_StartSession_args :: StartSession_args-default_StartSession_args = StartSession_args{- startSession_args_searchResultId = Uuid_Types.default_UUID,- startSession_args_taskType = (P.toEnum 0)}-data StartSession_result = StartSession_result { startSession_result_success :: Uuid_Types.UUID- , startSession_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StartSession_result where- hashWithSalt salt record = salt `H.hashWithSalt` startSession_result_success record `H.hashWithSalt` startSession_result_ex record -instance QC.Arbitrary StartSession_result where - arbitrary = M.liftM StartSession_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_StartSession_result = []- | P.otherwise = M.catMaybes- [ if obj == default_StartSession_result{startSession_result_success = startSession_result_success obj} then P.Nothing else P.Just $ default_StartSession_result{startSession_result_success = startSession_result_success obj}- , if obj == default_StartSession_result{startSession_result_ex = startSession_result_ex obj} then P.Nothing else P.Just $ default_StartSession_result{startSession_result_ex = startSession_result_ex obj}- ]-from_StartSession_result :: StartSession_result -> T.ThriftVal-from_StartSession_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v85 -> (1, ("ex",Services_Types.from_ServicesException _v85))) <$> startSession_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v85 -> P.Just (0, ("success",Uuid_Types.from_UUID _v85))) $ startSession_result_success record- , (\_v85 -> (1, ("ex",Services_Types.from_ServicesException _v85))) <$> startSession_result_ex record- ]- )-write_StartSession_result :: (T.Protocol p, T.Transport t) => p t -> StartSession_result -> P.IO ()-write_StartSession_result oprot record = T.writeVal oprot $ from_StartSession_result record-encode_StartSession_result :: (T.Protocol p, T.Transport t) => p t -> StartSession_result -> LBS.ByteString-encode_StartSession_result oprot record = T.serializeVal oprot $ from_StartSession_result record-to_StartSession_result :: T.ThriftVal -> StartSession_result-to_StartSession_result (T.TStruct fields) = StartSession_result{- startSession_result_success = P.maybe (startSession_result_success default_StartSession_result) (\(_,_val87) -> (case _val87 of {T.TStruct _val88 -> (Uuid_Types.to_UUID (T.TStruct _val88)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- startSession_result_ex = P.maybe (P.Nothing) (\(_,_val87) -> P.Just (case _val87 of {T.TStruct _val89 -> (Services_Types.to_ServicesException (T.TStruct _val89)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StartSession_result _ = P.error "not a struct"-read_StartSession_result :: (T.Transport t, T.Protocol p) => p t -> P.IO StartSession_result-read_StartSession_result iprot = to_StartSession_result <$> T.readVal iprot (T.T_STRUCT typemap_StartSession_result)-decode_StartSession_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StartSession_result-decode_StartSession_result iprot bs = to_StartSession_result $ T.deserializeVal iprot (T.T_STRUCT typemap_StartSession_result) bs-typemap_StartSession_result :: T.TypeMap-typemap_StartSession_result = Map.fromList [(0,("success",(T.T_STRUCT Uuid_Types.typemap_UUID))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_StartSession_result :: StartSession_result-default_StartSession_result = StartSession_result{- startSession_result_success = Uuid_Types.default_UUID,- startSession_result_ex = P.Nothing}-data StopSession_args = StopSession_args { stopSession_args_sessionId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StopSession_args where- hashWithSalt salt record = salt `H.hashWithSalt` stopSession_args_sessionId record -instance QC.Arbitrary StopSession_args where - arbitrary = M.liftM StopSession_args (QC.arbitrary)- shrink obj | obj == default_StopSession_args = []- | P.otherwise = M.catMaybes- [ if obj == default_StopSession_args{stopSession_args_sessionId = stopSession_args_sessionId obj} then P.Nothing else P.Just $ default_StopSession_args{stopSession_args_sessionId = stopSession_args_sessionId obj}- ]-from_StopSession_args :: StopSession_args -> T.ThriftVal-from_StopSession_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v92 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v92))) $ stopSession_args_sessionId record- ]-write_StopSession_args :: (T.Protocol p, T.Transport t) => p t -> StopSession_args -> P.IO ()-write_StopSession_args oprot record = T.writeVal oprot $ from_StopSession_args record-encode_StopSession_args :: (T.Protocol p, T.Transport t) => p t -> StopSession_args -> LBS.ByteString-encode_StopSession_args oprot record = T.serializeVal oprot $ from_StopSession_args record-to_StopSession_args :: T.ThriftVal -> StopSession_args-to_StopSession_args (T.TStruct fields) = StopSession_args{- stopSession_args_sessionId = P.maybe (stopSession_args_sessionId default_StopSession_args) (\(_,_val94) -> (case _val94 of {T.TStruct _val95 -> (Uuid_Types.to_UUID (T.TStruct _val95)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StopSession_args _ = P.error "not a struct"-read_StopSession_args :: (T.Transport t, T.Protocol p) => p t -> P.IO StopSession_args-read_StopSession_args iprot = to_StopSession_args <$> T.readVal iprot (T.T_STRUCT typemap_StopSession_args)-decode_StopSession_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StopSession_args-decode_StopSession_args iprot bs = to_StopSession_args $ T.deserializeVal iprot (T.T_STRUCT typemap_StopSession_args) bs-typemap_StopSession_args :: T.TypeMap-typemap_StopSession_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_StopSession_args :: StopSession_args-default_StopSession_args = StopSession_args{- stopSession_args_sessionId = Uuid_Types.default_UUID}-data StopSession_result = StopSession_result { stopSession_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable StopSession_result where- hashWithSalt salt record = salt `H.hashWithSalt` stopSession_result_ex record -instance QC.Arbitrary StopSession_result where - arbitrary = M.liftM StopSession_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_StopSession_result = []- | P.otherwise = M.catMaybes- [ if obj == default_StopSession_result{stopSession_result_ex = stopSession_result_ex obj} then P.Nothing else P.Just $ default_StopSession_result{stopSession_result_ex = stopSession_result_ex obj}- ]-from_StopSession_result :: StopSession_result -> T.ThriftVal-from_StopSession_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> stopSession_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> stopSession_result_ex record- ]- )-write_StopSession_result :: (T.Protocol p, T.Transport t) => p t -> StopSession_result -> P.IO ()-write_StopSession_result oprot record = T.writeVal oprot $ from_StopSession_result record-encode_StopSession_result :: (T.Protocol p, T.Transport t) => p t -> StopSession_result -> LBS.ByteString-encode_StopSession_result oprot record = T.serializeVal oprot $ from_StopSession_result record-to_StopSession_result :: T.ThriftVal -> StopSession_result-to_StopSession_result (T.TStruct fields) = StopSession_result{- stopSession_result_ex = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TStruct _val101 -> (Services_Types.to_ServicesException (T.TStruct _val101)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_StopSession_result _ = P.error "not a struct"-read_StopSession_result :: (T.Transport t, T.Protocol p) => p t -> P.IO StopSession_result-read_StopSession_result iprot = to_StopSession_result <$> T.readVal iprot (T.T_STRUCT typemap_StopSession_result)-decode_StopSession_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> StopSession_result-decode_StopSession_result iprot bs = to_StopSession_result $ T.deserializeVal iprot (T.T_STRUCT typemap_StopSession_result) bs-typemap_StopSession_result :: T.TypeMap-typemap_StopSession_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_StopSession_result :: StopSession_result-default_StopSession_result = StopSession_result{- stopSession_result_ex = P.Nothing}-data GetNextChunk_args = GetNextChunk_args { getNextChunk_args_sessionId :: Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetNextChunk_args where- hashWithSalt salt record = salt `H.hashWithSalt` getNextChunk_args_sessionId record -instance QC.Arbitrary GetNextChunk_args where - arbitrary = M.liftM GetNextChunk_args (QC.arbitrary)- shrink obj | obj == default_GetNextChunk_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetNextChunk_args{getNextChunk_args_sessionId = getNextChunk_args_sessionId obj} then P.Nothing else P.Just $ default_GetNextChunk_args{getNextChunk_args_sessionId = getNextChunk_args_sessionId obj}- ]-from_GetNextChunk_args :: GetNextChunk_args -> T.ThriftVal-from_GetNextChunk_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v104 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v104))) $ getNextChunk_args_sessionId record- ]-write_GetNextChunk_args :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_args -> P.IO ()-write_GetNextChunk_args oprot record = T.writeVal oprot $ from_GetNextChunk_args record-encode_GetNextChunk_args :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_args -> LBS.ByteString-encode_GetNextChunk_args oprot record = T.serializeVal oprot $ from_GetNextChunk_args record-to_GetNextChunk_args :: T.ThriftVal -> GetNextChunk_args-to_GetNextChunk_args (T.TStruct fields) = GetNextChunk_args{- getNextChunk_args_sessionId = P.maybe (getNextChunk_args_sessionId default_GetNextChunk_args) (\(_,_val106) -> (case _val106 of {T.TStruct _val107 -> (Uuid_Types.to_UUID (T.TStruct _val107)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetNextChunk_args _ = P.error "not a struct"-read_GetNextChunk_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetNextChunk_args-read_GetNextChunk_args iprot = to_GetNextChunk_args <$> T.readVal iprot (T.T_STRUCT typemap_GetNextChunk_args)-decode_GetNextChunk_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetNextChunk_args-decode_GetNextChunk_args iprot bs = to_GetNextChunk_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetNextChunk_args) bs-typemap_GetNextChunk_args :: T.TypeMap-typemap_GetNextChunk_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_GetNextChunk_args :: GetNextChunk_args-default_GetNextChunk_args = GetNextChunk_args{- getNextChunk_args_sessionId = Uuid_Types.default_UUID}-data GetNextChunk_result = GetNextChunk_result { getNextChunk_result_success :: (Vector.Vector Services_Types.AnnotationUnitIdentifier)- , getNextChunk_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetNextChunk_result where- hashWithSalt salt record = salt `H.hashWithSalt` getNextChunk_result_success record `H.hashWithSalt` getNextChunk_result_ex record -instance QC.Arbitrary GetNextChunk_result where - arbitrary = M.liftM GetNextChunk_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetNextChunk_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetNextChunk_result{getNextChunk_result_success = getNextChunk_result_success obj} then P.Nothing else P.Just $ default_GetNextChunk_result{getNextChunk_result_success = getNextChunk_result_success obj}- , if obj == default_GetNextChunk_result{getNextChunk_result_ex = getNextChunk_result_ex obj} then P.Nothing else P.Just $ default_GetNextChunk_result{getNextChunk_result_ex = getNextChunk_result_ex obj}- ]-from_GetNextChunk_result :: GetNextChunk_result -> T.ThriftVal-from_GetNextChunk_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v110 -> (1, ("ex",Services_Types.from_ServicesException _v110))) <$> getNextChunk_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v110 -> P.Just (0, ("success",T.TList (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier) $ P.map (\_v112 -> Services_Types.from_AnnotationUnitIdentifier _v112) $ Vector.toList _v110))) $ getNextChunk_result_success record- , (\_v110 -> (1, ("ex",Services_Types.from_ServicesException _v110))) <$> getNextChunk_result_ex record- ]- )-write_GetNextChunk_result :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_result -> P.IO ()-write_GetNextChunk_result oprot record = T.writeVal oprot $ from_GetNextChunk_result record-encode_GetNextChunk_result :: (T.Protocol p, T.Transport t) => p t -> GetNextChunk_result -> LBS.ByteString-encode_GetNextChunk_result oprot record = T.serializeVal oprot $ from_GetNextChunk_result record-to_GetNextChunk_result :: T.ThriftVal -> GetNextChunk_result-to_GetNextChunk_result (T.TStruct fields) = GetNextChunk_result{- getNextChunk_result_success = P.maybe (getNextChunk_result_success default_GetNextChunk_result) (\(_,_val114) -> (case _val114 of {T.TList _ _val115 -> (Vector.fromList $ P.map (\_v116 -> (case _v116 of {T.TStruct _val117 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val117)); _ -> P.error "wrong type"})) _val115); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getNextChunk_result_ex = P.maybe (P.Nothing) (\(_,_val114) -> P.Just (case _val114 of {T.TStruct _val118 -> (Services_Types.to_ServicesException (T.TStruct _val118)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetNextChunk_result _ = P.error "not a struct"-read_GetNextChunk_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetNextChunk_result-read_GetNextChunk_result iprot = to_GetNextChunk_result <$> T.readVal iprot (T.T_STRUCT typemap_GetNextChunk_result)-decode_GetNextChunk_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetNextChunk_result-decode_GetNextChunk_result iprot bs = to_GetNextChunk_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetNextChunk_result) bs-typemap_GetNextChunk_result :: T.TypeMap-typemap_GetNextChunk_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetNextChunk_result :: GetNextChunk_result-default_GetNextChunk_result = GetNextChunk_result{- getNextChunk_result_success = Vector.empty,- getNextChunk_result_ex = P.Nothing}-data SubmitAnnotation_args = SubmitAnnotation_args { submitAnnotation_args_sessionId :: Uuid_Types.UUID- , submitAnnotation_args_unitId :: Services_Types.AnnotationUnitIdentifier- , submitAnnotation_args_communication :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitAnnotation_args where- hashWithSalt salt record = salt `H.hashWithSalt` submitAnnotation_args_sessionId record `H.hashWithSalt` submitAnnotation_args_unitId record `H.hashWithSalt` submitAnnotation_args_communication record -instance QC.Arbitrary SubmitAnnotation_args where - arbitrary = M.liftM SubmitAnnotation_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SubmitAnnotation_args = []- | P.otherwise = M.catMaybes- [ if obj == default_SubmitAnnotation_args{submitAnnotation_args_sessionId = submitAnnotation_args_sessionId obj} then P.Nothing else P.Just $ default_SubmitAnnotation_args{submitAnnotation_args_sessionId = submitAnnotation_args_sessionId obj}- , if obj == default_SubmitAnnotation_args{submitAnnotation_args_unitId = submitAnnotation_args_unitId obj} then P.Nothing else P.Just $ default_SubmitAnnotation_args{submitAnnotation_args_unitId = submitAnnotation_args_unitId obj}- , if obj == default_SubmitAnnotation_args{submitAnnotation_args_communication = submitAnnotation_args_communication obj} then P.Nothing else P.Just $ default_SubmitAnnotation_args{submitAnnotation_args_communication = submitAnnotation_args_communication obj}- ]-from_SubmitAnnotation_args :: SubmitAnnotation_args -> T.ThriftVal-from_SubmitAnnotation_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v121 -> P.Just (1, ("sessionId",Uuid_Types.from_UUID _v121))) $ submitAnnotation_args_sessionId record- , (\_v121 -> P.Just (2, ("unitId",Services_Types.from_AnnotationUnitIdentifier _v121))) $ submitAnnotation_args_unitId record- , (\_v121 -> P.Just (3, ("communication",Communication_Types.from_Communication _v121))) $ submitAnnotation_args_communication record- ]-write_SubmitAnnotation_args :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_args -> P.IO ()-write_SubmitAnnotation_args oprot record = T.writeVal oprot $ from_SubmitAnnotation_args record-encode_SubmitAnnotation_args :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_args -> LBS.ByteString-encode_SubmitAnnotation_args oprot record = T.serializeVal oprot $ from_SubmitAnnotation_args record-to_SubmitAnnotation_args :: T.ThriftVal -> SubmitAnnotation_args-to_SubmitAnnotation_args (T.TStruct fields) = SubmitAnnotation_args{- submitAnnotation_args_sessionId = P.maybe (submitAnnotation_args_sessionId default_SubmitAnnotation_args) (\(_,_val123) -> (case _val123 of {T.TStruct _val124 -> (Uuid_Types.to_UUID (T.TStruct _val124)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- submitAnnotation_args_unitId = P.maybe (submitAnnotation_args_unitId default_SubmitAnnotation_args) (\(_,_val123) -> (case _val123 of {T.TStruct _val125 -> (Services_Types.to_AnnotationUnitIdentifier (T.TStruct _val125)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- submitAnnotation_args_communication = P.maybe (submitAnnotation_args_communication default_SubmitAnnotation_args) (\(_,_val123) -> (case _val123 of {T.TStruct _val126 -> (Communication_Types.to_Communication (T.TStruct _val126)); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_SubmitAnnotation_args _ = P.error "not a struct"-read_SubmitAnnotation_args :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitAnnotation_args-read_SubmitAnnotation_args iprot = to_SubmitAnnotation_args <$> T.readVal iprot (T.T_STRUCT typemap_SubmitAnnotation_args)-decode_SubmitAnnotation_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitAnnotation_args-decode_SubmitAnnotation_args iprot bs = to_SubmitAnnotation_args $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitAnnotation_args) bs-typemap_SubmitAnnotation_args :: T.TypeMap-typemap_SubmitAnnotation_args = Map.fromList [(1,("sessionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("unitId",(T.T_STRUCT Services_Types.typemap_AnnotationUnitIdentifier))),(3,("communication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_SubmitAnnotation_args :: SubmitAnnotation_args-default_SubmitAnnotation_args = SubmitAnnotation_args{- submitAnnotation_args_sessionId = Uuid_Types.default_UUID,- submitAnnotation_args_unitId = Services_Types.default_AnnotationUnitIdentifier,- submitAnnotation_args_communication = Communication_Types.default_Communication}-data SubmitAnnotation_result = SubmitAnnotation_result { submitAnnotation_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SubmitAnnotation_result where- hashWithSalt salt record = salt `H.hashWithSalt` submitAnnotation_result_ex record -instance QC.Arbitrary SubmitAnnotation_result where - arbitrary = M.liftM SubmitAnnotation_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SubmitAnnotation_result = []- | P.otherwise = M.catMaybes- [ if obj == default_SubmitAnnotation_result{submitAnnotation_result_ex = submitAnnotation_result_ex obj} then P.Nothing else P.Just $ default_SubmitAnnotation_result{submitAnnotation_result_ex = submitAnnotation_result_ex obj}- ]-from_SubmitAnnotation_result :: SubmitAnnotation_result -> T.ThriftVal-from_SubmitAnnotation_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v129 -> (1, ("ex",Services_Types.from_ServicesException _v129))) <$> submitAnnotation_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v129 -> (1, ("ex",Services_Types.from_ServicesException _v129))) <$> submitAnnotation_result_ex record- ]- )-write_SubmitAnnotation_result :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_result -> P.IO ()-write_SubmitAnnotation_result oprot record = T.writeVal oprot $ from_SubmitAnnotation_result record-encode_SubmitAnnotation_result :: (T.Protocol p, T.Transport t) => p t -> SubmitAnnotation_result -> LBS.ByteString-encode_SubmitAnnotation_result oprot record = T.serializeVal oprot $ from_SubmitAnnotation_result record-to_SubmitAnnotation_result :: T.ThriftVal -> SubmitAnnotation_result-to_SubmitAnnotation_result (T.TStruct fields) = SubmitAnnotation_result{- submitAnnotation_result_ex = P.maybe (P.Nothing) (\(_,_val131) -> P.Just (case _val131 of {T.TStruct _val132 -> (Services_Types.to_ServicesException (T.TStruct _val132)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_SubmitAnnotation_result _ = P.error "not a struct"-read_SubmitAnnotation_result :: (T.Transport t, T.Protocol p) => p t -> P.IO SubmitAnnotation_result-read_SubmitAnnotation_result iprot = to_SubmitAnnotation_result <$> T.readVal iprot (T.T_STRUCT typemap_SubmitAnnotation_result)-decode_SubmitAnnotation_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SubmitAnnotation_result-decode_SubmitAnnotation_result iprot bs = to_SubmitAnnotation_result $ T.deserializeVal iprot (T.T_STRUCT typemap_SubmitAnnotation_result) bs-typemap_SubmitAnnotation_result :: T.TypeMap-typemap_SubmitAnnotation_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_SubmitAnnotation_result :: SubmitAnnotation_result-default_SubmitAnnotation_result = SubmitAnnotation_result{- submitAnnotation_result_ex = P.Nothing}-process_registerSearchResult (seqid, iprot, oprot, handler) = do- args <- read_RegisterSearchResult_args iprot- (X.catch- (X.catch- (do- Iface.registerSearchResult handler (registerSearchResult_args_result args) (registerSearchResult_args_taskType args)- let res = default_RegisterSearchResult_result- T.writeMessageBegin oprot ("registerSearchResult", T.M_REPLY, seqid)- write_RegisterSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_RegisterSearchResult_result{registerSearchResult_result_ex = P.Just e}- T.writeMessageBegin oprot ("registerSearchResult", T.M_REPLY, seqid)- write_RegisterSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("registerSearchResult", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getSearchResults (seqid, iprot, oprot, handler) = do- args <- read_GetSearchResults_args iprot- (X.catch- (X.catch- (do- val <- Iface.getSearchResults handler (getSearchResults_args_taskType args) (getSearchResults_args_limit args)- let res = default_GetSearchResults_result{getSearchResults_result_success = val}- T.writeMessageBegin oprot ("getSearchResults", T.M_REPLY, seqid)- write_GetSearchResults_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetSearchResults_result{getSearchResults_result_ex = P.Just e}- T.writeMessageBegin oprot ("getSearchResults", T.M_REPLY, seqid)- write_GetSearchResults_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getSearchResults", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getSearchResultsByUser (seqid, iprot, oprot, handler) = do- args <- read_GetSearchResultsByUser_args iprot- (X.catch- (X.catch- (do- val <- Iface.getSearchResultsByUser handler (getSearchResultsByUser_args_taskType args) (getSearchResultsByUser_args_userId args) (getSearchResultsByUser_args_limit args)- let res = default_GetSearchResultsByUser_result{getSearchResultsByUser_result_success = val}- T.writeMessageBegin oprot ("getSearchResultsByUser", T.M_REPLY, seqid)- write_GetSearchResultsByUser_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetSearchResultsByUser_result{getSearchResultsByUser_result_ex = P.Just e}- T.writeMessageBegin oprot ("getSearchResultsByUser", T.M_REPLY, seqid)- write_GetSearchResultsByUser_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getSearchResultsByUser", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getLatestSearchResult (seqid, iprot, oprot, handler) = do- args <- read_GetLatestSearchResult_args iprot- (X.catch- (X.catch- (do- val <- Iface.getLatestSearchResult handler (getLatestSearchResult_args_userId args)- let res = default_GetLatestSearchResult_result{getLatestSearchResult_result_success = val}- T.writeMessageBegin oprot ("getLatestSearchResult", T.M_REPLY, seqid)- write_GetLatestSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetLatestSearchResult_result{getLatestSearchResult_result_ex = P.Just e}- T.writeMessageBegin oprot ("getLatestSearchResult", T.M_REPLY, seqid)- write_GetLatestSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getLatestSearchResult", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getSearchResult (seqid, iprot, oprot, handler) = do- args <- read_GetSearchResult_args iprot- (X.catch- (X.catch- (do- val <- Iface.getSearchResult handler (getSearchResult_args_searchResultId args)- let res = default_GetSearchResult_result{getSearchResult_result_success = val}- T.writeMessageBegin oprot ("getSearchResult", T.M_REPLY, seqid)- write_GetSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetSearchResult_result{getSearchResult_result_ex = P.Just e}- T.writeMessageBegin oprot ("getSearchResult", T.M_REPLY, seqid)- write_GetSearchResult_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getSearchResult", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_startSession (seqid, iprot, oprot, handler) = do- args <- read_StartSession_args iprot- (X.catch- (X.catch- (do- val <- Iface.startSession handler (startSession_args_searchResultId args) (startSession_args_taskType args)- let res = default_StartSession_result{startSession_result_success = val}- T.writeMessageBegin oprot ("startSession", T.M_REPLY, seqid)- write_StartSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_StartSession_result{startSession_result_ex = P.Just e}- T.writeMessageBegin oprot ("startSession", T.M_REPLY, seqid)- write_StartSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("startSession", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_stopSession (seqid, iprot, oprot, handler) = do- args <- read_StopSession_args iprot- (X.catch- (X.catch- (do- Iface.stopSession handler (stopSession_args_sessionId args)- let res = default_StopSession_result- T.writeMessageBegin oprot ("stopSession", T.M_REPLY, seqid)- write_StopSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_StopSession_result{stopSession_result_ex = P.Just e}- T.writeMessageBegin oprot ("stopSession", T.M_REPLY, seqid)- write_StopSession_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("stopSession", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getNextChunk (seqid, iprot, oprot, handler) = do- args <- read_GetNextChunk_args iprot- (X.catch- (X.catch- (do- val <- Iface.getNextChunk handler (getNextChunk_args_sessionId args)- let res = default_GetNextChunk_result{getNextChunk_result_success = val}- T.writeMessageBegin oprot ("getNextChunk", T.M_REPLY, seqid)- write_GetNextChunk_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetNextChunk_result{getNextChunk_result_ex = P.Just e}- T.writeMessageBegin oprot ("getNextChunk", T.M_REPLY, seqid)- write_GetNextChunk_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getNextChunk", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_submitAnnotation (seqid, iprot, oprot, handler) = do- args <- read_SubmitAnnotation_args iprot- (X.catch- (X.catch- (do- Iface.submitAnnotation handler (submitAnnotation_args_sessionId args) (submitAnnotation_args_unitId args) (submitAnnotation_args_communication args)- let res = default_SubmitAnnotation_result- T.writeMessageBegin oprot ("submitAnnotation", T.M_REPLY, seqid)- write_SubmitAnnotation_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_SubmitAnnotation_result{submitAnnotation_result_ex = P.Just e}- T.writeMessageBegin oprot ("submitAnnotation", T.M_REPLY, seqid)- write_SubmitAnnotation_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("submitAnnotation", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "registerSearchResult" -> process_registerSearchResult (seqid,iprot,oprot,handler)- "getSearchResults" -> process_getSearchResults (seqid,iprot,oprot,handler)- "getSearchResultsByUser" -> process_getSearchResultsByUser (seqid,iprot,oprot,handler)- "getLatestSearchResult" -> process_getLatestSearchResult (seqid,iprot,oprot,handler)- "getSearchResult" -> process_getSearchResult (seqid,iprot,oprot,handler)- "startSession" -> process_startSession (seqid,iprot,oprot,handler)- "stopSession" -> process_stopSession (seqid,iprot,oprot,handler)- "getNextChunk" -> process_getNextChunk (seqid,iprot,oprot,handler)- "submitAnnotation" -> process_submitAnnotation (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/ResultsServerService_Client.hs
@@ -1,203 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ResultsServerService_Client(registerSearchResult,getSearchResults,getSearchResultsByUser,getLatestSearchResult,getSearchResult,startSession,stopSession,getNextChunk,submitAnnotation) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import Results_Types-import ResultsServerService-seqid = R.newIORef 0-registerSearchResult (ip,op) arg_result arg_taskType = do- send_registerSearchResult op arg_result arg_taskType- recv_registerSearchResult ip-send_registerSearchResult op arg_result arg_taskType = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("registerSearchResult", T.M_CALL, seqn)- write_RegisterSearchResult_args op (RegisterSearchResult_args{registerSearchResult_args_result=arg_result,registerSearchResult_args_taskType=arg_taskType})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_registerSearchResult ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_RegisterSearchResult_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (registerSearchResult_result_ex res)- P.return ()-getSearchResults (ip,op) arg_taskType arg_limit = do- send_getSearchResults op arg_taskType arg_limit- recv_getSearchResults ip-send_getSearchResults op arg_taskType arg_limit = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getSearchResults", T.M_CALL, seqn)- write_GetSearchResults_args op (GetSearchResults_args{getSearchResults_args_taskType=arg_taskType,getSearchResults_args_limit=arg_limit})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getSearchResults ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetSearchResults_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getSearchResults_result_ex res)- P.return $ getSearchResults_result_success res-getSearchResultsByUser (ip,op) arg_taskType arg_userId arg_limit = do- send_getSearchResultsByUser op arg_taskType arg_userId arg_limit- recv_getSearchResultsByUser ip-send_getSearchResultsByUser op arg_taskType arg_userId arg_limit = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getSearchResultsByUser", T.M_CALL, seqn)- write_GetSearchResultsByUser_args op (GetSearchResultsByUser_args{getSearchResultsByUser_args_taskType=arg_taskType,getSearchResultsByUser_args_userId=arg_userId,getSearchResultsByUser_args_limit=arg_limit})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getSearchResultsByUser ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetSearchResultsByUser_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getSearchResultsByUser_result_ex res)- P.return $ getSearchResultsByUser_result_success res-getLatestSearchResult (ip,op) arg_userId = do- send_getLatestSearchResult op arg_userId- recv_getLatestSearchResult ip-send_getLatestSearchResult op arg_userId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getLatestSearchResult", T.M_CALL, seqn)- write_GetLatestSearchResult_args op (GetLatestSearchResult_args{getLatestSearchResult_args_userId=arg_userId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getLatestSearchResult ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetLatestSearchResult_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getLatestSearchResult_result_ex res)- P.return $ getLatestSearchResult_result_success res-getSearchResult (ip,op) arg_searchResultId = do- send_getSearchResult op arg_searchResultId- recv_getSearchResult ip-send_getSearchResult op arg_searchResultId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getSearchResult", T.M_CALL, seqn)- write_GetSearchResult_args op (GetSearchResult_args{getSearchResult_args_searchResultId=arg_searchResultId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getSearchResult ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetSearchResult_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getSearchResult_result_ex res)- P.return $ getSearchResult_result_success res-startSession (ip,op) arg_searchResultId arg_taskType = do- send_startSession op arg_searchResultId arg_taskType- recv_startSession ip-send_startSession op arg_searchResultId arg_taskType = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("startSession", T.M_CALL, seqn)- write_StartSession_args op (StartSession_args{startSession_args_searchResultId=arg_searchResultId,startSession_args_taskType=arg_taskType})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_startSession ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_StartSession_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (startSession_result_ex res)- P.return $ startSession_result_success res-stopSession (ip,op) arg_sessionId = do- send_stopSession op arg_sessionId- recv_stopSession ip-send_stopSession op arg_sessionId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("stopSession", T.M_CALL, seqn)- write_StopSession_args op (StopSession_args{stopSession_args_sessionId=arg_sessionId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_stopSession ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_StopSession_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (stopSession_result_ex res)- P.return ()-getNextChunk (ip,op) arg_sessionId = do- send_getNextChunk op arg_sessionId- recv_getNextChunk ip-send_getNextChunk op arg_sessionId = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getNextChunk", T.M_CALL, seqn)- write_GetNextChunk_args op (GetNextChunk_args{getNextChunk_args_sessionId=arg_sessionId})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getNextChunk ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetNextChunk_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getNextChunk_result_ex res)- P.return $ getNextChunk_result_success res-submitAnnotation (ip,op) arg_sessionId arg_unitId arg_communication = do- send_submitAnnotation op arg_sessionId arg_unitId arg_communication- recv_submitAnnotation ip-send_submitAnnotation op arg_sessionId arg_unitId arg_communication = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("submitAnnotation", T.M_CALL, seqn)- write_SubmitAnnotation_args op (SubmitAnnotation_args{submitAnnotation_args_sessionId=arg_sessionId,submitAnnotation_args_unitId=arg_unitId,submitAnnotation_args_communication=arg_communication})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_submitAnnotation ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_SubmitAnnotation_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (submitAnnotation_result_ex res)- P.return ()
− src/ResultsServerService_Iface.hs
@@ -1,58 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module ResultsServerService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import Results_Types--import Service_Iface-class Service_Iface a => ResultsServerService_Iface a where- registerSearchResult :: a -> Search_Types.SearchResult -> Services_Types.AnnotationTaskType -> P.IO ()- getSearchResults :: a -> Services_Types.AnnotationTaskType -> I.Int32 -> P.IO (Vector.Vector Search_Types.SearchResult)- getSearchResultsByUser :: a -> Services_Types.AnnotationTaskType -> LT.Text -> I.Int32 -> P.IO (Vector.Vector Search_Types.SearchResult)- getLatestSearchResult :: a -> LT.Text -> P.IO Search_Types.SearchResult- getSearchResult :: a -> Uuid_Types.UUID -> P.IO Search_Types.SearchResult- startSession :: a -> Uuid_Types.UUID -> Services_Types.AnnotationTaskType -> P.IO Uuid_Types.UUID- stopSession :: a -> Uuid_Types.UUID -> P.IO ()- getNextChunk :: a -> Uuid_Types.UUID -> P.IO (Vector.Vector Services_Types.AnnotationUnitIdentifier)- submitAnnotation :: a -> Uuid_Types.UUID -> Services_Types.AnnotationUnitIdentifier -> Communication_Types.Communication -> P.IO ()
− src/Results_Consts.hs
@@ -1,46 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Results_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types---import Results_Types
− src/Results_Types.hs
@@ -1,45 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Results_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Services_Types-import qualified Uuid_Types-import qualified Search_Types-import qualified Communication_Types--
− src/SearchProxyService.hs
@@ -1,443 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SearchProxyService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import qualified Service-import Search_Types-import qualified SearchProxyService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Search_args = Search_args { search_args_query :: SearchQuery- , search_args_provider :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_args where- hashWithSalt salt record = salt `H.hashWithSalt` search_args_query record `H.hashWithSalt` search_args_provider record -instance QC.Arbitrary Search_args where - arbitrary = M.liftM Search_args (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Search_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_args{search_args_query = search_args_query obj} then P.Nothing else P.Just $ default_Search_args{search_args_query = search_args_query obj}- , if obj == default_Search_args{search_args_provider = search_args_provider obj} then P.Nothing else P.Just $ default_Search_args{search_args_provider = search_args_provider obj}- ]-from_Search_args :: Search_args -> T.ThriftVal-from_Search_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v109 -> P.Just (1, ("query",from_SearchQuery _v109))) $ search_args_query record- , (\_v109 -> P.Just (2, ("provider",T.TString $ E.encodeUtf8 _v109))) $ search_args_provider record- ]-write_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> P.IO ()-write_Search_args oprot record = T.writeVal oprot $ from_Search_args record-encode_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> LBS.ByteString-encode_Search_args oprot record = T.serializeVal oprot $ from_Search_args record-to_Search_args :: T.ThriftVal -> Search_args-to_Search_args (T.TStruct fields) = Search_args{- search_args_query = P.maybe (search_args_query default_Search_args) (\(_,_val111) -> (case _val111 of {T.TStruct _val112 -> (to_SearchQuery (T.TStruct _val112)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- search_args_provider = P.maybe (search_args_provider default_Search_args) (\(_,_val111) -> (case _val111 of {T.TString _val113 -> E.decodeUtf8 _val113; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_Search_args _ = P.error "not a struct"-read_Search_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_args-read_Search_args iprot = to_Search_args <$> T.readVal iprot (T.T_STRUCT typemap_Search_args)-decode_Search_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_args-decode_Search_args iprot bs = to_Search_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_args) bs-typemap_Search_args :: T.TypeMap-typemap_Search_args = Map.fromList [(1,("query",(T.T_STRUCT typemap_SearchQuery))),(2,("provider",T.T_STRING))]-default_Search_args :: Search_args-default_Search_args = Search_args{- search_args_query = default_SearchQuery,- search_args_provider = ""}-data Search_result = Search_result { search_result_success :: SearchResult- , search_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_result where- hashWithSalt salt record = salt `H.hashWithSalt` search_result_success record `H.hashWithSalt` search_result_ex record -instance QC.Arbitrary Search_result where - arbitrary = M.liftM Search_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Search_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_result{search_result_success = search_result_success obj} then P.Nothing else P.Just $ default_Search_result{search_result_success = search_result_success obj}- , if obj == default_Search_result{search_result_ex = search_result_ex obj} then P.Nothing else P.Just $ default_Search_result{search_result_ex = search_result_ex obj}- ]-from_Search_result :: Search_result -> T.ThriftVal-from_Search_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v116 -> (1, ("ex",Services_Types.from_ServicesException _v116))) <$> search_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v116 -> P.Just (0, ("success",from_SearchResult _v116))) $ search_result_success record- , (\_v116 -> (1, ("ex",Services_Types.from_ServicesException _v116))) <$> search_result_ex record- ]- )-write_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> P.IO ()-write_Search_result oprot record = T.writeVal oprot $ from_Search_result record-encode_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> LBS.ByteString-encode_Search_result oprot record = T.serializeVal oprot $ from_Search_result record-to_Search_result :: T.ThriftVal -> Search_result-to_Search_result (T.TStruct fields) = Search_result{- search_result_success = P.maybe (search_result_success default_Search_result) (\(_,_val118) -> (case _val118 of {T.TStruct _val119 -> (to_SearchResult (T.TStruct _val119)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- search_result_ex = P.maybe (P.Nothing) (\(_,_val118) -> P.Just (case _val118 of {T.TStruct _val120 -> (Services_Types.to_ServicesException (T.TStruct _val120)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Search_result _ = P.error "not a struct"-read_Search_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_result-read_Search_result iprot = to_Search_result <$> T.readVal iprot (T.T_STRUCT typemap_Search_result)-decode_Search_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_result-decode_Search_result iprot bs = to_Search_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_result) bs-typemap_Search_result :: T.TypeMap-typemap_Search_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Search_result :: Search_result-default_Search_result = Search_result{- search_result_success = default_SearchResult,- search_result_ex = P.Nothing}-data GetProviders_args = GetProviders_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetProviders_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetProviders_args where - arbitrary = QC.elements [GetProviders_args]-from_GetProviders_args :: GetProviders_args -> T.ThriftVal-from_GetProviders_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetProviders_args :: (T.Protocol p, T.Transport t) => p t -> GetProviders_args -> P.IO ()-write_GetProviders_args oprot record = T.writeVal oprot $ from_GetProviders_args record-encode_GetProviders_args :: (T.Protocol p, T.Transport t) => p t -> GetProviders_args -> LBS.ByteString-encode_GetProviders_args oprot record = T.serializeVal oprot $ from_GetProviders_args record-to_GetProviders_args :: T.ThriftVal -> GetProviders_args-to_GetProviders_args (T.TStruct fields) = GetProviders_args{-- }-to_GetProviders_args _ = P.error "not a struct"-read_GetProviders_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetProviders_args-read_GetProviders_args iprot = to_GetProviders_args <$> T.readVal iprot (T.T_STRUCT typemap_GetProviders_args)-decode_GetProviders_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetProviders_args-decode_GetProviders_args iprot bs = to_GetProviders_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetProviders_args) bs-typemap_GetProviders_args :: T.TypeMap-typemap_GetProviders_args = Map.fromList []-default_GetProviders_args :: GetProviders_args-default_GetProviders_args = GetProviders_args{-}-data GetProviders_result = GetProviders_result { getProviders_result_success :: (Vector.Vector LT.Text)- , getProviders_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetProviders_result where- hashWithSalt salt record = salt `H.hashWithSalt` getProviders_result_success record `H.hashWithSalt` getProviders_result_ex record -instance QC.Arbitrary GetProviders_result where - arbitrary = M.liftM GetProviders_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetProviders_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetProviders_result{getProviders_result_success = getProviders_result_success obj} then P.Nothing else P.Just $ default_GetProviders_result{getProviders_result_success = getProviders_result_success obj}- , if obj == default_GetProviders_result{getProviders_result_ex = getProviders_result_ex obj} then P.Nothing else P.Just $ default_GetProviders_result{getProviders_result_ex = getProviders_result_ex obj}- ]-from_GetProviders_result :: GetProviders_result -> T.ThriftVal-from_GetProviders_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v128 -> (1, ("ex",Services_Types.from_ServicesException _v128))) <$> getProviders_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v128 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v130 -> T.TString $ E.encodeUtf8 _v130) $ Vector.toList _v128))) $ getProviders_result_success record- , (\_v128 -> (1, ("ex",Services_Types.from_ServicesException _v128))) <$> getProviders_result_ex record- ]- )-write_GetProviders_result :: (T.Protocol p, T.Transport t) => p t -> GetProviders_result -> P.IO ()-write_GetProviders_result oprot record = T.writeVal oprot $ from_GetProviders_result record-encode_GetProviders_result :: (T.Protocol p, T.Transport t) => p t -> GetProviders_result -> LBS.ByteString-encode_GetProviders_result oprot record = T.serializeVal oprot $ from_GetProviders_result record-to_GetProviders_result :: T.ThriftVal -> GetProviders_result-to_GetProviders_result (T.TStruct fields) = GetProviders_result{- getProviders_result_success = P.maybe (getProviders_result_success default_GetProviders_result) (\(_,_val132) -> (case _val132 of {T.TList _ _val133 -> (Vector.fromList $ P.map (\_v134 -> (case _v134 of {T.TString _val135 -> E.decodeUtf8 _val135; _ -> P.error "wrong type"})) _val133); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getProviders_result_ex = P.maybe (P.Nothing) (\(_,_val132) -> P.Just (case _val132 of {T.TStruct _val136 -> (Services_Types.to_ServicesException (T.TStruct _val136)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetProviders_result _ = P.error "not a struct"-read_GetProviders_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetProviders_result-read_GetProviders_result iprot = to_GetProviders_result <$> T.readVal iprot (T.T_STRUCT typemap_GetProviders_result)-decode_GetProviders_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetProviders_result-decode_GetProviders_result iprot bs = to_GetProviders_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetProviders_result) bs-typemap_GetProviders_result :: T.TypeMap-typemap_GetProviders_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetProviders_result :: GetProviders_result-default_GetProviders_result = GetProviders_result{- getProviders_result_success = Vector.empty,- getProviders_result_ex = P.Nothing}-data GetCapabilities_args = GetCapabilities_args { getCapabilities_args_provider :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_args where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_args_provider record -instance QC.Arbitrary GetCapabilities_args where - arbitrary = M.liftM GetCapabilities_args (QC.arbitrary)- shrink obj | obj == default_GetCapabilities_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_args{getCapabilities_args_provider = getCapabilities_args_provider obj} then P.Nothing else P.Just $ default_GetCapabilities_args{getCapabilities_args_provider = getCapabilities_args_provider obj}- ]-from_GetCapabilities_args :: GetCapabilities_args -> T.ThriftVal-from_GetCapabilities_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v139 -> P.Just (1, ("provider",T.TString $ E.encodeUtf8 _v139))) $ getCapabilities_args_provider record- ]-write_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> P.IO ()-write_GetCapabilities_args oprot record = T.writeVal oprot $ from_GetCapabilities_args record-encode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> LBS.ByteString-encode_GetCapabilities_args oprot record = T.serializeVal oprot $ from_GetCapabilities_args record-to_GetCapabilities_args :: T.ThriftVal -> GetCapabilities_args-to_GetCapabilities_args (T.TStruct fields) = GetCapabilities_args{- getCapabilities_args_provider = P.maybe (getCapabilities_args_provider default_GetCapabilities_args) (\(_,_val141) -> (case _val141 of {T.TString _val142 -> E.decodeUtf8 _val142; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_args _ = P.error "not a struct"-read_GetCapabilities_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_args-read_GetCapabilities_args iprot = to_GetCapabilities_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_args)-decode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_args-decode_GetCapabilities_args iprot bs = to_GetCapabilities_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_args) bs-typemap_GetCapabilities_args :: T.TypeMap-typemap_GetCapabilities_args = Map.fromList [(1,("provider",T.T_STRING))]-default_GetCapabilities_args :: GetCapabilities_args-default_GetCapabilities_args = GetCapabilities_args{- getCapabilities_args_provider = ""}-data GetCapabilities_result = GetCapabilities_result { getCapabilities_result_success :: (Vector.Vector SearchCapability)- , getCapabilities_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_result_success record `H.hashWithSalt` getCapabilities_result_ex record -instance QC.Arbitrary GetCapabilities_result where - arbitrary = M.liftM GetCapabilities_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCapabilities_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj}- , if obj == default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj}- ]-from_GetCapabilities_result :: GetCapabilities_result -> T.ThriftVal-from_GetCapabilities_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v145 -> (1, ("ex",Services_Types.from_ServicesException _v145))) <$> getCapabilities_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v145 -> P.Just (0, ("success",T.TList (T.T_STRUCT typemap_SearchCapability) $ P.map (\_v147 -> from_SearchCapability _v147) $ Vector.toList _v145))) $ getCapabilities_result_success record- , (\_v145 -> (1, ("ex",Services_Types.from_ServicesException _v145))) <$> getCapabilities_result_ex record- ]- )-write_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> P.IO ()-write_GetCapabilities_result oprot record = T.writeVal oprot $ from_GetCapabilities_result record-encode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> LBS.ByteString-encode_GetCapabilities_result oprot record = T.serializeVal oprot $ from_GetCapabilities_result record-to_GetCapabilities_result :: T.ThriftVal -> GetCapabilities_result-to_GetCapabilities_result (T.TStruct fields) = GetCapabilities_result{- getCapabilities_result_success = P.maybe (getCapabilities_result_success default_GetCapabilities_result) (\(_,_val149) -> (case _val149 of {T.TList _ _val150 -> (Vector.fromList $ P.map (\_v151 -> (case _v151 of {T.TStruct _val152 -> (to_SearchCapability (T.TStruct _val152)); _ -> P.error "wrong type"})) _val150); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCapabilities_result_ex = P.maybe (P.Nothing) (\(_,_val149) -> P.Just (case _val149 of {T.TStruct _val153 -> (Services_Types.to_ServicesException (T.TStruct _val153)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_result _ = P.error "not a struct"-read_GetCapabilities_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_result-read_GetCapabilities_result iprot = to_GetCapabilities_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_result)-decode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_result-decode_GetCapabilities_result iprot bs = to_GetCapabilities_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_result) bs-typemap_GetCapabilities_result :: T.TypeMap-typemap_GetCapabilities_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT typemap_SearchCapability)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCapabilities_result :: GetCapabilities_result-default_GetCapabilities_result = GetCapabilities_result{- getCapabilities_result_success = Vector.empty,- getCapabilities_result_ex = P.Nothing}-data GetCorpora_args = GetCorpora_args { getCorpora_args_provider :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_args where- hashWithSalt salt record = salt `H.hashWithSalt` getCorpora_args_provider record -instance QC.Arbitrary GetCorpora_args where - arbitrary = M.liftM GetCorpora_args (QC.arbitrary)- shrink obj | obj == default_GetCorpora_args = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCorpora_args{getCorpora_args_provider = getCorpora_args_provider obj} then P.Nothing else P.Just $ default_GetCorpora_args{getCorpora_args_provider = getCorpora_args_provider obj}- ]-from_GetCorpora_args :: GetCorpora_args -> T.ThriftVal-from_GetCorpora_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v156 -> P.Just (1, ("provider",T.TString $ E.encodeUtf8 _v156))) $ getCorpora_args_provider record- ]-write_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> P.IO ()-write_GetCorpora_args oprot record = T.writeVal oprot $ from_GetCorpora_args record-encode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> LBS.ByteString-encode_GetCorpora_args oprot record = T.serializeVal oprot $ from_GetCorpora_args record-to_GetCorpora_args :: T.ThriftVal -> GetCorpora_args-to_GetCorpora_args (T.TStruct fields) = GetCorpora_args{- getCorpora_args_provider = P.maybe (getCorpora_args_provider default_GetCorpora_args) (\(_,_val158) -> (case _val158 of {T.TString _val159 -> E.decodeUtf8 _val159; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCorpora_args _ = P.error "not a struct"-read_GetCorpora_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_args-read_GetCorpora_args iprot = to_GetCorpora_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_args)-decode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_args-decode_GetCorpora_args iprot bs = to_GetCorpora_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_args) bs-typemap_GetCorpora_args :: T.TypeMap-typemap_GetCorpora_args = Map.fromList [(1,("provider",T.T_STRING))]-default_GetCorpora_args :: GetCorpora_args-default_GetCorpora_args = GetCorpora_args{- getCorpora_args_provider = ""}-data GetCorpora_result = GetCorpora_result { getCorpora_result_success :: (Vector.Vector LT.Text)- , getCorpora_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCorpora_result_success record `H.hashWithSalt` getCorpora_result_ex record -instance QC.Arbitrary GetCorpora_result where - arbitrary = M.liftM GetCorpora_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCorpora_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj}- , if obj == default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj}- ]-from_GetCorpora_result :: GetCorpora_result -> T.ThriftVal-from_GetCorpora_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v162 -> (1, ("ex",Services_Types.from_ServicesException _v162))) <$> getCorpora_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v162 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v164 -> T.TString $ E.encodeUtf8 _v164) $ Vector.toList _v162))) $ getCorpora_result_success record- , (\_v162 -> (1, ("ex",Services_Types.from_ServicesException _v162))) <$> getCorpora_result_ex record- ]- )-write_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> P.IO ()-write_GetCorpora_result oprot record = T.writeVal oprot $ from_GetCorpora_result record-encode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> LBS.ByteString-encode_GetCorpora_result oprot record = T.serializeVal oprot $ from_GetCorpora_result record-to_GetCorpora_result :: T.ThriftVal -> GetCorpora_result-to_GetCorpora_result (T.TStruct fields) = GetCorpora_result{- getCorpora_result_success = P.maybe (getCorpora_result_success default_GetCorpora_result) (\(_,_val166) -> (case _val166 of {T.TList _ _val167 -> (Vector.fromList $ P.map (\_v168 -> (case _v168 of {T.TString _val169 -> E.decodeUtf8 _val169; _ -> P.error "wrong type"})) _val167); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCorpora_result_ex = P.maybe (P.Nothing) (\(_,_val166) -> P.Just (case _val166 of {T.TStruct _val170 -> (Services_Types.to_ServicesException (T.TStruct _val170)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCorpora_result _ = P.error "not a struct"-read_GetCorpora_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_result-read_GetCorpora_result iprot = to_GetCorpora_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_result)-decode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_result-decode_GetCorpora_result iprot bs = to_GetCorpora_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_result) bs-typemap_GetCorpora_result :: T.TypeMap-typemap_GetCorpora_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCorpora_result :: GetCorpora_result-default_GetCorpora_result = GetCorpora_result{- getCorpora_result_success = Vector.empty,- getCorpora_result_ex = P.Nothing}-process_search (seqid, iprot, oprot, handler) = do- args <- read_Search_args iprot- (X.catch- (X.catch- (do- val <- Iface.search handler (search_args_query args) (search_args_provider args)- let res = default_Search_result{search_result_success = val}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Search_result{search_result_ex = P.Just e}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("search", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getProviders (seqid, iprot, oprot, handler) = do- args <- read_GetProviders_args iprot- (X.catch- (X.catch- (do- val <- Iface.getProviders handler- let res = default_GetProviders_result{getProviders_result_success = val}- T.writeMessageBegin oprot ("getProviders", T.M_REPLY, seqid)- write_GetProviders_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetProviders_result{getProviders_result_ex = P.Just e}- T.writeMessageBegin oprot ("getProviders", T.M_REPLY, seqid)- write_GetProviders_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getProviders", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCapabilities (seqid, iprot, oprot, handler) = do- args <- read_GetCapabilities_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCapabilities handler (getCapabilities_args_provider args)- let res = default_GetCapabilities_result{getCapabilities_result_success = val}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCapabilities_result{getCapabilities_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCapabilities", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCorpora (seqid, iprot, oprot, handler) = do- args <- read_GetCorpora_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCorpora handler (getCorpora_args_provider args)- let res = default_GetCorpora_result{getCorpora_result_success = val}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCorpora_result{getCorpora_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCorpora", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "search" -> process_search (seqid,iprot,oprot,handler)- "getProviders" -> process_getProviders (seqid,iprot,oprot,handler)- "getCapabilities" -> process_getCapabilities (seqid,iprot,oprot,handler)- "getCorpora" -> process_getCorpora (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/SearchProxyService_Client.hs
@@ -1,120 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SearchProxyService_Client(search,getProviders,getCapabilities,getCorpora) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types-import SearchProxyService-seqid = R.newIORef 0-search (ip,op) arg_query arg_provider = do- send_search op arg_query arg_provider- recv_search ip-send_search op arg_query arg_provider = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("search", T.M_CALL, seqn)- write_Search_args op (Search_args{search_args_query=arg_query,search_args_provider=arg_provider})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_search ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Search_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (search_result_ex res)- P.return $ search_result_success res-getProviders (ip,op) = do- send_getProviders op- recv_getProviders ip-send_getProviders op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getProviders", T.M_CALL, seqn)- write_GetProviders_args op (GetProviders_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getProviders ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetProviders_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getProviders_result_ex res)- P.return $ getProviders_result_success res-getCapabilities (ip,op) arg_provider = do- send_getCapabilities op arg_provider- recv_getCapabilities ip-send_getCapabilities op arg_provider = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCapabilities", T.M_CALL, seqn)- write_GetCapabilities_args op (GetCapabilities_args{getCapabilities_args_provider=arg_provider})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCapabilities ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCapabilities_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCapabilities_result_ex res)- P.return $ getCapabilities_result_success res-getCorpora (ip,op) arg_provider = do- send_getCorpora op arg_provider- recv_getCorpora ip-send_getCorpora op arg_provider = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCorpora", T.M_CALL, seqn)- write_GetCorpora_args op (GetCorpora_args{getCorpora_args_provider=arg_provider})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCorpora ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCorpora_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCorpora_result_ex res)- P.return $ getCorpora_result_success res
− src/SearchProxyService_Iface.hs
@@ -1,55 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SearchProxyService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types--import Service_Iface-class Service_Iface a => SearchProxyService_Iface a where- search :: a -> SearchQuery -> LT.Text -> P.IO SearchResult- getProviders :: a -> P.IO (Vector.Vector LT.Text)- getCapabilities :: a -> LT.Text -> P.IO (Vector.Vector SearchCapability)- getCorpora :: a -> LT.Text -> P.IO (Vector.Vector LT.Text)
− src/SearchService.hs
@@ -1,335 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SearchService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import qualified Service-import Search_Types-import qualified SearchService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Search_args = Search_args { search_args_query :: SearchQuery- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_args where- hashWithSalt salt record = salt `H.hashWithSalt` search_args_query record -instance QC.Arbitrary Search_args where - arbitrary = M.liftM Search_args (QC.arbitrary)- shrink obj | obj == default_Search_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_args{search_args_query = search_args_query obj} then P.Nothing else P.Just $ default_Search_args{search_args_query = search_args_query obj}- ]-from_Search_args :: Search_args -> T.ThriftVal-from_Search_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v64 -> P.Just (1, ("query",from_SearchQuery _v64))) $ search_args_query record- ]-write_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> P.IO ()-write_Search_args oprot record = T.writeVal oprot $ from_Search_args record-encode_Search_args :: (T.Protocol p, T.Transport t) => p t -> Search_args -> LBS.ByteString-encode_Search_args oprot record = T.serializeVal oprot $ from_Search_args record-to_Search_args :: T.ThriftVal -> Search_args-to_Search_args (T.TStruct fields) = Search_args{- search_args_query = P.maybe (search_args_query default_Search_args) (\(_,_val66) -> (case _val66 of {T.TStruct _val67 -> (to_SearchQuery (T.TStruct _val67)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Search_args _ = P.error "not a struct"-read_Search_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_args-read_Search_args iprot = to_Search_args <$> T.readVal iprot (T.T_STRUCT typemap_Search_args)-decode_Search_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_args-decode_Search_args iprot bs = to_Search_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_args) bs-typemap_Search_args :: T.TypeMap-typemap_Search_args = Map.fromList [(1,("query",(T.T_STRUCT typemap_SearchQuery)))]-default_Search_args :: Search_args-default_Search_args = Search_args{- search_args_query = default_SearchQuery}-data Search_result = Search_result { search_result_success :: SearchResult- , search_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Search_result where- hashWithSalt salt record = salt `H.hashWithSalt` search_result_success record `H.hashWithSalt` search_result_ex record -instance QC.Arbitrary Search_result where - arbitrary = M.liftM Search_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Search_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Search_result{search_result_success = search_result_success obj} then P.Nothing else P.Just $ default_Search_result{search_result_success = search_result_success obj}- , if obj == default_Search_result{search_result_ex = search_result_ex obj} then P.Nothing else P.Just $ default_Search_result{search_result_ex = search_result_ex obj}- ]-from_Search_result :: Search_result -> T.ThriftVal-from_Search_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v70 -> (1, ("ex",Services_Types.from_ServicesException _v70))) <$> search_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v70 -> P.Just (0, ("success",from_SearchResult _v70))) $ search_result_success record- , (\_v70 -> (1, ("ex",Services_Types.from_ServicesException _v70))) <$> search_result_ex record- ]- )-write_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> P.IO ()-write_Search_result oprot record = T.writeVal oprot $ from_Search_result record-encode_Search_result :: (T.Protocol p, T.Transport t) => p t -> Search_result -> LBS.ByteString-encode_Search_result oprot record = T.serializeVal oprot $ from_Search_result record-to_Search_result :: T.ThriftVal -> Search_result-to_Search_result (T.TStruct fields) = Search_result{- search_result_success = P.maybe (search_result_success default_Search_result) (\(_,_val72) -> (case _val72 of {T.TStruct _val73 -> (to_SearchResult (T.TStruct _val73)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- search_result_ex = P.maybe (P.Nothing) (\(_,_val72) -> P.Just (case _val72 of {T.TStruct _val74 -> (Services_Types.to_ServicesException (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Search_result _ = P.error "not a struct"-read_Search_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Search_result-read_Search_result iprot = to_Search_result <$> T.readVal iprot (T.T_STRUCT typemap_Search_result)-decode_Search_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Search_result-decode_Search_result iprot bs = to_Search_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Search_result) bs-typemap_Search_result :: T.TypeMap-typemap_Search_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_SearchResult))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Search_result :: Search_result-default_Search_result = Search_result{- search_result_success = default_SearchResult,- search_result_ex = P.Nothing}-data GetCapabilities_args = GetCapabilities_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCapabilities_args where - arbitrary = QC.elements [GetCapabilities_args]-from_GetCapabilities_args :: GetCapabilities_args -> T.ThriftVal-from_GetCapabilities_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> P.IO ()-write_GetCapabilities_args oprot record = T.writeVal oprot $ from_GetCapabilities_args record-encode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> LBS.ByteString-encode_GetCapabilities_args oprot record = T.serializeVal oprot $ from_GetCapabilities_args record-to_GetCapabilities_args :: T.ThriftVal -> GetCapabilities_args-to_GetCapabilities_args (T.TStruct fields) = GetCapabilities_args{-- }-to_GetCapabilities_args _ = P.error "not a struct"-read_GetCapabilities_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_args-read_GetCapabilities_args iprot = to_GetCapabilities_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_args)-decode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_args-decode_GetCapabilities_args iprot bs = to_GetCapabilities_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_args) bs-typemap_GetCapabilities_args :: T.TypeMap-typemap_GetCapabilities_args = Map.fromList []-default_GetCapabilities_args :: GetCapabilities_args-default_GetCapabilities_args = GetCapabilities_args{-}-data GetCapabilities_result = GetCapabilities_result { getCapabilities_result_success :: (Vector.Vector SearchCapability)- , getCapabilities_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_result_success record `H.hashWithSalt` getCapabilities_result_ex record -instance QC.Arbitrary GetCapabilities_result where - arbitrary = M.liftM GetCapabilities_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCapabilities_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj}- , if obj == default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj}- ]-from_GetCapabilities_result :: GetCapabilities_result -> T.ThriftVal-from_GetCapabilities_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v82 -> (1, ("ex",Services_Types.from_ServicesException _v82))) <$> getCapabilities_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v82 -> P.Just (0, ("success",T.TList (T.T_STRUCT typemap_SearchCapability) $ P.map (\_v84 -> from_SearchCapability _v84) $ Vector.toList _v82))) $ getCapabilities_result_success record- , (\_v82 -> (1, ("ex",Services_Types.from_ServicesException _v82))) <$> getCapabilities_result_ex record- ]- )-write_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> P.IO ()-write_GetCapabilities_result oprot record = T.writeVal oprot $ from_GetCapabilities_result record-encode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> LBS.ByteString-encode_GetCapabilities_result oprot record = T.serializeVal oprot $ from_GetCapabilities_result record-to_GetCapabilities_result :: T.ThriftVal -> GetCapabilities_result-to_GetCapabilities_result (T.TStruct fields) = GetCapabilities_result{- getCapabilities_result_success = P.maybe (getCapabilities_result_success default_GetCapabilities_result) (\(_,_val86) -> (case _val86 of {T.TList _ _val87 -> (Vector.fromList $ P.map (\_v88 -> (case _v88 of {T.TStruct _val89 -> (to_SearchCapability (T.TStruct _val89)); _ -> P.error "wrong type"})) _val87); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCapabilities_result_ex = P.maybe (P.Nothing) (\(_,_val86) -> P.Just (case _val86 of {T.TStruct _val90 -> (Services_Types.to_ServicesException (T.TStruct _val90)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_result _ = P.error "not a struct"-read_GetCapabilities_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_result-read_GetCapabilities_result iprot = to_GetCapabilities_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_result)-decode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_result-decode_GetCapabilities_result iprot bs = to_GetCapabilities_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_result) bs-typemap_GetCapabilities_result :: T.TypeMap-typemap_GetCapabilities_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT typemap_SearchCapability)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCapabilities_result :: GetCapabilities_result-default_GetCapabilities_result = GetCapabilities_result{- getCapabilities_result_success = Vector.empty,- getCapabilities_result_ex = P.Nothing}-data GetCorpora_args = GetCorpora_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCorpora_args where - arbitrary = QC.elements [GetCorpora_args]-from_GetCorpora_args :: GetCorpora_args -> T.ThriftVal-from_GetCorpora_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> P.IO ()-write_GetCorpora_args oprot record = T.writeVal oprot $ from_GetCorpora_args record-encode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_args -> LBS.ByteString-encode_GetCorpora_args oprot record = T.serializeVal oprot $ from_GetCorpora_args record-to_GetCorpora_args :: T.ThriftVal -> GetCorpora_args-to_GetCorpora_args (T.TStruct fields) = GetCorpora_args{-- }-to_GetCorpora_args _ = P.error "not a struct"-read_GetCorpora_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_args-read_GetCorpora_args iprot = to_GetCorpora_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_args)-decode_GetCorpora_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_args-decode_GetCorpora_args iprot bs = to_GetCorpora_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_args) bs-typemap_GetCorpora_args :: T.TypeMap-typemap_GetCorpora_args = Map.fromList []-default_GetCorpora_args :: GetCorpora_args-default_GetCorpora_args = GetCorpora_args{-}-data GetCorpora_result = GetCorpora_result { getCorpora_result_success :: (Vector.Vector LT.Text)- , getCorpora_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCorpora_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCorpora_result_success record `H.hashWithSalt` getCorpora_result_ex record -instance QC.Arbitrary GetCorpora_result where - arbitrary = M.liftM GetCorpora_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCorpora_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_success = getCorpora_result_success obj}- , if obj == default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj} then P.Nothing else P.Just $ default_GetCorpora_result{getCorpora_result_ex = getCorpora_result_ex obj}- ]-from_GetCorpora_result :: GetCorpora_result -> T.ThriftVal-from_GetCorpora_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> getCorpora_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v98 -> P.Just (0, ("success",T.TList T.T_STRING $ P.map (\_v100 -> T.TString $ E.encodeUtf8 _v100) $ Vector.toList _v98))) $ getCorpora_result_success record- , (\_v98 -> (1, ("ex",Services_Types.from_ServicesException _v98))) <$> getCorpora_result_ex record- ]- )-write_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> P.IO ()-write_GetCorpora_result oprot record = T.writeVal oprot $ from_GetCorpora_result record-encode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> GetCorpora_result -> LBS.ByteString-encode_GetCorpora_result oprot record = T.serializeVal oprot $ from_GetCorpora_result record-to_GetCorpora_result :: T.ThriftVal -> GetCorpora_result-to_GetCorpora_result (T.TStruct fields) = GetCorpora_result{- getCorpora_result_success = P.maybe (getCorpora_result_success default_GetCorpora_result) (\(_,_val102) -> (case _val102 of {T.TList _ _val103 -> (Vector.fromList $ P.map (\_v104 -> (case _v104 of {T.TString _val105 -> E.decodeUtf8 _val105; _ -> P.error "wrong type"})) _val103); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCorpora_result_ex = P.maybe (P.Nothing) (\(_,_val102) -> P.Just (case _val102 of {T.TStruct _val106 -> (Services_Types.to_ServicesException (T.TStruct _val106)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCorpora_result _ = P.error "not a struct"-read_GetCorpora_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCorpora_result-read_GetCorpora_result iprot = to_GetCorpora_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCorpora_result)-decode_GetCorpora_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCorpora_result-decode_GetCorpora_result iprot bs = to_GetCorpora_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCorpora_result) bs-typemap_GetCorpora_result :: T.TypeMap-typemap_GetCorpora_result = Map.fromList [(0,("success",(T.T_LIST T.T_STRING))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCorpora_result :: GetCorpora_result-default_GetCorpora_result = GetCorpora_result{- getCorpora_result_success = Vector.empty,- getCorpora_result_ex = P.Nothing}-process_search (seqid, iprot, oprot, handler) = do- args <- read_Search_args iprot- (X.catch- (X.catch- (do- val <- Iface.search handler (search_args_query args)- let res = default_Search_result{search_result_success = val}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Search_result{search_result_ex = P.Just e}- T.writeMessageBegin oprot ("search", T.M_REPLY, seqid)- write_Search_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("search", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCapabilities (seqid, iprot, oprot, handler) = do- args <- read_GetCapabilities_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCapabilities handler- let res = default_GetCapabilities_result{getCapabilities_result_success = val}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCapabilities_result{getCapabilities_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCapabilities", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCorpora (seqid, iprot, oprot, handler) = do- args <- read_GetCorpora_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCorpora handler- let res = default_GetCorpora_result{getCorpora_result_success = val}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCorpora_result{getCorpora_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCorpora", T.M_REPLY, seqid)- write_GetCorpora_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCorpora", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "search" -> process_search (seqid,iprot,oprot,handler)- "getCapabilities" -> process_getCapabilities (seqid,iprot,oprot,handler)- "getCorpora" -> process_getCorpora (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/SearchService_Client.hs
@@ -1,103 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SearchService_Client(search,getCapabilities,getCorpora) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types-import SearchService-seqid = R.newIORef 0-search (ip,op) arg_query = do- send_search op arg_query- recv_search ip-send_search op arg_query = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("search", T.M_CALL, seqn)- write_Search_args op (Search_args{search_args_query=arg_query})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_search ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Search_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (search_result_ex res)- P.return $ search_result_success res-getCapabilities (ip,op) = do- send_getCapabilities op- recv_getCapabilities ip-send_getCapabilities op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCapabilities", T.M_CALL, seqn)- write_GetCapabilities_args op (GetCapabilities_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCapabilities ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCapabilities_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCapabilities_result_ex res)- P.return $ getCapabilities_result_success res-getCorpora (ip,op) = do- send_getCorpora op- recv_getCorpora ip-send_getCorpora op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCorpora", T.M_CALL, seqn)- write_GetCorpora_args op (GetCorpora_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCorpora ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCorpora_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCorpora_result_ex res)- P.return $ getCorpora_result_success res
− src/SearchService_Iface.hs
@@ -1,54 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SearchService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types--import Service_Iface-class Service_Iface a => SearchService_Iface a where- search :: a -> SearchQuery -> P.IO SearchResult- getCapabilities :: a -> P.IO (Vector.Vector SearchCapability)- getCorpora :: a -> P.IO (Vector.Vector LT.Text)
− src/Search_Consts.hs
@@ -1,48 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Search_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---import Search_Types
− src/Search_Types.hs
@@ -1,345 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Search_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types-import qualified Metadata_Types-import qualified Entities_Types---data SearchType = COMMUNICATIONS|SECTIONS|SENTENCES|ENTITIES|ENTITY_MENTIONS|SITUATIONS|SITUATION_MENTIONS deriving (P.Show, P.Eq, G.Generic, TY.Typeable, P.Ord, P.Bounded)-instance P.Enum SearchType where- fromEnum t = case t of- COMMUNICATIONS -> 0- SECTIONS -> 1- SENTENCES -> 2- ENTITIES -> 3- ENTITY_MENTIONS -> 4- SITUATIONS -> 5- SITUATION_MENTIONS -> 6- toEnum t = case t of- 0 -> COMMUNICATIONS- 1 -> SECTIONS- 2 -> SENTENCES- 3 -> ENTITIES- 4 -> ENTITY_MENTIONS- 5 -> SITUATIONS- 6 -> SITUATION_MENTIONS- _ -> X.throw T.ThriftException-instance H.Hashable SearchType where- hashWithSalt salt = H.hashWithSalt salt P.. P.fromEnum-instance QC.Arbitrary SearchType where- arbitrary = QC.elements (P.enumFromTo P.minBound P.maxBound)-data SearchFeedback = NEGATIVE|NONE|POSITIVE deriving (P.Show, P.Eq, G.Generic, TY.Typeable, P.Ord, P.Bounded)-instance P.Enum SearchFeedback where- fromEnum t = case t of- NEGATIVE -> -1- NONE -> 0- POSITIVE -> 1- toEnum t = case t of- -1 -> NEGATIVE- 0 -> NONE- 1 -> POSITIVE- _ -> X.throw T.ThriftException-instance H.Hashable SearchFeedback where- hashWithSalt salt = H.hashWithSalt salt P.. P.fromEnum-instance QC.Arbitrary SearchFeedback where- arbitrary = QC.elements (P.enumFromTo P.minBound P.maxBound)-data SearchCapability = SearchCapability { searchCapability_type :: SearchType- , searchCapability_lang :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SearchCapability where- hashWithSalt salt record = salt `H.hashWithSalt` searchCapability_type record `H.hashWithSalt` searchCapability_lang record -instance QC.Arbitrary SearchCapability where - arbitrary = M.liftM SearchCapability (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SearchCapability = []- | P.otherwise = M.catMaybes- [ if obj == default_SearchCapability{searchCapability_type = searchCapability_type obj} then P.Nothing else P.Just $ default_SearchCapability{searchCapability_type = searchCapability_type obj}- , if obj == default_SearchCapability{searchCapability_lang = searchCapability_lang obj} then P.Nothing else P.Just $ default_SearchCapability{searchCapability_lang = searchCapability_lang obj}- ]-from_SearchCapability :: SearchCapability -> T.ThriftVal-from_SearchCapability record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("type",T.TI32 $ P.fromIntegral $ P.fromEnum _v2))) $ searchCapability_type record- , (\_v2 -> P.Just (2, ("lang",T.TString $ E.encodeUtf8 _v2))) $ searchCapability_lang record- ]-write_SearchCapability :: (T.Protocol p, T.Transport t) => p t -> SearchCapability -> P.IO ()-write_SearchCapability oprot record = T.writeVal oprot $ from_SearchCapability record-encode_SearchCapability :: (T.Protocol p, T.Transport t) => p t -> SearchCapability -> LBS.ByteString-encode_SearchCapability oprot record = T.serializeVal oprot $ from_SearchCapability record-to_SearchCapability :: T.ThriftVal -> SearchCapability-to_SearchCapability (T.TStruct fields) = SearchCapability{- searchCapability_type = P.maybe (P.error "Missing required field: type") (\(_,_val4) -> (case _val4 of {T.TI32 _val5 -> P.toEnum $ P.fromIntegral _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- searchCapability_lang = P.maybe (P.error "Missing required field: lang") (\(_,_val4) -> (case _val4 of {T.TString _val6 -> E.decodeUtf8 _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_SearchCapability _ = P.error "not a struct"-read_SearchCapability :: (T.Transport t, T.Protocol p) => p t -> P.IO SearchCapability-read_SearchCapability iprot = to_SearchCapability <$> T.readVal iprot (T.T_STRUCT typemap_SearchCapability)-decode_SearchCapability :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SearchCapability-decode_SearchCapability iprot bs = to_SearchCapability $ T.deserializeVal iprot (T.T_STRUCT typemap_SearchCapability) bs-typemap_SearchCapability :: T.TypeMap-typemap_SearchCapability = Map.fromList [(1,("type",T.T_I32)),(2,("lang",T.T_STRING))]-default_SearchCapability :: SearchCapability-default_SearchCapability = SearchCapability{- searchCapability_type = (P.toEnum 0),- searchCapability_lang = ""}-data SearchQuery = SearchQuery { searchQuery_terms :: P.Maybe (Vector.Vector LT.Text)- , searchQuery_questions :: P.Maybe (Vector.Vector LT.Text)- , searchQuery_communicationId :: P.Maybe LT.Text- , searchQuery_tokens :: P.Maybe Structure_Types.TokenRefSequence- , searchQuery_rawQuery :: P.Maybe LT.Text- , searchQuery_auths :: P.Maybe LT.Text- , searchQuery_userId :: P.Maybe LT.Text- , searchQuery_name :: P.Maybe LT.Text- , searchQuery_labels :: P.Maybe (Vector.Vector LT.Text)- , searchQuery_type :: SearchType- , searchQuery_lang :: P.Maybe LT.Text- , searchQuery_corpus :: P.Maybe LT.Text- , searchQuery_k :: P.Maybe I.Int32- , searchQuery_communication :: P.Maybe Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SearchQuery where- hashWithSalt salt record = salt `H.hashWithSalt` searchQuery_terms record `H.hashWithSalt` searchQuery_questions record `H.hashWithSalt` searchQuery_communicationId record `H.hashWithSalt` searchQuery_tokens record `H.hashWithSalt` searchQuery_rawQuery record `H.hashWithSalt` searchQuery_auths record `H.hashWithSalt` searchQuery_userId record `H.hashWithSalt` searchQuery_name record `H.hashWithSalt` searchQuery_labels record `H.hashWithSalt` searchQuery_type record `H.hashWithSalt` searchQuery_lang record `H.hashWithSalt` searchQuery_corpus record `H.hashWithSalt` searchQuery_k record `H.hashWithSalt` searchQuery_communication record -instance QC.Arbitrary SearchQuery where - arbitrary = M.liftM SearchQuery (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SearchQuery = []- | P.otherwise = M.catMaybes- [ if obj == default_SearchQuery{searchQuery_terms = searchQuery_terms obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_terms = searchQuery_terms obj}- , if obj == default_SearchQuery{searchQuery_questions = searchQuery_questions obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_questions = searchQuery_questions obj}- , if obj == default_SearchQuery{searchQuery_communicationId = searchQuery_communicationId obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_communicationId = searchQuery_communicationId obj}- , if obj == default_SearchQuery{searchQuery_tokens = searchQuery_tokens obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_tokens = searchQuery_tokens obj}- , if obj == default_SearchQuery{searchQuery_rawQuery = searchQuery_rawQuery obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_rawQuery = searchQuery_rawQuery obj}- , if obj == default_SearchQuery{searchQuery_auths = searchQuery_auths obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_auths = searchQuery_auths obj}- , if obj == default_SearchQuery{searchQuery_userId = searchQuery_userId obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_userId = searchQuery_userId obj}- , if obj == default_SearchQuery{searchQuery_name = searchQuery_name obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_name = searchQuery_name obj}- , if obj == default_SearchQuery{searchQuery_labels = searchQuery_labels obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_labels = searchQuery_labels obj}- , if obj == default_SearchQuery{searchQuery_type = searchQuery_type obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_type = searchQuery_type obj}- , if obj == default_SearchQuery{searchQuery_lang = searchQuery_lang obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_lang = searchQuery_lang obj}- , if obj == default_SearchQuery{searchQuery_corpus = searchQuery_corpus obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_corpus = searchQuery_corpus obj}- , if obj == default_SearchQuery{searchQuery_k = searchQuery_k obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_k = searchQuery_k obj}- , if obj == default_SearchQuery{searchQuery_communication = searchQuery_communication obj} then P.Nothing else P.Just $ default_SearchQuery{searchQuery_communication = searchQuery_communication obj}- ]-from_SearchQuery :: SearchQuery -> T.ThriftVal-from_SearchQuery record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v9 -> (1, ("terms",T.TList T.T_STRING $ P.map (\_v11 -> T.TString $ E.encodeUtf8 _v11) $ Vector.toList _v9))) <$> searchQuery_terms record- , (\_v9 -> (2, ("questions",T.TList T.T_STRING $ P.map (\_v13 -> T.TString $ E.encodeUtf8 _v13) $ Vector.toList _v9))) <$> searchQuery_questions record- , (\_v9 -> (3, ("communicationId",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_communicationId record- , (\_v9 -> (4, ("tokens",Structure_Types.from_TokenRefSequence _v9))) <$> searchQuery_tokens record- , (\_v9 -> (5, ("rawQuery",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_rawQuery record- , (\_v9 -> (6, ("auths",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_auths record- , (\_v9 -> (7, ("userId",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_userId record- , (\_v9 -> (8, ("name",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_name record- , (\_v9 -> (9, ("labels",T.TList T.T_STRING $ P.map (\_v15 -> T.TString $ E.encodeUtf8 _v15) $ Vector.toList _v9))) <$> searchQuery_labels record- , (\_v9 -> P.Just (10, ("type",T.TI32 $ P.fromIntegral $ P.fromEnum _v9))) $ searchQuery_type record- , (\_v9 -> (11, ("lang",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_lang record- , (\_v9 -> (12, ("corpus",T.TString $ E.encodeUtf8 _v9))) <$> searchQuery_corpus record- , (\_v9 -> (13, ("k",T.TI32 _v9))) <$> searchQuery_k record- , (\_v9 -> (14, ("communication",Communication_Types.from_Communication _v9))) <$> searchQuery_communication record- ]-write_SearchQuery :: (T.Protocol p, T.Transport t) => p t -> SearchQuery -> P.IO ()-write_SearchQuery oprot record = T.writeVal oprot $ from_SearchQuery record-encode_SearchQuery :: (T.Protocol p, T.Transport t) => p t -> SearchQuery -> LBS.ByteString-encode_SearchQuery oprot record = T.serializeVal oprot $ from_SearchQuery record-to_SearchQuery :: T.ThriftVal -> SearchQuery-to_SearchQuery (T.TStruct fields) = SearchQuery{- searchQuery_terms = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TList _ _val18 -> (Vector.fromList $ P.map (\_v19 -> (case _v19 of {T.TString _val20 -> E.decodeUtf8 _val20; _ -> P.error "wrong type"})) _val18); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- searchQuery_questions = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TList _ _val21 -> (Vector.fromList $ P.map (\_v22 -> (case _v22 of {T.TString _val23 -> E.decodeUtf8 _val23; _ -> P.error "wrong type"})) _val21); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- searchQuery_communicationId = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val24 -> E.decodeUtf8 _val24; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- searchQuery_tokens = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TStruct _val25 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val25)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- searchQuery_rawQuery = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val26 -> E.decodeUtf8 _val26; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- searchQuery_auths = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val27 -> E.decodeUtf8 _val27; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- searchQuery_userId = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val28 -> E.decodeUtf8 _val28; _ -> P.error "wrong type"})) (Map.lookup (7) fields),- searchQuery_name = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val29 -> E.decodeUtf8 _val29; _ -> P.error "wrong type"})) (Map.lookup (8) fields),- searchQuery_labels = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TList _ _val30 -> (Vector.fromList $ P.map (\_v31 -> (case _v31 of {T.TString _val32 -> E.decodeUtf8 _val32; _ -> P.error "wrong type"})) _val30); _ -> P.error "wrong type"})) (Map.lookup (9) fields),- searchQuery_type = P.maybe (P.error "Missing required field: type") (\(_,_val17) -> (case _val17 of {T.TI32 _val33 -> P.toEnum $ P.fromIntegral _val33; _ -> P.error "wrong type"})) (Map.lookup (10) fields),- searchQuery_lang = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val34 -> E.decodeUtf8 _val34; _ -> P.error "wrong type"})) (Map.lookup (11) fields),- searchQuery_corpus = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TString _val35 -> E.decodeUtf8 _val35; _ -> P.error "wrong type"})) (Map.lookup (12) fields),- searchQuery_k = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TI32 _val36 -> _val36; _ -> P.error "wrong type"})) (Map.lookup (13) fields),- searchQuery_communication = P.maybe (P.Nothing) (\(_,_val17) -> P.Just (case _val17 of {T.TStruct _val37 -> (Communication_Types.to_Communication (T.TStruct _val37)); _ -> P.error "wrong type"})) (Map.lookup (14) fields)- }-to_SearchQuery _ = P.error "not a struct"-read_SearchQuery :: (T.Transport t, T.Protocol p) => p t -> P.IO SearchQuery-read_SearchQuery iprot = to_SearchQuery <$> T.readVal iprot (T.T_STRUCT typemap_SearchQuery)-decode_SearchQuery :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SearchQuery-decode_SearchQuery iprot bs = to_SearchQuery $ T.deserializeVal iprot (T.T_STRUCT typemap_SearchQuery) bs-typemap_SearchQuery :: T.TypeMap-typemap_SearchQuery = Map.fromList [(1,("terms",(T.T_LIST T.T_STRING))),(2,("questions",(T.T_LIST T.T_STRING))),(3,("communicationId",T.T_STRING)),(4,("tokens",(T.T_STRUCT Structure_Types.typemap_TokenRefSequence))),(5,("rawQuery",T.T_STRING)),(6,("auths",T.T_STRING)),(7,("userId",T.T_STRING)),(8,("name",T.T_STRING)),(9,("labels",(T.T_LIST T.T_STRING))),(10,("type",T.T_I32)),(11,("lang",T.T_STRING)),(12,("corpus",T.T_STRING)),(13,("k",T.T_I32)),(14,("communication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_SearchQuery :: SearchQuery-default_SearchQuery = SearchQuery{- searchQuery_terms = P.Nothing,- searchQuery_questions = P.Nothing,- searchQuery_communicationId = P.Nothing,- searchQuery_tokens = P.Nothing,- searchQuery_rawQuery = P.Nothing,- searchQuery_auths = P.Nothing,- searchQuery_userId = P.Nothing,- searchQuery_name = P.Nothing,- searchQuery_labels = P.Nothing,- searchQuery_type = (P.toEnum 0),- searchQuery_lang = P.Nothing,- searchQuery_corpus = P.Nothing,- searchQuery_k = P.Nothing,- searchQuery_communication = P.Nothing}-data SearchResultItem = SearchResultItem { searchResultItem_communicationId :: P.Maybe LT.Text- , searchResultItem_sentenceId :: P.Maybe Uuid_Types.UUID- , searchResultItem_score :: P.Maybe P.Double- , searchResultItem_tokens :: P.Maybe Structure_Types.TokenRefSequence- , searchResultItem_entity :: P.Maybe Entities_Types.Entity- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SearchResultItem where- hashWithSalt salt record = salt `H.hashWithSalt` searchResultItem_communicationId record `H.hashWithSalt` searchResultItem_sentenceId record `H.hashWithSalt` searchResultItem_score record `H.hashWithSalt` searchResultItem_tokens record `H.hashWithSalt` searchResultItem_entity record -instance QC.Arbitrary SearchResultItem where - arbitrary = M.liftM SearchResultItem (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SearchResultItem = []- | P.otherwise = M.catMaybes- [ if obj == default_SearchResultItem{searchResultItem_communicationId = searchResultItem_communicationId obj} then P.Nothing else P.Just $ default_SearchResultItem{searchResultItem_communicationId = searchResultItem_communicationId obj}- , if obj == default_SearchResultItem{searchResultItem_sentenceId = searchResultItem_sentenceId obj} then P.Nothing else P.Just $ default_SearchResultItem{searchResultItem_sentenceId = searchResultItem_sentenceId obj}- , if obj == default_SearchResultItem{searchResultItem_score = searchResultItem_score obj} then P.Nothing else P.Just $ default_SearchResultItem{searchResultItem_score = searchResultItem_score obj}- , if obj == default_SearchResultItem{searchResultItem_tokens = searchResultItem_tokens obj} then P.Nothing else P.Just $ default_SearchResultItem{searchResultItem_tokens = searchResultItem_tokens obj}- , if obj == default_SearchResultItem{searchResultItem_entity = searchResultItem_entity obj} then P.Nothing else P.Just $ default_SearchResultItem{searchResultItem_entity = searchResultItem_entity obj}- ]-from_SearchResultItem :: SearchResultItem -> T.ThriftVal-from_SearchResultItem record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v40 -> (1, ("communicationId",T.TString $ E.encodeUtf8 _v40))) <$> searchResultItem_communicationId record- , (\_v40 -> (2, ("sentenceId",Uuid_Types.from_UUID _v40))) <$> searchResultItem_sentenceId record- , (\_v40 -> (3, ("score",T.TDouble _v40))) <$> searchResultItem_score record- , (\_v40 -> (4, ("tokens",Structure_Types.from_TokenRefSequence _v40))) <$> searchResultItem_tokens record- , (\_v40 -> (5, ("entity",Entities_Types.from_Entity _v40))) <$> searchResultItem_entity record- ]-write_SearchResultItem :: (T.Protocol p, T.Transport t) => p t -> SearchResultItem -> P.IO ()-write_SearchResultItem oprot record = T.writeVal oprot $ from_SearchResultItem record-encode_SearchResultItem :: (T.Protocol p, T.Transport t) => p t -> SearchResultItem -> LBS.ByteString-encode_SearchResultItem oprot record = T.serializeVal oprot $ from_SearchResultItem record-to_SearchResultItem :: T.ThriftVal -> SearchResultItem-to_SearchResultItem (T.TStruct fields) = SearchResultItem{- searchResultItem_communicationId = P.maybe (P.Nothing) (\(_,_val42) -> P.Just (case _val42 of {T.TString _val43 -> E.decodeUtf8 _val43; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- searchResultItem_sentenceId = P.maybe (P.Nothing) (\(_,_val42) -> P.Just (case _val42 of {T.TStruct _val44 -> (Uuid_Types.to_UUID (T.TStruct _val44)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- searchResultItem_score = P.maybe (P.Nothing) (\(_,_val42) -> P.Just (case _val42 of {T.TDouble _val45 -> _val45; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- searchResultItem_tokens = P.maybe (P.Nothing) (\(_,_val42) -> P.Just (case _val42 of {T.TStruct _val46 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val46)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- searchResultItem_entity = P.maybe (P.Nothing) (\(_,_val42) -> P.Just (case _val42 of {T.TStruct _val47 -> (Entities_Types.to_Entity (T.TStruct _val47)); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_SearchResultItem _ = P.error "not a struct"-read_SearchResultItem :: (T.Transport t, T.Protocol p) => p t -> P.IO SearchResultItem-read_SearchResultItem iprot = to_SearchResultItem <$> T.readVal iprot (T.T_STRUCT typemap_SearchResultItem)-decode_SearchResultItem :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SearchResultItem-decode_SearchResultItem iprot bs = to_SearchResultItem $ T.deserializeVal iprot (T.T_STRUCT typemap_SearchResultItem) bs-typemap_SearchResultItem :: T.TypeMap-typemap_SearchResultItem = Map.fromList [(1,("communicationId",T.T_STRING)),(2,("sentenceId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("score",T.T_DOUBLE)),(4,("tokens",(T.T_STRUCT Structure_Types.typemap_TokenRefSequence))),(5,("entity",(T.T_STRUCT Entities_Types.typemap_Entity)))]-default_SearchResultItem :: SearchResultItem-default_SearchResultItem = SearchResultItem{- searchResultItem_communicationId = P.Nothing,- searchResultItem_sentenceId = P.Nothing,- searchResultItem_score = P.Nothing,- searchResultItem_tokens = P.Nothing,- searchResultItem_entity = P.Nothing}-data SearchResult = SearchResult { searchResult_uuid :: Uuid_Types.UUID- , searchResult_searchQuery :: SearchQuery- , searchResult_searchResultItems :: P.Maybe (Vector.Vector SearchResultItem)- , searchResult_metadata :: P.Maybe Metadata_Types.AnnotationMetadata- , searchResult_lang :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SearchResult where- hashWithSalt salt record = salt `H.hashWithSalt` searchResult_uuid record `H.hashWithSalt` searchResult_searchQuery record `H.hashWithSalt` searchResult_searchResultItems record `H.hashWithSalt` searchResult_metadata record `H.hashWithSalt` searchResult_lang record -instance QC.Arbitrary SearchResult where - arbitrary = M.liftM SearchResult (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SearchResult = []- | P.otherwise = M.catMaybes- [ if obj == default_SearchResult{searchResult_uuid = searchResult_uuid obj} then P.Nothing else P.Just $ default_SearchResult{searchResult_uuid = searchResult_uuid obj}- , if obj == default_SearchResult{searchResult_searchQuery = searchResult_searchQuery obj} then P.Nothing else P.Just $ default_SearchResult{searchResult_searchQuery = searchResult_searchQuery obj}- , if obj == default_SearchResult{searchResult_searchResultItems = searchResult_searchResultItems obj} then P.Nothing else P.Just $ default_SearchResult{searchResult_searchResultItems = searchResult_searchResultItems obj}- , if obj == default_SearchResult{searchResult_metadata = searchResult_metadata obj} then P.Nothing else P.Just $ default_SearchResult{searchResult_metadata = searchResult_metadata obj}- , if obj == default_SearchResult{searchResult_lang = searchResult_lang obj} then P.Nothing else P.Just $ default_SearchResult{searchResult_lang = searchResult_lang obj}- ]-from_SearchResult :: SearchResult -> T.ThriftVal-from_SearchResult record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v50 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v50))) $ searchResult_uuid record- , (\_v50 -> P.Just (2, ("searchQuery",from_SearchQuery _v50))) $ searchResult_searchQuery record- , (\_v50 -> (3, ("searchResultItems",T.TList (T.T_STRUCT typemap_SearchResultItem) $ P.map (\_v52 -> from_SearchResultItem _v52) $ Vector.toList _v50))) <$> searchResult_searchResultItems record- , (\_v50 -> (4, ("metadata",Metadata_Types.from_AnnotationMetadata _v50))) <$> searchResult_metadata record- , (\_v50 -> (5, ("lang",T.TString $ E.encodeUtf8 _v50))) <$> searchResult_lang record- ]-write_SearchResult :: (T.Protocol p, T.Transport t) => p t -> SearchResult -> P.IO ()-write_SearchResult oprot record = T.writeVal oprot $ from_SearchResult record-encode_SearchResult :: (T.Protocol p, T.Transport t) => p t -> SearchResult -> LBS.ByteString-encode_SearchResult oprot record = T.serializeVal oprot $ from_SearchResult record-to_SearchResult :: T.ThriftVal -> SearchResult-to_SearchResult (T.TStruct fields) = SearchResult{- searchResult_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val54) -> (case _val54 of {T.TStruct _val55 -> (Uuid_Types.to_UUID (T.TStruct _val55)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- searchResult_searchQuery = P.maybe (P.error "Missing required field: searchQuery") (\(_,_val54) -> (case _val54 of {T.TStruct _val56 -> (to_SearchQuery (T.TStruct _val56)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- searchResult_searchResultItems = P.maybe (P.Nothing) (\(_,_val54) -> P.Just (case _val54 of {T.TList _ _val57 -> (Vector.fromList $ P.map (\_v58 -> (case _v58 of {T.TStruct _val59 -> (to_SearchResultItem (T.TStruct _val59)); _ -> P.error "wrong type"})) _val57); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- searchResult_metadata = P.maybe (P.Nothing) (\(_,_val54) -> P.Just (case _val54 of {T.TStruct _val60 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val60)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- searchResult_lang = P.maybe (P.Nothing) (\(_,_val54) -> P.Just (case _val54 of {T.TString _val61 -> E.decodeUtf8 _val61; _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_SearchResult _ = P.error "not a struct"-read_SearchResult :: (T.Transport t, T.Protocol p) => p t -> P.IO SearchResult-read_SearchResult iprot = to_SearchResult <$> T.readVal iprot (T.T_STRUCT typemap_SearchResult)-decode_SearchResult :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SearchResult-decode_SearchResult iprot bs = to_SearchResult $ T.deserializeVal iprot (T.T_STRUCT typemap_SearchResult) bs-typemap_SearchResult :: T.TypeMap-typemap_SearchResult = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("searchQuery",(T.T_STRUCT typemap_SearchQuery))),(3,("searchResultItems",(T.T_LIST (T.T_STRUCT typemap_SearchResultItem)))),(4,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(5,("lang",T.T_STRING))]-default_SearchResult :: SearchResult-default_SearchResult = SearchResult{- searchResult_uuid = Uuid_Types.default_UUID,- searchResult_searchQuery = default_SearchQuery,- searchResult_searchResultItems = P.Nothing,- searchResult_metadata = P.Nothing,- searchResult_lang = P.Nothing}
− src/Service.hs
@@ -1,206 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Service where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types-import qualified Service_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data About_args = About_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable About_args where- hashWithSalt salt record = salt -instance QC.Arbitrary About_args where - arbitrary = QC.elements [About_args]-from_About_args :: About_args -> T.ThriftVal-from_About_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_About_args :: (T.Protocol p, T.Transport t) => p t -> About_args -> P.IO ()-write_About_args oprot record = T.writeVal oprot $ from_About_args record-encode_About_args :: (T.Protocol p, T.Transport t) => p t -> About_args -> LBS.ByteString-encode_About_args oprot record = T.serializeVal oprot $ from_About_args record-to_About_args :: T.ThriftVal -> About_args-to_About_args (T.TStruct fields) = About_args{-- }-to_About_args _ = P.error "not a struct"-read_About_args :: (T.Transport t, T.Protocol p) => p t -> P.IO About_args-read_About_args iprot = to_About_args <$> T.readVal iprot (T.T_STRUCT typemap_About_args)-decode_About_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> About_args-decode_About_args iprot bs = to_About_args $ T.deserializeVal iprot (T.T_STRUCT typemap_About_args) bs-typemap_About_args :: T.TypeMap-typemap_About_args = Map.fromList []-default_About_args :: About_args-default_About_args = About_args{-}-data About_result = About_result { about_result_success :: ServiceInfo- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable About_result where- hashWithSalt salt record = salt `H.hashWithSalt` about_result_success record -instance QC.Arbitrary About_result where - arbitrary = M.liftM About_result (QC.arbitrary)- shrink obj | obj == default_About_result = []- | P.otherwise = M.catMaybes- [ if obj == default_About_result{about_result_success = about_result_success obj} then P.Nothing else P.Just $ default_About_result{about_result_success = about_result_success obj}- ]-from_About_result :: About_result -> T.ThriftVal-from_About_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v43 -> P.Just (0, ("success",from_ServiceInfo _v43))) $ about_result_success record- ]-write_About_result :: (T.Protocol p, T.Transport t) => p t -> About_result -> P.IO ()-write_About_result oprot record = T.writeVal oprot $ from_About_result record-encode_About_result :: (T.Protocol p, T.Transport t) => p t -> About_result -> LBS.ByteString-encode_About_result oprot record = T.serializeVal oprot $ from_About_result record-to_About_result :: T.ThriftVal -> About_result-to_About_result (T.TStruct fields) = About_result{- about_result_success = P.maybe (about_result_success default_About_result) (\(_,_val45) -> (case _val45 of {T.TStruct _val46 -> (to_ServiceInfo (T.TStruct _val46)); _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_About_result _ = P.error "not a struct"-read_About_result :: (T.Transport t, T.Protocol p) => p t -> P.IO About_result-read_About_result iprot = to_About_result <$> T.readVal iprot (T.T_STRUCT typemap_About_result)-decode_About_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> About_result-decode_About_result iprot bs = to_About_result $ T.deserializeVal iprot (T.T_STRUCT typemap_About_result) bs-typemap_About_result :: T.TypeMap-typemap_About_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_ServiceInfo)))]-default_About_result :: About_result-default_About_result = About_result{- about_result_success = default_ServiceInfo}-data Alive_args = Alive_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Alive_args where- hashWithSalt salt record = salt -instance QC.Arbitrary Alive_args where - arbitrary = QC.elements [Alive_args]-from_Alive_args :: Alive_args -> T.ThriftVal-from_Alive_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_Alive_args :: (T.Protocol p, T.Transport t) => p t -> Alive_args -> P.IO ()-write_Alive_args oprot record = T.writeVal oprot $ from_Alive_args record-encode_Alive_args :: (T.Protocol p, T.Transport t) => p t -> Alive_args -> LBS.ByteString-encode_Alive_args oprot record = T.serializeVal oprot $ from_Alive_args record-to_Alive_args :: T.ThriftVal -> Alive_args-to_Alive_args (T.TStruct fields) = Alive_args{-- }-to_Alive_args _ = P.error "not a struct"-read_Alive_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Alive_args-read_Alive_args iprot = to_Alive_args <$> T.readVal iprot (T.T_STRUCT typemap_Alive_args)-decode_Alive_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Alive_args-decode_Alive_args iprot bs = to_Alive_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Alive_args) bs-typemap_Alive_args :: T.TypeMap-typemap_Alive_args = Map.fromList []-default_Alive_args :: Alive_args-default_Alive_args = Alive_args{-}-data Alive_result = Alive_result { alive_result_success :: P.Bool- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Alive_result where- hashWithSalt salt record = salt `H.hashWithSalt` alive_result_success record -instance QC.Arbitrary Alive_result where - arbitrary = M.liftM Alive_result (QC.arbitrary)- shrink obj | obj == default_Alive_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Alive_result{alive_result_success = alive_result_success obj} then P.Nothing else P.Just $ default_Alive_result{alive_result_success = alive_result_success obj}- ]-from_Alive_result :: Alive_result -> T.ThriftVal-from_Alive_result record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v54 -> P.Just (0, ("success",T.TBool _v54))) $ alive_result_success record- ]-write_Alive_result :: (T.Protocol p, T.Transport t) => p t -> Alive_result -> P.IO ()-write_Alive_result oprot record = T.writeVal oprot $ from_Alive_result record-encode_Alive_result :: (T.Protocol p, T.Transport t) => p t -> Alive_result -> LBS.ByteString-encode_Alive_result oprot record = T.serializeVal oprot $ from_Alive_result record-to_Alive_result :: T.ThriftVal -> Alive_result-to_Alive_result (T.TStruct fields) = Alive_result{- alive_result_success = P.maybe (alive_result_success default_Alive_result) (\(_,_val56) -> (case _val56 of {T.TBool _val57 -> _val57; _ -> P.error "wrong type"})) (Map.lookup (0) fields)- }-to_Alive_result _ = P.error "not a struct"-read_Alive_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Alive_result-read_Alive_result iprot = to_Alive_result <$> T.readVal iprot (T.T_STRUCT typemap_Alive_result)-decode_Alive_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Alive_result-decode_Alive_result iprot bs = to_Alive_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Alive_result) bs-typemap_Alive_result :: T.TypeMap-typemap_Alive_result = Map.fromList [(0,("success",T.T_BOOL))]-default_Alive_result :: Alive_result-default_Alive_result = Alive_result{- alive_result_success = P.False}-process_about (seqid, iprot, oprot, handler) = do- args <- read_About_args iprot- (X.catch- (do- val <- Iface.about handler- let res = default_About_result{about_result_success = val}- T.writeMessageBegin oprot ("about", T.M_REPLY, seqid)- write_About_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("about", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_alive (seqid, iprot, oprot, handler) = do- args <- read_Alive_args iprot- (X.catch- (do- val <- Iface.alive handler- let res = default_Alive_result{alive_result_success = val}- T.writeMessageBegin oprot ("alive", T.M_REPLY, seqid)- write_Alive_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- ((\_ -> do- T.writeMessageBegin oprot ("alive", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "about" -> process_about (seqid,iprot,oprot,handler)- "alive" -> process_alive (seqid,iprot,oprot,handler)- _ -> do- _ <- T.readVal iprot (T.T_STRUCT Map.empty)- T.writeMessageBegin oprot (name,T.M_EXCEPTION,seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN_METHOD ("Unknown function " ++ LT.unpack name))- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/Service_Client.hs
@@ -1,78 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Service_Client(about,alive) where-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types-import Service-seqid = R.newIORef 0-about (ip,op) = do- send_about op- recv_about ip-send_about op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("about", T.M_CALL, seqn)- write_About_args op (About_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_about ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_About_result ip- T.readMessageEnd ip- P.return $ about_result_success res-alive (ip,op) = do- send_alive op- recv_alive ip-send_alive op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("alive", T.M_CALL, seqn)- write_Alive_args op (Alive_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_alive ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Alive_result ip- T.readMessageEnd ip- P.return $ alive_result_success res
− src/Service_Iface.hs
@@ -1,47 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Service_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types--class Service_Iface a where- about :: a -> P.IO ServiceInfo- alive :: a -> P.IO P.Bool
− src/Services_Consts.hs
@@ -1,43 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Services_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---import Services_Types
− src/Services_Types.hs
@@ -1,268 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Services_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Uuid_Types---data AnnotationTaskType = TRANSLATION|NER|TOPICID deriving (P.Show, P.Eq, G.Generic, TY.Typeable, P.Ord, P.Bounded)-instance P.Enum AnnotationTaskType where- fromEnum t = case t of- TRANSLATION -> 1- NER -> 2- TOPICID -> 3- toEnum t = case t of- 1 -> TRANSLATION- 2 -> NER- 3 -> TOPICID- _ -> X.throw T.ThriftException-instance H.Hashable AnnotationTaskType where- hashWithSalt salt = H.hashWithSalt salt P.. P.fromEnum-instance QC.Arbitrary AnnotationTaskType where- arbitrary = QC.elements (P.enumFromTo P.minBound P.maxBound)-data AnnotationUnitType = COMMUNICATION|SENTENCE deriving (P.Show, P.Eq, G.Generic, TY.Typeable, P.Ord, P.Bounded)-instance P.Enum AnnotationUnitType where- fromEnum t = case t of- COMMUNICATION -> 1- SENTENCE -> 2- toEnum t = case t of- 1 -> COMMUNICATION- 2 -> SENTENCE- _ -> X.throw T.ThriftException-instance H.Hashable AnnotationUnitType where- hashWithSalt salt = H.hashWithSalt salt P.. P.fromEnum-instance QC.Arbitrary AnnotationUnitType where- arbitrary = QC.elements (P.enumFromTo P.minBound P.maxBound)-data ServicesException = ServicesException { servicesException_message :: LT.Text- , servicesException_serEx :: P.Maybe LBS.ByteString- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance X.Exception ServicesException-instance H.Hashable ServicesException where- hashWithSalt salt record = salt `H.hashWithSalt` servicesException_message record `H.hashWithSalt` servicesException_serEx record -instance QC.Arbitrary ServicesException where - arbitrary = M.liftM ServicesException (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_ServicesException = []- | P.otherwise = M.catMaybes- [ if obj == default_ServicesException{servicesException_message = servicesException_message obj} then P.Nothing else P.Just $ default_ServicesException{servicesException_message = servicesException_message obj}- , if obj == default_ServicesException{servicesException_serEx = servicesException_serEx obj} then P.Nothing else P.Just $ default_ServicesException{servicesException_serEx = servicesException_serEx obj}- ]-from_ServicesException :: ServicesException -> T.ThriftVal-from_ServicesException record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("message",T.TString $ E.encodeUtf8 _v2))) $ servicesException_message record- , (\_v2 -> (2, ("serEx",T.TBinary _v2))) <$> servicesException_serEx record- ]-write_ServicesException :: (T.Protocol p, T.Transport t) => p t -> ServicesException -> P.IO ()-write_ServicesException oprot record = T.writeVal oprot $ from_ServicesException record-encode_ServicesException :: (T.Protocol p, T.Transport t) => p t -> ServicesException -> LBS.ByteString-encode_ServicesException oprot record = T.serializeVal oprot $ from_ServicesException record-to_ServicesException :: T.ThriftVal -> ServicesException-to_ServicesException (T.TStruct fields) = ServicesException{- servicesException_message = P.maybe (P.error "Missing required field: message") (\(_,_val4) -> (case _val4 of {T.TString _val5 -> E.decodeUtf8 _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- servicesException_serEx = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBinary _val6 -> _val6; T.TString _val6 -> _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_ServicesException _ = P.error "not a struct"-read_ServicesException :: (T.Transport t, T.Protocol p) => p t -> P.IO ServicesException-read_ServicesException iprot = to_ServicesException <$> T.readVal iprot (T.T_STRUCT typemap_ServicesException)-decode_ServicesException :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> ServicesException-decode_ServicesException iprot bs = to_ServicesException $ T.deserializeVal iprot (T.T_STRUCT typemap_ServicesException) bs-typemap_ServicesException :: T.TypeMap-typemap_ServicesException = Map.fromList [(1,("message",T.T_STRING)),(2,("serEx",T.T_BINARY))]-default_ServicesException :: ServicesException-default_ServicesException = ServicesException{- servicesException_message = "",- servicesException_serEx = P.Nothing}-data NotImplementedException = NotImplementedException { notImplementedException_message :: LT.Text- , notImplementedException_serEx :: P.Maybe LBS.ByteString- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance X.Exception NotImplementedException-instance H.Hashable NotImplementedException where- hashWithSalt salt record = salt `H.hashWithSalt` notImplementedException_message record `H.hashWithSalt` notImplementedException_serEx record -instance QC.Arbitrary NotImplementedException where - arbitrary = M.liftM NotImplementedException (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_NotImplementedException = []- | P.otherwise = M.catMaybes- [ if obj == default_NotImplementedException{notImplementedException_message = notImplementedException_message obj} then P.Nothing else P.Just $ default_NotImplementedException{notImplementedException_message = notImplementedException_message obj}- , if obj == default_NotImplementedException{notImplementedException_serEx = notImplementedException_serEx obj} then P.Nothing else P.Just $ default_NotImplementedException{notImplementedException_serEx = notImplementedException_serEx obj}- ]-from_NotImplementedException :: NotImplementedException -> T.ThriftVal-from_NotImplementedException record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v9 -> P.Just (1, ("message",T.TString $ E.encodeUtf8 _v9))) $ notImplementedException_message record- , (\_v9 -> (2, ("serEx",T.TBinary _v9))) <$> notImplementedException_serEx record- ]-write_NotImplementedException :: (T.Protocol p, T.Transport t) => p t -> NotImplementedException -> P.IO ()-write_NotImplementedException oprot record = T.writeVal oprot $ from_NotImplementedException record-encode_NotImplementedException :: (T.Protocol p, T.Transport t) => p t -> NotImplementedException -> LBS.ByteString-encode_NotImplementedException oprot record = T.serializeVal oprot $ from_NotImplementedException record-to_NotImplementedException :: T.ThriftVal -> NotImplementedException-to_NotImplementedException (T.TStruct fields) = NotImplementedException{- notImplementedException_message = P.maybe (P.error "Missing required field: message") (\(_,_val11) -> (case _val11 of {T.TString _val12 -> E.decodeUtf8 _val12; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- notImplementedException_serEx = P.maybe (P.Nothing) (\(_,_val11) -> P.Just (case _val11 of {T.TBinary _val13 -> _val13; T.TString _val13 -> _val13; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_NotImplementedException _ = P.error "not a struct"-read_NotImplementedException :: (T.Transport t, T.Protocol p) => p t -> P.IO NotImplementedException-read_NotImplementedException iprot = to_NotImplementedException <$> T.readVal iprot (T.T_STRUCT typemap_NotImplementedException)-decode_NotImplementedException :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> NotImplementedException-decode_NotImplementedException iprot bs = to_NotImplementedException $ T.deserializeVal iprot (T.T_STRUCT typemap_NotImplementedException) bs-typemap_NotImplementedException :: T.TypeMap-typemap_NotImplementedException = Map.fromList [(1,("message",T.T_STRING)),(2,("serEx",T.T_BINARY))]-default_NotImplementedException :: NotImplementedException-default_NotImplementedException = NotImplementedException{- notImplementedException_message = "",- notImplementedException_serEx = P.Nothing}-data AsyncContactInfo = AsyncContactInfo { asyncContactInfo_host :: LT.Text- , asyncContactInfo_port :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AsyncContactInfo where- hashWithSalt salt record = salt `H.hashWithSalt` asyncContactInfo_host record `H.hashWithSalt` asyncContactInfo_port record -instance QC.Arbitrary AsyncContactInfo where - arbitrary = M.liftM AsyncContactInfo (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AsyncContactInfo = []- | P.otherwise = M.catMaybes- [ if obj == default_AsyncContactInfo{asyncContactInfo_host = asyncContactInfo_host obj} then P.Nothing else P.Just $ default_AsyncContactInfo{asyncContactInfo_host = asyncContactInfo_host obj}- , if obj == default_AsyncContactInfo{asyncContactInfo_port = asyncContactInfo_port obj} then P.Nothing else P.Just $ default_AsyncContactInfo{asyncContactInfo_port = asyncContactInfo_port obj}- ]-from_AsyncContactInfo :: AsyncContactInfo -> T.ThriftVal-from_AsyncContactInfo record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v16 -> P.Just (1, ("host",T.TString $ E.encodeUtf8 _v16))) $ asyncContactInfo_host record- , (\_v16 -> P.Just (2, ("port",T.TI32 _v16))) $ asyncContactInfo_port record- ]-write_AsyncContactInfo :: (T.Protocol p, T.Transport t) => p t -> AsyncContactInfo -> P.IO ()-write_AsyncContactInfo oprot record = T.writeVal oprot $ from_AsyncContactInfo record-encode_AsyncContactInfo :: (T.Protocol p, T.Transport t) => p t -> AsyncContactInfo -> LBS.ByteString-encode_AsyncContactInfo oprot record = T.serializeVal oprot $ from_AsyncContactInfo record-to_AsyncContactInfo :: T.ThriftVal -> AsyncContactInfo-to_AsyncContactInfo (T.TStruct fields) = AsyncContactInfo{- asyncContactInfo_host = P.maybe (P.error "Missing required field: host") (\(_,_val18) -> (case _val18 of {T.TString _val19 -> E.decodeUtf8 _val19; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- asyncContactInfo_port = P.maybe (P.error "Missing required field: port") (\(_,_val18) -> (case _val18 of {T.TI32 _val20 -> _val20; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_AsyncContactInfo _ = P.error "not a struct"-read_AsyncContactInfo :: (T.Transport t, T.Protocol p) => p t -> P.IO AsyncContactInfo-read_AsyncContactInfo iprot = to_AsyncContactInfo <$> T.readVal iprot (T.T_STRUCT typemap_AsyncContactInfo)-decode_AsyncContactInfo :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AsyncContactInfo-decode_AsyncContactInfo iprot bs = to_AsyncContactInfo $ T.deserializeVal iprot (T.T_STRUCT typemap_AsyncContactInfo) bs-typemap_AsyncContactInfo :: T.TypeMap-typemap_AsyncContactInfo = Map.fromList [(1,("host",T.T_STRING)),(2,("port",T.T_I32))]-default_AsyncContactInfo :: AsyncContactInfo-default_AsyncContactInfo = AsyncContactInfo{- asyncContactInfo_host = "",- asyncContactInfo_port = 0}-data AnnotationUnitIdentifier = AnnotationUnitIdentifier { annotationUnitIdentifier_communicationId :: LT.Text- , annotationUnitIdentifier_sentenceId :: P.Maybe Uuid_Types.UUID- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AnnotationUnitIdentifier where- hashWithSalt salt record = salt `H.hashWithSalt` annotationUnitIdentifier_communicationId record `H.hashWithSalt` annotationUnitIdentifier_sentenceId record -instance QC.Arbitrary AnnotationUnitIdentifier where - arbitrary = M.liftM AnnotationUnitIdentifier (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_AnnotationUnitIdentifier = []- | P.otherwise = M.catMaybes- [ if obj == default_AnnotationUnitIdentifier{annotationUnitIdentifier_communicationId = annotationUnitIdentifier_communicationId obj} then P.Nothing else P.Just $ default_AnnotationUnitIdentifier{annotationUnitIdentifier_communicationId = annotationUnitIdentifier_communicationId obj}- , if obj == default_AnnotationUnitIdentifier{annotationUnitIdentifier_sentenceId = annotationUnitIdentifier_sentenceId obj} then P.Nothing else P.Just $ default_AnnotationUnitIdentifier{annotationUnitIdentifier_sentenceId = annotationUnitIdentifier_sentenceId obj}- ]-from_AnnotationUnitIdentifier :: AnnotationUnitIdentifier -> T.ThriftVal-from_AnnotationUnitIdentifier record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v23 -> P.Just (1, ("communicationId",T.TString $ E.encodeUtf8 _v23))) $ annotationUnitIdentifier_communicationId record- , (\_v23 -> (2, ("sentenceId",Uuid_Types.from_UUID _v23))) <$> annotationUnitIdentifier_sentenceId record- ]-write_AnnotationUnitIdentifier :: (T.Protocol p, T.Transport t) => p t -> AnnotationUnitIdentifier -> P.IO ()-write_AnnotationUnitIdentifier oprot record = T.writeVal oprot $ from_AnnotationUnitIdentifier record-encode_AnnotationUnitIdentifier :: (T.Protocol p, T.Transport t) => p t -> AnnotationUnitIdentifier -> LBS.ByteString-encode_AnnotationUnitIdentifier oprot record = T.serializeVal oprot $ from_AnnotationUnitIdentifier record-to_AnnotationUnitIdentifier :: T.ThriftVal -> AnnotationUnitIdentifier-to_AnnotationUnitIdentifier (T.TStruct fields) = AnnotationUnitIdentifier{- annotationUnitIdentifier_communicationId = P.maybe (P.error "Missing required field: communicationId") (\(_,_val25) -> (case _val25 of {T.TString _val26 -> E.decodeUtf8 _val26; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- annotationUnitIdentifier_sentenceId = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TStruct _val27 -> (Uuid_Types.to_UUID (T.TStruct _val27)); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_AnnotationUnitIdentifier _ = P.error "not a struct"-read_AnnotationUnitIdentifier :: (T.Transport t, T.Protocol p) => p t -> P.IO AnnotationUnitIdentifier-read_AnnotationUnitIdentifier iprot = to_AnnotationUnitIdentifier <$> T.readVal iprot (T.T_STRUCT typemap_AnnotationUnitIdentifier)-decode_AnnotationUnitIdentifier :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AnnotationUnitIdentifier-decode_AnnotationUnitIdentifier iprot bs = to_AnnotationUnitIdentifier $ T.deserializeVal iprot (T.T_STRUCT typemap_AnnotationUnitIdentifier) bs-typemap_AnnotationUnitIdentifier :: T.TypeMap-typemap_AnnotationUnitIdentifier = Map.fromList [(1,("communicationId",T.T_STRING)),(2,("sentenceId",(T.T_STRUCT Uuid_Types.typemap_UUID)))]-default_AnnotationUnitIdentifier :: AnnotationUnitIdentifier-default_AnnotationUnitIdentifier = AnnotationUnitIdentifier{- annotationUnitIdentifier_communicationId = "",- annotationUnitIdentifier_sentenceId = P.Nothing}-data ServiceInfo = ServiceInfo { serviceInfo_name :: LT.Text- , serviceInfo_version :: LT.Text- , serviceInfo_description :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable ServiceInfo where- hashWithSalt salt record = salt `H.hashWithSalt` serviceInfo_name record `H.hashWithSalt` serviceInfo_version record `H.hashWithSalt` serviceInfo_description record -instance QC.Arbitrary ServiceInfo where - arbitrary = M.liftM ServiceInfo (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_ServiceInfo = []- | P.otherwise = M.catMaybes- [ if obj == default_ServiceInfo{serviceInfo_name = serviceInfo_name obj} then P.Nothing else P.Just $ default_ServiceInfo{serviceInfo_name = serviceInfo_name obj}- , if obj == default_ServiceInfo{serviceInfo_version = serviceInfo_version obj} then P.Nothing else P.Just $ default_ServiceInfo{serviceInfo_version = serviceInfo_version obj}- , if obj == default_ServiceInfo{serviceInfo_description = serviceInfo_description obj} then P.Nothing else P.Just $ default_ServiceInfo{serviceInfo_description = serviceInfo_description obj}- ]-from_ServiceInfo :: ServiceInfo -> T.ThriftVal-from_ServiceInfo record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v30 -> P.Just (1, ("name",T.TString $ E.encodeUtf8 _v30))) $ serviceInfo_name record- , (\_v30 -> P.Just (2, ("version",T.TString $ E.encodeUtf8 _v30))) $ serviceInfo_version record- , (\_v30 -> (3, ("description",T.TString $ E.encodeUtf8 _v30))) <$> serviceInfo_description record- ]-write_ServiceInfo :: (T.Protocol p, T.Transport t) => p t -> ServiceInfo -> P.IO ()-write_ServiceInfo oprot record = T.writeVal oprot $ from_ServiceInfo record-encode_ServiceInfo :: (T.Protocol p, T.Transport t) => p t -> ServiceInfo -> LBS.ByteString-encode_ServiceInfo oprot record = T.serializeVal oprot $ from_ServiceInfo record-to_ServiceInfo :: T.ThriftVal -> ServiceInfo-to_ServiceInfo (T.TStruct fields) = ServiceInfo{- serviceInfo_name = P.maybe (P.error "Missing required field: name") (\(_,_val32) -> (case _val32 of {T.TString _val33 -> E.decodeUtf8 _val33; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- serviceInfo_version = P.maybe (P.error "Missing required field: version") (\(_,_val32) -> (case _val32 of {T.TString _val34 -> E.decodeUtf8 _val34; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- serviceInfo_description = P.maybe (P.Nothing) (\(_,_val32) -> P.Just (case _val32 of {T.TString _val35 -> E.decodeUtf8 _val35; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_ServiceInfo _ = P.error "not a struct"-read_ServiceInfo :: (T.Transport t, T.Protocol p) => p t -> P.IO ServiceInfo-read_ServiceInfo iprot = to_ServiceInfo <$> T.readVal iprot (T.T_STRUCT typemap_ServiceInfo)-decode_ServiceInfo :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> ServiceInfo-decode_ServiceInfo iprot bs = to_ServiceInfo $ T.deserializeVal iprot (T.T_STRUCT typemap_ServiceInfo) bs-typemap_ServiceInfo :: T.TypeMap-typemap_ServiceInfo = Map.fromList [(1,("name",T.T_STRING)),(2,("version",T.T_STRING)),(3,("description",T.T_STRING))]-default_ServiceInfo :: ServiceInfo-default_ServiceInfo = ServiceInfo{- serviceInfo_name = "",- serviceInfo_version = "",- serviceInfo_description = P.Nothing}
− src/Situations_Consts.hs
@@ -1,46 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Situations_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Structure_Types-import qualified Metadata_Types-import qualified Uuid_Types-import qualified Linking_Types---import Situations_Types
− src/Situations_Types.hs
@@ -1,567 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Situations_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Structure_Types-import qualified Metadata_Types-import qualified Uuid_Types-import qualified Linking_Types---data Property = Property { property_value :: LT.Text- , property_metadata :: Metadata_Types.AnnotationMetadata- , property_polarity :: P.Maybe P.Double- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Property where- hashWithSalt salt record = salt `H.hashWithSalt` property_value record `H.hashWithSalt` property_metadata record `H.hashWithSalt` property_polarity record -instance QC.Arbitrary Property where - arbitrary = M.liftM Property (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Property = []- | P.otherwise = M.catMaybes- [ if obj == default_Property{property_value = property_value obj} then P.Nothing else P.Just $ default_Property{property_value = property_value obj}- , if obj == default_Property{property_metadata = property_metadata obj} then P.Nothing else P.Just $ default_Property{property_metadata = property_metadata obj}- , if obj == default_Property{property_polarity = property_polarity obj} then P.Nothing else P.Just $ default_Property{property_polarity = property_polarity obj}- ]-from_Property :: Property -> T.ThriftVal-from_Property record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("value",T.TString $ E.encodeUtf8 _v2))) $ property_value record- , (\_v2 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v2))) $ property_metadata record- , (\_v2 -> (3, ("polarity",T.TDouble _v2))) <$> property_polarity record- ]-write_Property :: (T.Protocol p, T.Transport t) => p t -> Property -> P.IO ()-write_Property oprot record = T.writeVal oprot $ from_Property record-encode_Property :: (T.Protocol p, T.Transport t) => p t -> Property -> LBS.ByteString-encode_Property oprot record = T.serializeVal oprot $ from_Property record-to_Property :: T.ThriftVal -> Property-to_Property (T.TStruct fields) = Property{- property_value = P.maybe (P.error "Missing required field: value") (\(_,_val4) -> (case _val4 of {T.TString _val5 -> E.decodeUtf8 _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- property_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val4) -> (case _val4 of {T.TStruct _val6 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val6)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- property_polarity = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TDouble _val7 -> _val7; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Property _ = P.error "not a struct"-read_Property :: (T.Transport t, T.Protocol p) => p t -> P.IO Property-read_Property iprot = to_Property <$> T.readVal iprot (T.T_STRUCT typemap_Property)-decode_Property :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Property-decode_Property iprot bs = to_Property $ T.deserializeVal iprot (T.T_STRUCT typemap_Property) bs-typemap_Property :: T.TypeMap-typemap_Property = Map.fromList [(1,("value",T.T_STRING)),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("polarity",T.T_DOUBLE))]-default_Property :: Property-default_Property = Property{- property_value = "",- property_metadata = Metadata_Types.default_AnnotationMetadata,- property_polarity = P.Nothing}-data Argument = Argument { argument_role :: P.Maybe LT.Text- , argument_entityId :: P.Maybe Uuid_Types.UUID- , argument_situationId :: P.Maybe Uuid_Types.UUID- , argument_propertyList :: P.Maybe (Vector.Vector Property)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Argument where- hashWithSalt salt record = salt `H.hashWithSalt` argument_role record `H.hashWithSalt` argument_entityId record `H.hashWithSalt` argument_situationId record `H.hashWithSalt` argument_propertyList record -instance QC.Arbitrary Argument where - arbitrary = M.liftM Argument (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Argument = []- | P.otherwise = M.catMaybes- [ if obj == default_Argument{argument_role = argument_role obj} then P.Nothing else P.Just $ default_Argument{argument_role = argument_role obj}- , if obj == default_Argument{argument_entityId = argument_entityId obj} then P.Nothing else P.Just $ default_Argument{argument_entityId = argument_entityId obj}- , if obj == default_Argument{argument_situationId = argument_situationId obj} then P.Nothing else P.Just $ default_Argument{argument_situationId = argument_situationId obj}- , if obj == default_Argument{argument_propertyList = argument_propertyList obj} then P.Nothing else P.Just $ default_Argument{argument_propertyList = argument_propertyList obj}- ]-from_Argument :: Argument -> T.ThriftVal-from_Argument record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v10 -> (1, ("role",T.TString $ E.encodeUtf8 _v10))) <$> argument_role record- , (\_v10 -> (2, ("entityId",Uuid_Types.from_UUID _v10))) <$> argument_entityId record- , (\_v10 -> (3, ("situationId",Uuid_Types.from_UUID _v10))) <$> argument_situationId record- , (\_v10 -> (4, ("propertyList",T.TList (T.T_STRUCT typemap_Property) $ P.map (\_v12 -> from_Property _v12) $ Vector.toList _v10))) <$> argument_propertyList record- ]-write_Argument :: (T.Protocol p, T.Transport t) => p t -> Argument -> P.IO ()-write_Argument oprot record = T.writeVal oprot $ from_Argument record-encode_Argument :: (T.Protocol p, T.Transport t) => p t -> Argument -> LBS.ByteString-encode_Argument oprot record = T.serializeVal oprot $ from_Argument record-to_Argument :: T.ThriftVal -> Argument-to_Argument (T.TStruct fields) = Argument{- argument_role = P.maybe (P.Nothing) (\(_,_val14) -> P.Just (case _val14 of {T.TString _val15 -> E.decodeUtf8 _val15; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- argument_entityId = P.maybe (P.Nothing) (\(_,_val14) -> P.Just (case _val14 of {T.TStruct _val16 -> (Uuid_Types.to_UUID (T.TStruct _val16)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- argument_situationId = P.maybe (P.Nothing) (\(_,_val14) -> P.Just (case _val14 of {T.TStruct _val17 -> (Uuid_Types.to_UUID (T.TStruct _val17)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- argument_propertyList = P.maybe (P.Nothing) (\(_,_val14) -> P.Just (case _val14 of {T.TList _ _val18 -> (Vector.fromList $ P.map (\_v19 -> (case _v19 of {T.TStruct _val20 -> (to_Property (T.TStruct _val20)); _ -> P.error "wrong type"})) _val18); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_Argument _ = P.error "not a struct"-read_Argument :: (T.Transport t, T.Protocol p) => p t -> P.IO Argument-read_Argument iprot = to_Argument <$> T.readVal iprot (T.T_STRUCT typemap_Argument)-decode_Argument :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Argument-decode_Argument iprot bs = to_Argument $ T.deserializeVal iprot (T.T_STRUCT typemap_Argument) bs-typemap_Argument :: T.TypeMap-typemap_Argument = Map.fromList [(1,("role",T.T_STRING)),(2,("entityId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("situationId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(4,("propertyList",(T.T_LIST (T.T_STRUCT typemap_Property))))]-default_Argument :: Argument-default_Argument = Argument{- argument_role = P.Nothing,- argument_entityId = P.Nothing,- argument_situationId = P.Nothing,- argument_propertyList = P.Nothing}-data Justification = Justification { justification_justificationType :: P.Maybe LT.Text- , justification_mentionId :: Uuid_Types.UUID- , justification_tokenRefSeqList :: P.Maybe (Vector.Vector Structure_Types.TokenRefSequence)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Justification where- hashWithSalt salt record = salt `H.hashWithSalt` justification_justificationType record `H.hashWithSalt` justification_mentionId record `H.hashWithSalt` justification_tokenRefSeqList record -instance QC.Arbitrary Justification where - arbitrary = M.liftM Justification (M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Justification = []- | P.otherwise = M.catMaybes- [ if obj == default_Justification{justification_justificationType = justification_justificationType obj} then P.Nothing else P.Just $ default_Justification{justification_justificationType = justification_justificationType obj}- , if obj == default_Justification{justification_mentionId = justification_mentionId obj} then P.Nothing else P.Just $ default_Justification{justification_mentionId = justification_mentionId obj}- , if obj == default_Justification{justification_tokenRefSeqList = justification_tokenRefSeqList obj} then P.Nothing else P.Just $ default_Justification{justification_tokenRefSeqList = justification_tokenRefSeqList obj}- ]-from_Justification :: Justification -> T.ThriftVal-from_Justification record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v23 -> (1, ("justificationType",T.TString $ E.encodeUtf8 _v23))) <$> justification_justificationType record- , (\_v23 -> P.Just (2, ("mentionId",Uuid_Types.from_UUID _v23))) $ justification_mentionId record- , (\_v23 -> (3, ("tokenRefSeqList",T.TList (T.T_STRUCT Structure_Types.typemap_TokenRefSequence) $ P.map (\_v25 -> Structure_Types.from_TokenRefSequence _v25) $ Vector.toList _v23))) <$> justification_tokenRefSeqList record- ]-write_Justification :: (T.Protocol p, T.Transport t) => p t -> Justification -> P.IO ()-write_Justification oprot record = T.writeVal oprot $ from_Justification record-encode_Justification :: (T.Protocol p, T.Transport t) => p t -> Justification -> LBS.ByteString-encode_Justification oprot record = T.serializeVal oprot $ from_Justification record-to_Justification :: T.ThriftVal -> Justification-to_Justification (T.TStruct fields) = Justification{- justification_justificationType = P.maybe (P.Nothing) (\(_,_val27) -> P.Just (case _val27 of {T.TString _val28 -> E.decodeUtf8 _val28; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- justification_mentionId = P.maybe (P.error "Missing required field: mentionId") (\(_,_val27) -> (case _val27 of {T.TStruct _val29 -> (Uuid_Types.to_UUID (T.TStruct _val29)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- justification_tokenRefSeqList = P.maybe (P.Nothing) (\(_,_val27) -> P.Just (case _val27 of {T.TList _ _val30 -> (Vector.fromList $ P.map (\_v31 -> (case _v31 of {T.TStruct _val32 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val32)); _ -> P.error "wrong type"})) _val30); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Justification _ = P.error "not a struct"-read_Justification :: (T.Transport t, T.Protocol p) => p t -> P.IO Justification-read_Justification iprot = to_Justification <$> T.readVal iprot (T.T_STRUCT typemap_Justification)-decode_Justification :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Justification-decode_Justification iprot bs = to_Justification $ T.deserializeVal iprot (T.T_STRUCT typemap_Justification) bs-typemap_Justification :: T.TypeMap-typemap_Justification = Map.fromList [(1,("justificationType",T.T_STRING)),(2,("mentionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("tokenRefSeqList",(T.T_LIST (T.T_STRUCT Structure_Types.typemap_TokenRefSequence))))]-default_Justification :: Justification-default_Justification = Justification{- justification_justificationType = P.Nothing,- justification_mentionId = Uuid_Types.default_UUID,- justification_tokenRefSeqList = P.Nothing}-data TimeML = TimeML { timeML_timeMLClass :: P.Maybe LT.Text- , timeML_timeMLTense :: P.Maybe LT.Text- , timeML_timeMLAspect :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TimeML where- hashWithSalt salt record = salt `H.hashWithSalt` timeML_timeMLClass record `H.hashWithSalt` timeML_timeMLTense record `H.hashWithSalt` timeML_timeMLAspect record -instance QC.Arbitrary TimeML where - arbitrary = M.liftM TimeML (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TimeML = []- | P.otherwise = M.catMaybes- [ if obj == default_TimeML{timeML_timeMLClass = timeML_timeMLClass obj} then P.Nothing else P.Just $ default_TimeML{timeML_timeMLClass = timeML_timeMLClass obj}- , if obj == default_TimeML{timeML_timeMLTense = timeML_timeMLTense obj} then P.Nothing else P.Just $ default_TimeML{timeML_timeMLTense = timeML_timeMLTense obj}- , if obj == default_TimeML{timeML_timeMLAspect = timeML_timeMLAspect obj} then P.Nothing else P.Just $ default_TimeML{timeML_timeMLAspect = timeML_timeMLAspect obj}- ]-from_TimeML :: TimeML -> T.ThriftVal-from_TimeML record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v35 -> (1, ("timeMLClass",T.TString $ E.encodeUtf8 _v35))) <$> timeML_timeMLClass record- , (\_v35 -> (2, ("timeMLTense",T.TString $ E.encodeUtf8 _v35))) <$> timeML_timeMLTense record- , (\_v35 -> (3, ("timeMLAspect",T.TString $ E.encodeUtf8 _v35))) <$> timeML_timeMLAspect record- ]-write_TimeML :: (T.Protocol p, T.Transport t) => p t -> TimeML -> P.IO ()-write_TimeML oprot record = T.writeVal oprot $ from_TimeML record-encode_TimeML :: (T.Protocol p, T.Transport t) => p t -> TimeML -> LBS.ByteString-encode_TimeML oprot record = T.serializeVal oprot $ from_TimeML record-to_TimeML :: T.ThriftVal -> TimeML-to_TimeML (T.TStruct fields) = TimeML{- timeML_timeMLClass = P.maybe (P.Nothing) (\(_,_val37) -> P.Just (case _val37 of {T.TString _val38 -> E.decodeUtf8 _val38; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- timeML_timeMLTense = P.maybe (P.Nothing) (\(_,_val37) -> P.Just (case _val37 of {T.TString _val39 -> E.decodeUtf8 _val39; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- timeML_timeMLAspect = P.maybe (P.Nothing) (\(_,_val37) -> P.Just (case _val37 of {T.TString _val40 -> E.decodeUtf8 _val40; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_TimeML _ = P.error "not a struct"-read_TimeML :: (T.Transport t, T.Protocol p) => p t -> P.IO TimeML-read_TimeML iprot = to_TimeML <$> T.readVal iprot (T.T_STRUCT typemap_TimeML)-decode_TimeML :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TimeML-decode_TimeML iprot bs = to_TimeML $ T.deserializeVal iprot (T.T_STRUCT typemap_TimeML) bs-typemap_TimeML :: T.TypeMap-typemap_TimeML = Map.fromList [(1,("timeMLClass",T.T_STRING)),(2,("timeMLTense",T.T_STRING)),(3,("timeMLAspect",T.T_STRING))]-default_TimeML :: TimeML-default_TimeML = TimeML{- timeML_timeMLClass = P.Nothing,- timeML_timeMLTense = P.Nothing,- timeML_timeMLAspect = P.Nothing}-data Situation = Situation { situation_uuid :: Uuid_Types.UUID- , situation_situationType :: LT.Text- , situation_situationKind :: P.Maybe LT.Text- , situation_argumentList :: P.Maybe (Vector.Vector Argument)- , situation_mentionIdList :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , situation_justificationList :: P.Maybe (Vector.Vector Justification)- , situation_timeML :: P.Maybe TimeML- , situation_intensity :: P.Maybe P.Double- , situation_polarity :: P.Maybe LT.Text- , situation_confidence :: P.Maybe P.Double- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Situation where- hashWithSalt salt record = salt `H.hashWithSalt` situation_uuid record `H.hashWithSalt` situation_situationType record `H.hashWithSalt` situation_situationKind record `H.hashWithSalt` situation_argumentList record `H.hashWithSalt` situation_mentionIdList record `H.hashWithSalt` situation_justificationList record `H.hashWithSalt` situation_timeML record `H.hashWithSalt` situation_intensity record `H.hashWithSalt` situation_polarity record `H.hashWithSalt` situation_confidence record -instance QC.Arbitrary Situation where - arbitrary = M.liftM Situation (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Situation = []- | P.otherwise = M.catMaybes- [ if obj == default_Situation{situation_uuid = situation_uuid obj} then P.Nothing else P.Just $ default_Situation{situation_uuid = situation_uuid obj}- , if obj == default_Situation{situation_situationType = situation_situationType obj} then P.Nothing else P.Just $ default_Situation{situation_situationType = situation_situationType obj}- , if obj == default_Situation{situation_situationKind = situation_situationKind obj} then P.Nothing else P.Just $ default_Situation{situation_situationKind = situation_situationKind obj}- , if obj == default_Situation{situation_argumentList = situation_argumentList obj} then P.Nothing else P.Just $ default_Situation{situation_argumentList = situation_argumentList obj}- , if obj == default_Situation{situation_mentionIdList = situation_mentionIdList obj} then P.Nothing else P.Just $ default_Situation{situation_mentionIdList = situation_mentionIdList obj}- , if obj == default_Situation{situation_justificationList = situation_justificationList obj} then P.Nothing else P.Just $ default_Situation{situation_justificationList = situation_justificationList obj}- , if obj == default_Situation{situation_timeML = situation_timeML obj} then P.Nothing else P.Just $ default_Situation{situation_timeML = situation_timeML obj}- , if obj == default_Situation{situation_intensity = situation_intensity obj} then P.Nothing else P.Just $ default_Situation{situation_intensity = situation_intensity obj}- , if obj == default_Situation{situation_polarity = situation_polarity obj} then P.Nothing else P.Just $ default_Situation{situation_polarity = situation_polarity obj}- , if obj == default_Situation{situation_confidence = situation_confidence obj} then P.Nothing else P.Just $ default_Situation{situation_confidence = situation_confidence obj}- ]-from_Situation :: Situation -> T.ThriftVal-from_Situation record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v43 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v43))) $ situation_uuid record- , (\_v43 -> P.Just (2, ("situationType",T.TString $ E.encodeUtf8 _v43))) $ situation_situationType record- , (\_v43 -> (3, ("argumentList",T.TList (T.T_STRUCT typemap_Argument) $ P.map (\_v45 -> from_Argument _v45) $ Vector.toList _v43))) <$> situation_argumentList record- , (\_v43 -> (4, ("mentionIdList",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v47 -> Uuid_Types.from_UUID _v47) $ Vector.toList _v43))) <$> situation_mentionIdList record- , (\_v43 -> (5, ("justificationList",T.TList (T.T_STRUCT typemap_Justification) $ P.map (\_v49 -> from_Justification _v49) $ Vector.toList _v43))) <$> situation_justificationList record- , (\_v43 -> (50, ("situationKind",T.TString $ E.encodeUtf8 _v43))) <$> situation_situationKind record- , (\_v43 -> (54, ("timeML",from_TimeML _v43))) <$> situation_timeML record- , (\_v43 -> (100, ("intensity",T.TDouble _v43))) <$> situation_intensity record- , (\_v43 -> (101, ("polarity",T.TString $ E.encodeUtf8 _v43))) <$> situation_polarity record- , (\_v43 -> (200, ("confidence",T.TDouble _v43))) <$> situation_confidence record- ]-write_Situation :: (T.Protocol p, T.Transport t) => p t -> Situation -> P.IO ()-write_Situation oprot record = T.writeVal oprot $ from_Situation record-encode_Situation :: (T.Protocol p, T.Transport t) => p t -> Situation -> LBS.ByteString-encode_Situation oprot record = T.serializeVal oprot $ from_Situation record-to_Situation :: T.ThriftVal -> Situation-to_Situation (T.TStruct fields) = Situation{- situation_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val51) -> (case _val51 of {T.TStruct _val52 -> (Uuid_Types.to_UUID (T.TStruct _val52)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- situation_situationType = P.maybe (P.error "Missing required field: situationType") (\(_,_val51) -> (case _val51 of {T.TString _val53 -> E.decodeUtf8 _val53; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- situation_situationKind = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TString _val54 -> E.decodeUtf8 _val54; _ -> P.error "wrong type"})) (Map.lookup (50) fields),- situation_argumentList = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TList _ _val55 -> (Vector.fromList $ P.map (\_v56 -> (case _v56 of {T.TStruct _val57 -> (to_Argument (T.TStruct _val57)); _ -> P.error "wrong type"})) _val55); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- situation_mentionIdList = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TList _ _val58 -> (Vector.fromList $ P.map (\_v59 -> (case _v59 of {T.TStruct _val60 -> (Uuid_Types.to_UUID (T.TStruct _val60)); _ -> P.error "wrong type"})) _val58); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- situation_justificationList = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TList _ _val61 -> (Vector.fromList $ P.map (\_v62 -> (case _v62 of {T.TStruct _val63 -> (to_Justification (T.TStruct _val63)); _ -> P.error "wrong type"})) _val61); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- situation_timeML = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TStruct _val64 -> (to_TimeML (T.TStruct _val64)); _ -> P.error "wrong type"})) (Map.lookup (54) fields),- situation_intensity = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TDouble _val65 -> _val65; _ -> P.error "wrong type"})) (Map.lookup (100) fields),- situation_polarity = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TString _val66 -> E.decodeUtf8 _val66; _ -> P.error "wrong type"})) (Map.lookup (101) fields),- situation_confidence = P.maybe (P.Nothing) (\(_,_val51) -> P.Just (case _val51 of {T.TDouble _val67 -> _val67; _ -> P.error "wrong type"})) (Map.lookup (200) fields)- }-to_Situation _ = P.error "not a struct"-read_Situation :: (T.Transport t, T.Protocol p) => p t -> P.IO Situation-read_Situation iprot = to_Situation <$> T.readVal iprot (T.T_STRUCT typemap_Situation)-decode_Situation :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Situation-decode_Situation iprot bs = to_Situation $ T.deserializeVal iprot (T.T_STRUCT typemap_Situation) bs-typemap_Situation :: T.TypeMap-typemap_Situation = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("situationType",T.T_STRING)),(3,("argumentList",(T.T_LIST (T.T_STRUCT typemap_Argument)))),(4,("mentionIdList",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(5,("justificationList",(T.T_LIST (T.T_STRUCT typemap_Justification)))),(50,("situationKind",T.T_STRING)),(54,("timeML",(T.T_STRUCT typemap_TimeML))),(100,("intensity",T.T_DOUBLE)),(101,("polarity",T.T_STRING)),(200,("confidence",T.T_DOUBLE))]-default_Situation :: Situation-default_Situation = Situation{- situation_uuid = Uuid_Types.default_UUID,- situation_situationType = "",- situation_argumentList = P.Nothing,- situation_mentionIdList = P.Nothing,- situation_justificationList = P.Nothing,- situation_situationKind = P.Nothing,- situation_timeML = P.Nothing,- situation_intensity = P.Nothing,- situation_polarity = P.Nothing,- situation_confidence = P.Nothing}-data SituationSet = SituationSet { situationSet_uuid :: Uuid_Types.UUID- , situationSet_metadata :: Metadata_Types.AnnotationMetadata- , situationSet_situationList :: (Vector.Vector Situation)- , situationSet_linkingList :: P.Maybe (Vector.Vector Linking_Types.Linking)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SituationSet where- hashWithSalt salt record = salt `H.hashWithSalt` situationSet_uuid record `H.hashWithSalt` situationSet_metadata record `H.hashWithSalt` situationSet_situationList record `H.hashWithSalt` situationSet_linkingList record -instance QC.Arbitrary SituationSet where - arbitrary = M.liftM SituationSet (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SituationSet = []- | P.otherwise = M.catMaybes- [ if obj == default_SituationSet{situationSet_uuid = situationSet_uuid obj} then P.Nothing else P.Just $ default_SituationSet{situationSet_uuid = situationSet_uuid obj}- , if obj == default_SituationSet{situationSet_metadata = situationSet_metadata obj} then P.Nothing else P.Just $ default_SituationSet{situationSet_metadata = situationSet_metadata obj}- , if obj == default_SituationSet{situationSet_situationList = situationSet_situationList obj} then P.Nothing else P.Just $ default_SituationSet{situationSet_situationList = situationSet_situationList obj}- , if obj == default_SituationSet{situationSet_linkingList = situationSet_linkingList obj} then P.Nothing else P.Just $ default_SituationSet{situationSet_linkingList = situationSet_linkingList obj}- ]-from_SituationSet :: SituationSet -> T.ThriftVal-from_SituationSet record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v70 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v70))) $ situationSet_uuid record- , (\_v70 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v70))) $ situationSet_metadata record- , (\_v70 -> P.Just (3, ("situationList",T.TList (T.T_STRUCT typemap_Situation) $ P.map (\_v72 -> from_Situation _v72) $ Vector.toList _v70))) $ situationSet_situationList record- , (\_v70 -> (4, ("linkingList",T.TList (T.T_STRUCT Linking_Types.typemap_Linking) $ P.map (\_v74 -> Linking_Types.from_Linking _v74) $ Vector.toList _v70))) <$> situationSet_linkingList record- ]-write_SituationSet :: (T.Protocol p, T.Transport t) => p t -> SituationSet -> P.IO ()-write_SituationSet oprot record = T.writeVal oprot $ from_SituationSet record-encode_SituationSet :: (T.Protocol p, T.Transport t) => p t -> SituationSet -> LBS.ByteString-encode_SituationSet oprot record = T.serializeVal oprot $ from_SituationSet record-to_SituationSet :: T.ThriftVal -> SituationSet-to_SituationSet (T.TStruct fields) = SituationSet{- situationSet_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val76) -> (case _val76 of {T.TStruct _val77 -> (Uuid_Types.to_UUID (T.TStruct _val77)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- situationSet_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val76) -> (case _val76 of {T.TStruct _val78 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val78)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- situationSet_situationList = P.maybe (P.error "Missing required field: situationList") (\(_,_val76) -> (case _val76 of {T.TList _ _val79 -> (Vector.fromList $ P.map (\_v80 -> (case _v80 of {T.TStruct _val81 -> (to_Situation (T.TStruct _val81)); _ -> P.error "wrong type"})) _val79); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- situationSet_linkingList = P.maybe (P.Nothing) (\(_,_val76) -> P.Just (case _val76 of {T.TList _ _val82 -> (Vector.fromList $ P.map (\_v83 -> (case _v83 of {T.TStruct _val84 -> (Linking_Types.to_Linking (T.TStruct _val84)); _ -> P.error "wrong type"})) _val82); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_SituationSet _ = P.error "not a struct"-read_SituationSet :: (T.Transport t, T.Protocol p) => p t -> P.IO SituationSet-read_SituationSet iprot = to_SituationSet <$> T.readVal iprot (T.T_STRUCT typemap_SituationSet)-decode_SituationSet :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SituationSet-decode_SituationSet iprot bs = to_SituationSet $ T.deserializeVal iprot (T.T_STRUCT typemap_SituationSet) bs-typemap_SituationSet :: T.TypeMap-typemap_SituationSet = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("situationList",(T.T_LIST (T.T_STRUCT typemap_Situation)))),(4,("linkingList",(T.T_LIST (T.T_STRUCT Linking_Types.typemap_Linking))))]-default_SituationSet :: SituationSet-default_SituationSet = SituationSet{- situationSet_uuid = Uuid_Types.default_UUID,- situationSet_metadata = Metadata_Types.default_AnnotationMetadata,- situationSet_situationList = Vector.empty,- situationSet_linkingList = P.Nothing}-data MentionArgument = MentionArgument { mentionArgument_role :: P.Maybe LT.Text- , mentionArgument_entityMentionId :: P.Maybe Uuid_Types.UUID- , mentionArgument_situationMentionId :: P.Maybe Uuid_Types.UUID- , mentionArgument_tokens :: P.Maybe Structure_Types.TokenRefSequence- , mentionArgument_constituent :: P.Maybe Structure_Types.ConstituentRef- , mentionArgument_confidence :: P.Maybe P.Double- , mentionArgument_propertyList :: P.Maybe (Vector.Vector Property)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable MentionArgument where- hashWithSalt salt record = salt `H.hashWithSalt` mentionArgument_role record `H.hashWithSalt` mentionArgument_entityMentionId record `H.hashWithSalt` mentionArgument_situationMentionId record `H.hashWithSalt` mentionArgument_tokens record `H.hashWithSalt` mentionArgument_constituent record `H.hashWithSalt` mentionArgument_confidence record `H.hashWithSalt` mentionArgument_propertyList record -instance QC.Arbitrary MentionArgument where - arbitrary = M.liftM MentionArgument (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_MentionArgument = []- | P.otherwise = M.catMaybes- [ if obj == default_MentionArgument{mentionArgument_role = mentionArgument_role obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_role = mentionArgument_role obj}- , if obj == default_MentionArgument{mentionArgument_entityMentionId = mentionArgument_entityMentionId obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_entityMentionId = mentionArgument_entityMentionId obj}- , if obj == default_MentionArgument{mentionArgument_situationMentionId = mentionArgument_situationMentionId obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_situationMentionId = mentionArgument_situationMentionId obj}- , if obj == default_MentionArgument{mentionArgument_tokens = mentionArgument_tokens obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_tokens = mentionArgument_tokens obj}- , if obj == default_MentionArgument{mentionArgument_constituent = mentionArgument_constituent obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_constituent = mentionArgument_constituent obj}- , if obj == default_MentionArgument{mentionArgument_confidence = mentionArgument_confidence obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_confidence = mentionArgument_confidence obj}- , if obj == default_MentionArgument{mentionArgument_propertyList = mentionArgument_propertyList obj} then P.Nothing else P.Just $ default_MentionArgument{mentionArgument_propertyList = mentionArgument_propertyList obj}- ]-from_MentionArgument :: MentionArgument -> T.ThriftVal-from_MentionArgument record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v87 -> (1, ("role",T.TString $ E.encodeUtf8 _v87))) <$> mentionArgument_role record- , (\_v87 -> (2, ("entityMentionId",Uuid_Types.from_UUID _v87))) <$> mentionArgument_entityMentionId record- , (\_v87 -> (3, ("situationMentionId",Uuid_Types.from_UUID _v87))) <$> mentionArgument_situationMentionId record- , (\_v87 -> (4, ("tokens",Structure_Types.from_TokenRefSequence _v87))) <$> mentionArgument_tokens record- , (\_v87 -> (5, ("confidence",T.TDouble _v87))) <$> mentionArgument_confidence record- , (\_v87 -> (6, ("propertyList",T.TList (T.T_STRUCT typemap_Property) $ P.map (\_v89 -> from_Property _v89) $ Vector.toList _v87))) <$> mentionArgument_propertyList record- , (\_v87 -> (7, ("constituent",Structure_Types.from_ConstituentRef _v87))) <$> mentionArgument_constituent record- ]-write_MentionArgument :: (T.Protocol p, T.Transport t) => p t -> MentionArgument -> P.IO ()-write_MentionArgument oprot record = T.writeVal oprot $ from_MentionArgument record-encode_MentionArgument :: (T.Protocol p, T.Transport t) => p t -> MentionArgument -> LBS.ByteString-encode_MentionArgument oprot record = T.serializeVal oprot $ from_MentionArgument record-to_MentionArgument :: T.ThriftVal -> MentionArgument-to_MentionArgument (T.TStruct fields) = MentionArgument{- mentionArgument_role = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TString _val92 -> E.decodeUtf8 _val92; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- mentionArgument_entityMentionId = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TStruct _val93 -> (Uuid_Types.to_UUID (T.TStruct _val93)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- mentionArgument_situationMentionId = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TStruct _val94 -> (Uuid_Types.to_UUID (T.TStruct _val94)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- mentionArgument_tokens = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TStruct _val95 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val95)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- mentionArgument_constituent = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TStruct _val96 -> (Structure_Types.to_ConstituentRef (T.TStruct _val96)); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- mentionArgument_confidence = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TDouble _val97 -> _val97; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- mentionArgument_propertyList = P.maybe (P.Nothing) (\(_,_val91) -> P.Just (case _val91 of {T.TList _ _val98 -> (Vector.fromList $ P.map (\_v99 -> (case _v99 of {T.TStruct _val100 -> (to_Property (T.TStruct _val100)); _ -> P.error "wrong type"})) _val98); _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_MentionArgument _ = P.error "not a struct"-read_MentionArgument :: (T.Transport t, T.Protocol p) => p t -> P.IO MentionArgument-read_MentionArgument iprot = to_MentionArgument <$> T.readVal iprot (T.T_STRUCT typemap_MentionArgument)-decode_MentionArgument :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> MentionArgument-decode_MentionArgument iprot bs = to_MentionArgument $ T.deserializeVal iprot (T.T_STRUCT typemap_MentionArgument) bs-typemap_MentionArgument :: T.TypeMap-typemap_MentionArgument = Map.fromList [(1,("role",T.T_STRING)),(2,("entityMentionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("situationMentionId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(4,("tokens",(T.T_STRUCT Structure_Types.typemap_TokenRefSequence))),(5,("confidence",T.T_DOUBLE)),(6,("propertyList",(T.T_LIST (T.T_STRUCT typemap_Property)))),(7,("constituent",(T.T_STRUCT Structure_Types.typemap_ConstituentRef)))]-default_MentionArgument :: MentionArgument-default_MentionArgument = MentionArgument{- mentionArgument_role = P.Nothing,- mentionArgument_entityMentionId = P.Nothing,- mentionArgument_situationMentionId = P.Nothing,- mentionArgument_tokens = P.Nothing,- mentionArgument_confidence = P.Nothing,- mentionArgument_propertyList = P.Nothing,- mentionArgument_constituent = P.Nothing}-data SituationMention = SituationMention { situationMention_uuid :: Uuid_Types.UUID- , situationMention_text :: P.Maybe LT.Text- , situationMention_situationType :: P.Maybe LT.Text- , situationMention_situationKind :: P.Maybe LT.Text- , situationMention_argumentList :: (Vector.Vector MentionArgument)- , situationMention_intensity :: P.Maybe P.Double- , situationMention_polarity :: P.Maybe LT.Text- , situationMention_tokens :: P.Maybe Structure_Types.TokenRefSequence- , situationMention_constituent :: P.Maybe Structure_Types.ConstituentRef- , situationMention_confidence :: P.Maybe P.Double- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SituationMention where- hashWithSalt salt record = salt `H.hashWithSalt` situationMention_uuid record `H.hashWithSalt` situationMention_text record `H.hashWithSalt` situationMention_situationType record `H.hashWithSalt` situationMention_situationKind record `H.hashWithSalt` situationMention_argumentList record `H.hashWithSalt` situationMention_intensity record `H.hashWithSalt` situationMention_polarity record `H.hashWithSalt` situationMention_tokens record `H.hashWithSalt` situationMention_constituent record `H.hashWithSalt` situationMention_confidence record -instance QC.Arbitrary SituationMention where - arbitrary = M.liftM SituationMention (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SituationMention = []- | P.otherwise = M.catMaybes- [ if obj == default_SituationMention{situationMention_uuid = situationMention_uuid obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_uuid = situationMention_uuid obj}- , if obj == default_SituationMention{situationMention_text = situationMention_text obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_text = situationMention_text obj}- , if obj == default_SituationMention{situationMention_situationType = situationMention_situationType obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_situationType = situationMention_situationType obj}- , if obj == default_SituationMention{situationMention_situationKind = situationMention_situationKind obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_situationKind = situationMention_situationKind obj}- , if obj == default_SituationMention{situationMention_argumentList = situationMention_argumentList obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_argumentList = situationMention_argumentList obj}- , if obj == default_SituationMention{situationMention_intensity = situationMention_intensity obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_intensity = situationMention_intensity obj}- , if obj == default_SituationMention{situationMention_polarity = situationMention_polarity obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_polarity = situationMention_polarity obj}- , if obj == default_SituationMention{situationMention_tokens = situationMention_tokens obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_tokens = situationMention_tokens obj}- , if obj == default_SituationMention{situationMention_constituent = situationMention_constituent obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_constituent = situationMention_constituent obj}- , if obj == default_SituationMention{situationMention_confidence = situationMention_confidence obj} then P.Nothing else P.Just $ default_SituationMention{situationMention_confidence = situationMention_confidence obj}- ]-from_SituationMention :: SituationMention -> T.ThriftVal-from_SituationMention record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v103 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v103))) $ situationMention_uuid record- , (\_v103 -> (2, ("text",T.TString $ E.encodeUtf8 _v103))) <$> situationMention_text record- , (\_v103 -> (3, ("situationType",T.TString $ E.encodeUtf8 _v103))) <$> situationMention_situationType record- , (\_v103 -> P.Just (4, ("argumentList",T.TList (T.T_STRUCT typemap_MentionArgument) $ P.map (\_v105 -> from_MentionArgument _v105) $ Vector.toList _v103))) $ situationMention_argumentList record- , (\_v103 -> (50, ("situationKind",T.TString $ E.encodeUtf8 _v103))) <$> situationMention_situationKind record- , (\_v103 -> (100, ("intensity",T.TDouble _v103))) <$> situationMention_intensity record- , (\_v103 -> (101, ("polarity",T.TString $ E.encodeUtf8 _v103))) <$> situationMention_polarity record- , (\_v103 -> (150, ("tokens",Structure_Types.from_TokenRefSequence _v103))) <$> situationMention_tokens record- , (\_v103 -> (151, ("constituent",Structure_Types.from_ConstituentRef _v103))) <$> situationMention_constituent record- , (\_v103 -> (200, ("confidence",T.TDouble _v103))) <$> situationMention_confidence record- ]-write_SituationMention :: (T.Protocol p, T.Transport t) => p t -> SituationMention -> P.IO ()-write_SituationMention oprot record = T.writeVal oprot $ from_SituationMention record-encode_SituationMention :: (T.Protocol p, T.Transport t) => p t -> SituationMention -> LBS.ByteString-encode_SituationMention oprot record = T.serializeVal oprot $ from_SituationMention record-to_SituationMention :: T.ThriftVal -> SituationMention-to_SituationMention (T.TStruct fields) = SituationMention{- situationMention_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val107) -> (case _val107 of {T.TStruct _val108 -> (Uuid_Types.to_UUID (T.TStruct _val108)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- situationMention_text = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TString _val109 -> E.decodeUtf8 _val109; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- situationMention_situationType = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TString _val110 -> E.decodeUtf8 _val110; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- situationMention_situationKind = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TString _val111 -> E.decodeUtf8 _val111; _ -> P.error "wrong type"})) (Map.lookup (50) fields),- situationMention_argumentList = P.maybe (P.error "Missing required field: argumentList") (\(_,_val107) -> (case _val107 of {T.TList _ _val112 -> (Vector.fromList $ P.map (\_v113 -> (case _v113 of {T.TStruct _val114 -> (to_MentionArgument (T.TStruct _val114)); _ -> P.error "wrong type"})) _val112); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- situationMention_intensity = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TDouble _val115 -> _val115; _ -> P.error "wrong type"})) (Map.lookup (100) fields),- situationMention_polarity = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TString _val116 -> E.decodeUtf8 _val116; _ -> P.error "wrong type"})) (Map.lookup (101) fields),- situationMention_tokens = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TStruct _val117 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val117)); _ -> P.error "wrong type"})) (Map.lookup (150) fields),- situationMention_constituent = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TStruct _val118 -> (Structure_Types.to_ConstituentRef (T.TStruct _val118)); _ -> P.error "wrong type"})) (Map.lookup (151) fields),- situationMention_confidence = P.maybe (P.Nothing) (\(_,_val107) -> P.Just (case _val107 of {T.TDouble _val119 -> _val119; _ -> P.error "wrong type"})) (Map.lookup (200) fields)- }-to_SituationMention _ = P.error "not a struct"-read_SituationMention :: (T.Transport t, T.Protocol p) => p t -> P.IO SituationMention-read_SituationMention iprot = to_SituationMention <$> T.readVal iprot (T.T_STRUCT typemap_SituationMention)-decode_SituationMention :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SituationMention-decode_SituationMention iprot bs = to_SituationMention $ T.deserializeVal iprot (T.T_STRUCT typemap_SituationMention) bs-typemap_SituationMention :: T.TypeMap-typemap_SituationMention = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("text",T.T_STRING)),(3,("situationType",T.T_STRING)),(4,("argumentList",(T.T_LIST (T.T_STRUCT typemap_MentionArgument)))),(50,("situationKind",T.T_STRING)),(100,("intensity",T.T_DOUBLE)),(101,("polarity",T.T_STRING)),(150,("tokens",(T.T_STRUCT Structure_Types.typemap_TokenRefSequence))),(151,("constituent",(T.T_STRUCT Structure_Types.typemap_ConstituentRef))),(200,("confidence",T.T_DOUBLE))]-default_SituationMention :: SituationMention-default_SituationMention = SituationMention{- situationMention_uuid = Uuid_Types.default_UUID,- situationMention_text = P.Nothing,- situationMention_situationType = P.Nothing,- situationMention_argumentList = Vector.empty,- situationMention_situationKind = P.Nothing,- situationMention_intensity = P.Nothing,- situationMention_polarity = P.Nothing,- situationMention_tokens = P.Nothing,- situationMention_constituent = P.Nothing,- situationMention_confidence = P.Nothing}-data SituationMentionSet = SituationMentionSet { situationMentionSet_uuid :: Uuid_Types.UUID- , situationMentionSet_metadata :: Metadata_Types.AnnotationMetadata- , situationMentionSet_mentionList :: (Vector.Vector SituationMention)- , situationMentionSet_linkingList :: P.Maybe (Vector.Vector Linking_Types.Linking)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SituationMentionSet where- hashWithSalt salt record = salt `H.hashWithSalt` situationMentionSet_uuid record `H.hashWithSalt` situationMentionSet_metadata record `H.hashWithSalt` situationMentionSet_mentionList record `H.hashWithSalt` situationMentionSet_linkingList record -instance QC.Arbitrary SituationMentionSet where - arbitrary = M.liftM SituationMentionSet (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SituationMentionSet = []- | P.otherwise = M.catMaybes- [ if obj == default_SituationMentionSet{situationMentionSet_uuid = situationMentionSet_uuid obj} then P.Nothing else P.Just $ default_SituationMentionSet{situationMentionSet_uuid = situationMentionSet_uuid obj}- , if obj == default_SituationMentionSet{situationMentionSet_metadata = situationMentionSet_metadata obj} then P.Nothing else P.Just $ default_SituationMentionSet{situationMentionSet_metadata = situationMentionSet_metadata obj}- , if obj == default_SituationMentionSet{situationMentionSet_mentionList = situationMentionSet_mentionList obj} then P.Nothing else P.Just $ default_SituationMentionSet{situationMentionSet_mentionList = situationMentionSet_mentionList obj}- , if obj == default_SituationMentionSet{situationMentionSet_linkingList = situationMentionSet_linkingList obj} then P.Nothing else P.Just $ default_SituationMentionSet{situationMentionSet_linkingList = situationMentionSet_linkingList obj}- ]-from_SituationMentionSet :: SituationMentionSet -> T.ThriftVal-from_SituationMentionSet record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v122 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v122))) $ situationMentionSet_uuid record- , (\_v122 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v122))) $ situationMentionSet_metadata record- , (\_v122 -> P.Just (3, ("mentionList",T.TList (T.T_STRUCT typemap_SituationMention) $ P.map (\_v124 -> from_SituationMention _v124) $ Vector.toList _v122))) $ situationMentionSet_mentionList record- , (\_v122 -> (4, ("linkingList",T.TList (T.T_STRUCT Linking_Types.typemap_Linking) $ P.map (\_v126 -> Linking_Types.from_Linking _v126) $ Vector.toList _v122))) <$> situationMentionSet_linkingList record- ]-write_SituationMentionSet :: (T.Protocol p, T.Transport t) => p t -> SituationMentionSet -> P.IO ()-write_SituationMentionSet oprot record = T.writeVal oprot $ from_SituationMentionSet record-encode_SituationMentionSet :: (T.Protocol p, T.Transport t) => p t -> SituationMentionSet -> LBS.ByteString-encode_SituationMentionSet oprot record = T.serializeVal oprot $ from_SituationMentionSet record-to_SituationMentionSet :: T.ThriftVal -> SituationMentionSet-to_SituationMentionSet (T.TStruct fields) = SituationMentionSet{- situationMentionSet_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val128) -> (case _val128 of {T.TStruct _val129 -> (Uuid_Types.to_UUID (T.TStruct _val129)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- situationMentionSet_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val128) -> (case _val128 of {T.TStruct _val130 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val130)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- situationMentionSet_mentionList = P.maybe (P.error "Missing required field: mentionList") (\(_,_val128) -> (case _val128 of {T.TList _ _val131 -> (Vector.fromList $ P.map (\_v132 -> (case _v132 of {T.TStruct _val133 -> (to_SituationMention (T.TStruct _val133)); _ -> P.error "wrong type"})) _val131); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- situationMentionSet_linkingList = P.maybe (P.Nothing) (\(_,_val128) -> P.Just (case _val128 of {T.TList _ _val134 -> (Vector.fromList $ P.map (\_v135 -> (case _v135 of {T.TStruct _val136 -> (Linking_Types.to_Linking (T.TStruct _val136)); _ -> P.error "wrong type"})) _val134); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_SituationMentionSet _ = P.error "not a struct"-read_SituationMentionSet :: (T.Transport t, T.Protocol p) => p t -> P.IO SituationMentionSet-read_SituationMentionSet iprot = to_SituationMentionSet <$> T.readVal iprot (T.T_STRUCT typemap_SituationMentionSet)-decode_SituationMentionSet :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SituationMentionSet-decode_SituationMentionSet iprot bs = to_SituationMentionSet $ T.deserializeVal iprot (T.T_STRUCT typemap_SituationMentionSet) bs-typemap_SituationMentionSet :: T.TypeMap-typemap_SituationMentionSet = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("mentionList",(T.T_LIST (T.T_STRUCT typemap_SituationMention)))),(4,("linkingList",(T.T_LIST (T.T_STRUCT Linking_Types.typemap_Linking))))]-default_SituationMentionSet :: SituationMentionSet-default_SituationMentionSet = SituationMentionSet{- situationMentionSet_uuid = Uuid_Types.default_UUID,- situationMentionSet_metadata = Metadata_Types.default_AnnotationMetadata,- situationMentionSet_mentionList = Vector.empty,- situationMentionSet_linkingList = P.Nothing}
− src/Spans_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Spans_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Spans_Types
− src/Spans_Types.hs
@@ -1,116 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Spans_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data TextSpan = TextSpan { textSpan_start :: I.Int32- , textSpan_ending :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TextSpan where- hashWithSalt salt record = salt `H.hashWithSalt` textSpan_start record `H.hashWithSalt` textSpan_ending record -instance QC.Arbitrary TextSpan where - arbitrary = M.liftM TextSpan (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_TextSpan = []- | P.otherwise = M.catMaybes- [ if obj == default_TextSpan{textSpan_start = textSpan_start obj} then P.Nothing else P.Just $ default_TextSpan{textSpan_start = textSpan_start obj}- , if obj == default_TextSpan{textSpan_ending = textSpan_ending obj} then P.Nothing else P.Just $ default_TextSpan{textSpan_ending = textSpan_ending obj}- ]-from_TextSpan :: TextSpan -> T.ThriftVal-from_TextSpan record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("start",T.TI32 _v2))) $ textSpan_start record- , (\_v2 -> P.Just (2, ("ending",T.TI32 _v2))) $ textSpan_ending record- ]-write_TextSpan :: (T.Protocol p, T.Transport t) => p t -> TextSpan -> P.IO ()-write_TextSpan oprot record = T.writeVal oprot $ from_TextSpan record-encode_TextSpan :: (T.Protocol p, T.Transport t) => p t -> TextSpan -> LBS.ByteString-encode_TextSpan oprot record = T.serializeVal oprot $ from_TextSpan record-to_TextSpan :: T.ThriftVal -> TextSpan-to_TextSpan (T.TStruct fields) = TextSpan{- textSpan_start = P.maybe (P.error "Missing required field: start") (\(_,_val4) -> (case _val4 of {T.TI32 _val5 -> _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- textSpan_ending = P.maybe (P.error "Missing required field: ending") (\(_,_val4) -> (case _val4 of {T.TI32 _val6 -> _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_TextSpan _ = P.error "not a struct"-read_TextSpan :: (T.Transport t, T.Protocol p) => p t -> P.IO TextSpan-read_TextSpan iprot = to_TextSpan <$> T.readVal iprot (T.T_STRUCT typemap_TextSpan)-decode_TextSpan :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TextSpan-decode_TextSpan iprot bs = to_TextSpan $ T.deserializeVal iprot (T.T_STRUCT typemap_TextSpan) bs-typemap_TextSpan :: T.TypeMap-typemap_TextSpan = Map.fromList [(1,("start",T.T_I32)),(2,("ending",T.T_I32))]-default_TextSpan :: TextSpan-default_TextSpan = TextSpan{- textSpan_start = 0,- textSpan_ending = 0}-data AudioSpan = AudioSpan { audioSpan_start :: I.Int64- , audioSpan_ending :: I.Int64- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable AudioSpan where- hashWithSalt salt record = salt `H.hashWithSalt` audioSpan_start record `H.hashWithSalt` audioSpan_ending record -instance QC.Arbitrary AudioSpan where - arbitrary = M.liftM AudioSpan (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_AudioSpan = []- | P.otherwise = M.catMaybes- [ if obj == default_AudioSpan{audioSpan_start = audioSpan_start obj} then P.Nothing else P.Just $ default_AudioSpan{audioSpan_start = audioSpan_start obj}- , if obj == default_AudioSpan{audioSpan_ending = audioSpan_ending obj} then P.Nothing else P.Just $ default_AudioSpan{audioSpan_ending = audioSpan_ending obj}- ]-from_AudioSpan :: AudioSpan -> T.ThriftVal-from_AudioSpan record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v9 -> P.Just (1, ("start",T.TI64 _v9))) $ audioSpan_start record- , (\_v9 -> P.Just (2, ("ending",T.TI64 _v9))) $ audioSpan_ending record- ]-write_AudioSpan :: (T.Protocol p, T.Transport t) => p t -> AudioSpan -> P.IO ()-write_AudioSpan oprot record = T.writeVal oprot $ from_AudioSpan record-encode_AudioSpan :: (T.Protocol p, T.Transport t) => p t -> AudioSpan -> LBS.ByteString-encode_AudioSpan oprot record = T.serializeVal oprot $ from_AudioSpan record-to_AudioSpan :: T.ThriftVal -> AudioSpan-to_AudioSpan (T.TStruct fields) = AudioSpan{- audioSpan_start = P.maybe (P.error "Missing required field: start") (\(_,_val11) -> (case _val11 of {T.TI64 _val12 -> _val12; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- audioSpan_ending = P.maybe (P.error "Missing required field: ending") (\(_,_val11) -> (case _val11 of {T.TI64 _val13 -> _val13; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_AudioSpan _ = P.error "not a struct"-read_AudioSpan :: (T.Transport t, T.Protocol p) => p t -> P.IO AudioSpan-read_AudioSpan iprot = to_AudioSpan <$> T.readVal iprot (T.T_STRUCT typemap_AudioSpan)-decode_AudioSpan :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> AudioSpan-decode_AudioSpan iprot bs = to_AudioSpan $ T.deserializeVal iprot (T.T_STRUCT typemap_AudioSpan) bs-typemap_AudioSpan :: T.TypeMap-typemap_AudioSpan = Map.fromList [(1,("start",T.T_I64)),(2,("ending",T.T_I64))]-default_AudioSpan :: AudioSpan-default_AudioSpan = AudioSpan{- audioSpan_start = 0,- audioSpan_ending = 0}
− src/StoreCommunicationService.hs
@@ -1,145 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module StoreCommunicationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import qualified Service-import Access_Types-import qualified StoreCommunicationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Store_args = Store_args { store_args_communication :: Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Store_args where- hashWithSalt salt record = salt `H.hashWithSalt` store_args_communication record -instance QC.Arbitrary Store_args where - arbitrary = M.liftM Store_args (QC.arbitrary)- shrink obj | obj == default_Store_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Store_args{store_args_communication = store_args_communication obj} then P.Nothing else P.Just $ default_Store_args{store_args_communication = store_args_communication obj}- ]-from_Store_args :: Store_args -> T.ThriftVal-from_Store_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v66 -> P.Just (1, ("communication",Communication_Types.from_Communication _v66))) $ store_args_communication record- ]-write_Store_args :: (T.Protocol p, T.Transport t) => p t -> Store_args -> P.IO ()-write_Store_args oprot record = T.writeVal oprot $ from_Store_args record-encode_Store_args :: (T.Protocol p, T.Transport t) => p t -> Store_args -> LBS.ByteString-encode_Store_args oprot record = T.serializeVal oprot $ from_Store_args record-to_Store_args :: T.ThriftVal -> Store_args-to_Store_args (T.TStruct fields) = Store_args{- store_args_communication = P.maybe (store_args_communication default_Store_args) (\(_,_val68) -> (case _val68 of {T.TStruct _val69 -> (Communication_Types.to_Communication (T.TStruct _val69)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Store_args _ = P.error "not a struct"-read_Store_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Store_args-read_Store_args iprot = to_Store_args <$> T.readVal iprot (T.T_STRUCT typemap_Store_args)-decode_Store_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Store_args-decode_Store_args iprot bs = to_Store_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Store_args) bs-typemap_Store_args :: T.TypeMap-typemap_Store_args = Map.fromList [(1,("communication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_Store_args :: Store_args-default_Store_args = Store_args{- store_args_communication = Communication_Types.default_Communication}-data Store_result = Store_result { store_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Store_result where- hashWithSalt salt record = salt `H.hashWithSalt` store_result_ex record -instance QC.Arbitrary Store_result where - arbitrary = M.liftM Store_result (M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Store_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Store_result{store_result_ex = store_result_ex obj} then P.Nothing else P.Just $ default_Store_result{store_result_ex = store_result_ex obj}- ]-from_Store_result :: Store_result -> T.ThriftVal-from_Store_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v72 -> (1, ("ex",Services_Types.from_ServicesException _v72))) <$> store_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v72 -> (1, ("ex",Services_Types.from_ServicesException _v72))) <$> store_result_ex record- ]- )-write_Store_result :: (T.Protocol p, T.Transport t) => p t -> Store_result -> P.IO ()-write_Store_result oprot record = T.writeVal oprot $ from_Store_result record-encode_Store_result :: (T.Protocol p, T.Transport t) => p t -> Store_result -> LBS.ByteString-encode_Store_result oprot record = T.serializeVal oprot $ from_Store_result record-to_Store_result :: T.ThriftVal -> Store_result-to_Store_result (T.TStruct fields) = Store_result{- store_result_ex = P.maybe (P.Nothing) (\(_,_val74) -> P.Just (case _val74 of {T.TStruct _val75 -> (Services_Types.to_ServicesException (T.TStruct _val75)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Store_result _ = P.error "not a struct"-read_Store_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Store_result-read_Store_result iprot = to_Store_result <$> T.readVal iprot (T.T_STRUCT typemap_Store_result)-decode_Store_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Store_result-decode_Store_result iprot bs = to_Store_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Store_result) bs-typemap_Store_result :: T.TypeMap-typemap_Store_result = Map.fromList [(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Store_result :: Store_result-default_Store_result = Store_result{- store_result_ex = P.Nothing}-process_store (seqid, iprot, oprot, handler) = do- args <- read_Store_args iprot- (X.catch- (X.catch- (do- Iface.store handler (store_args_communication args)- let res = default_Store_result- T.writeMessageBegin oprot ("store", T.M_REPLY, seqid)- write_Store_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Store_result{store_result_ex = P.Just e}- T.writeMessageBegin oprot ("store", T.M_REPLY, seqid)- write_Store_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("store", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "store" -> process_store (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/StoreCommunicationService_Client.hs
@@ -1,65 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module StoreCommunicationService_Client(store) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types-import StoreCommunicationService-seqid = R.newIORef 0-store (ip,op) arg_communication = do- send_store op arg_communication- recv_store ip-send_store op arg_communication = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("store", T.M_CALL, seqn)- write_Store_args op (Store_args{store_args_communication=arg_communication})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_store ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Store_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (store_result_ex res)- P.return ()
− src/StoreCommunicationService_Iface.hs
@@ -1,48 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module StoreCommunicationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types---import Access_Types--import Service_Iface-class Service_Iface a => StoreCommunicationService_Iface a where- store :: a -> Communication_Types.Communication -> P.IO ()
− src/Structure_Consts.hs
@@ -1,46 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Structure_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Spans_Types-import qualified Uuid_Types-import qualified Language_Types---import Structure_Types
− src/Structure_Types.hs
@@ -1,1006 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Structure_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Metadata_Types-import qualified Spans_Types-import qualified Uuid_Types-import qualified Language_Types---data TokenizationKind = TOKEN_LIST|TOKEN_LATTICE deriving (P.Show, P.Eq, G.Generic, TY.Typeable, P.Ord, P.Bounded)-instance P.Enum TokenizationKind where- fromEnum t = case t of- TOKEN_LIST -> 1- TOKEN_LATTICE -> 2- toEnum t = case t of- 1 -> TOKEN_LIST- 2 -> TOKEN_LATTICE- _ -> X.throw T.ThriftException-instance H.Hashable TokenizationKind where- hashWithSalt salt = H.hashWithSalt salt P.. P.fromEnum-instance QC.Arbitrary TokenizationKind where- arbitrary = QC.elements (P.enumFromTo P.minBound P.maxBound)-data Token = Token { token_tokenIndex :: I.Int32- , token_text :: P.Maybe LT.Text- , token_textSpan :: P.Maybe Spans_Types.TextSpan- , token_rawTextSpan :: P.Maybe Spans_Types.TextSpan- , token_audioSpan :: P.Maybe Spans_Types.AudioSpan- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Token where- hashWithSalt salt record = salt `H.hashWithSalt` token_tokenIndex record `H.hashWithSalt` token_text record `H.hashWithSalt` token_textSpan record `H.hashWithSalt` token_rawTextSpan record `H.hashWithSalt` token_audioSpan record -instance QC.Arbitrary Token where - arbitrary = M.liftM Token (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Token = []- | P.otherwise = M.catMaybes- [ if obj == default_Token{token_tokenIndex = token_tokenIndex obj} then P.Nothing else P.Just $ default_Token{token_tokenIndex = token_tokenIndex obj}- , if obj == default_Token{token_text = token_text obj} then P.Nothing else P.Just $ default_Token{token_text = token_text obj}- , if obj == default_Token{token_textSpan = token_textSpan obj} then P.Nothing else P.Just $ default_Token{token_textSpan = token_textSpan obj}- , if obj == default_Token{token_rawTextSpan = token_rawTextSpan obj} then P.Nothing else P.Just $ default_Token{token_rawTextSpan = token_rawTextSpan obj}- , if obj == default_Token{token_audioSpan = token_audioSpan obj} then P.Nothing else P.Just $ default_Token{token_audioSpan = token_audioSpan obj}- ]-from_Token :: Token -> T.ThriftVal-from_Token record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("tokenIndex",T.TI32 _v2))) $ token_tokenIndex record- , (\_v2 -> (2, ("text",T.TString $ E.encodeUtf8 _v2))) <$> token_text record- , (\_v2 -> (3, ("textSpan",Spans_Types.from_TextSpan _v2))) <$> token_textSpan record- , (\_v2 -> (4, ("rawTextSpan",Spans_Types.from_TextSpan _v2))) <$> token_rawTextSpan record- , (\_v2 -> (5, ("audioSpan",Spans_Types.from_AudioSpan _v2))) <$> token_audioSpan record- ]-write_Token :: (T.Protocol p, T.Transport t) => p t -> Token -> P.IO ()-write_Token oprot record = T.writeVal oprot $ from_Token record-encode_Token :: (T.Protocol p, T.Transport t) => p t -> Token -> LBS.ByteString-encode_Token oprot record = T.serializeVal oprot $ from_Token record-to_Token :: T.ThriftVal -> Token-to_Token (T.TStruct fields) = Token{- token_tokenIndex = P.maybe (P.error "Missing required field: tokenIndex") (\(_,_val4) -> (case _val4 of {T.TI32 _val5 -> _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- token_text = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val6 -> E.decodeUtf8 _val6; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- token_textSpan = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TStruct _val7 -> (Spans_Types.to_TextSpan (T.TStruct _val7)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- token_rawTextSpan = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TStruct _val8 -> (Spans_Types.to_TextSpan (T.TStruct _val8)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- token_audioSpan = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TStruct _val9 -> (Spans_Types.to_AudioSpan (T.TStruct _val9)); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_Token _ = P.error "not a struct"-read_Token :: (T.Transport t, T.Protocol p) => p t -> P.IO Token-read_Token iprot = to_Token <$> T.readVal iprot (T.T_STRUCT typemap_Token)-decode_Token :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Token-decode_Token iprot bs = to_Token $ T.deserializeVal iprot (T.T_STRUCT typemap_Token) bs-typemap_Token :: T.TypeMap-typemap_Token = Map.fromList [(1,("tokenIndex",T.T_I32)),(2,("text",T.T_STRING)),(3,("textSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(4,("rawTextSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(5,("audioSpan",(T.T_STRUCT Spans_Types.typemap_AudioSpan)))]-default_Token :: Token-default_Token = Token{- token_tokenIndex = 0,- token_text = P.Nothing,- token_textSpan = P.Nothing,- token_rawTextSpan = P.Nothing,- token_audioSpan = P.Nothing}-data ConstituentRef = ConstituentRef { constituentRef_parseId :: Uuid_Types.UUID- , constituentRef_constituentIndex :: I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable ConstituentRef where- hashWithSalt salt record = salt `H.hashWithSalt` constituentRef_parseId record `H.hashWithSalt` constituentRef_constituentIndex record -instance QC.Arbitrary ConstituentRef where - arbitrary = M.liftM ConstituentRef (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_ConstituentRef = []- | P.otherwise = M.catMaybes- [ if obj == default_ConstituentRef{constituentRef_parseId = constituentRef_parseId obj} then P.Nothing else P.Just $ default_ConstituentRef{constituentRef_parseId = constituentRef_parseId obj}- , if obj == default_ConstituentRef{constituentRef_constituentIndex = constituentRef_constituentIndex obj} then P.Nothing else P.Just $ default_ConstituentRef{constituentRef_constituentIndex = constituentRef_constituentIndex obj}- ]-from_ConstituentRef :: ConstituentRef -> T.ThriftVal-from_ConstituentRef record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v12 -> P.Just (1, ("parseId",Uuid_Types.from_UUID _v12))) $ constituentRef_parseId record- , (\_v12 -> P.Just (2, ("constituentIndex",T.TI32 _v12))) $ constituentRef_constituentIndex record- ]-write_ConstituentRef :: (T.Protocol p, T.Transport t) => p t -> ConstituentRef -> P.IO ()-write_ConstituentRef oprot record = T.writeVal oprot $ from_ConstituentRef record-encode_ConstituentRef :: (T.Protocol p, T.Transport t) => p t -> ConstituentRef -> LBS.ByteString-encode_ConstituentRef oprot record = T.serializeVal oprot $ from_ConstituentRef record-to_ConstituentRef :: T.ThriftVal -> ConstituentRef-to_ConstituentRef (T.TStruct fields) = ConstituentRef{- constituentRef_parseId = P.maybe (P.error "Missing required field: parseId") (\(_,_val14) -> (case _val14 of {T.TStruct _val15 -> (Uuid_Types.to_UUID (T.TStruct _val15)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- constituentRef_constituentIndex = P.maybe (P.error "Missing required field: constituentIndex") (\(_,_val14) -> (case _val14 of {T.TI32 _val16 -> _val16; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_ConstituentRef _ = P.error "not a struct"-read_ConstituentRef :: (T.Transport t, T.Protocol p) => p t -> P.IO ConstituentRef-read_ConstituentRef iprot = to_ConstituentRef <$> T.readVal iprot (T.T_STRUCT typemap_ConstituentRef)-decode_ConstituentRef :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> ConstituentRef-decode_ConstituentRef iprot bs = to_ConstituentRef $ T.deserializeVal iprot (T.T_STRUCT typemap_ConstituentRef) bs-typemap_ConstituentRef :: T.TypeMap-typemap_ConstituentRef = Map.fromList [(1,("parseId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("constituentIndex",T.T_I32))]-default_ConstituentRef :: ConstituentRef-default_ConstituentRef = ConstituentRef{- constituentRef_parseId = Uuid_Types.default_UUID,- constituentRef_constituentIndex = 0}-data TokenRefSequence = TokenRefSequence { tokenRefSequence_tokenIndexList :: (Vector.Vector I.Int32)- , tokenRefSequence_anchorTokenIndex :: P.Maybe I.Int32- , tokenRefSequence_tokenizationId :: Uuid_Types.UUID- , tokenRefSequence_textSpan :: P.Maybe Spans_Types.TextSpan- , tokenRefSequence_rawTextSpan :: P.Maybe Spans_Types.TextSpan- , tokenRefSequence_audioSpan :: P.Maybe Spans_Types.AudioSpan- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TokenRefSequence where- hashWithSalt salt record = salt `H.hashWithSalt` tokenRefSequence_tokenIndexList record `H.hashWithSalt` tokenRefSequence_anchorTokenIndex record `H.hashWithSalt` tokenRefSequence_tokenizationId record `H.hashWithSalt` tokenRefSequence_textSpan record `H.hashWithSalt` tokenRefSequence_rawTextSpan record `H.hashWithSalt` tokenRefSequence_audioSpan record -instance QC.Arbitrary TokenRefSequence where - arbitrary = M.liftM TokenRefSequence (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TokenRefSequence = []- | P.otherwise = M.catMaybes- [ if obj == default_TokenRefSequence{tokenRefSequence_tokenIndexList = tokenRefSequence_tokenIndexList obj} then P.Nothing else P.Just $ default_TokenRefSequence{tokenRefSequence_tokenIndexList = tokenRefSequence_tokenIndexList obj}- , if obj == default_TokenRefSequence{tokenRefSequence_anchorTokenIndex = tokenRefSequence_anchorTokenIndex obj} then P.Nothing else P.Just $ default_TokenRefSequence{tokenRefSequence_anchorTokenIndex = tokenRefSequence_anchorTokenIndex obj}- , if obj == default_TokenRefSequence{tokenRefSequence_tokenizationId = tokenRefSequence_tokenizationId obj} then P.Nothing else P.Just $ default_TokenRefSequence{tokenRefSequence_tokenizationId = tokenRefSequence_tokenizationId obj}- , if obj == default_TokenRefSequence{tokenRefSequence_textSpan = tokenRefSequence_textSpan obj} then P.Nothing else P.Just $ default_TokenRefSequence{tokenRefSequence_textSpan = tokenRefSequence_textSpan obj}- , if obj == default_TokenRefSequence{tokenRefSequence_rawTextSpan = tokenRefSequence_rawTextSpan obj} then P.Nothing else P.Just $ default_TokenRefSequence{tokenRefSequence_rawTextSpan = tokenRefSequence_rawTextSpan obj}- , if obj == default_TokenRefSequence{tokenRefSequence_audioSpan = tokenRefSequence_audioSpan obj} then P.Nothing else P.Just $ default_TokenRefSequence{tokenRefSequence_audioSpan = tokenRefSequence_audioSpan obj}- ]-from_TokenRefSequence :: TokenRefSequence -> T.ThriftVal-from_TokenRefSequence record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v19 -> P.Just (1, ("tokenIndexList",T.TList T.T_I32 $ P.map (\_v21 -> T.TI32 _v21) $ Vector.toList _v19))) $ tokenRefSequence_tokenIndexList record- , (\_v19 -> (2, ("anchorTokenIndex",T.TI32 _v19))) <$> tokenRefSequence_anchorTokenIndex record- , (\_v19 -> P.Just (3, ("tokenizationId",Uuid_Types.from_UUID _v19))) $ tokenRefSequence_tokenizationId record- , (\_v19 -> (4, ("textSpan",Spans_Types.from_TextSpan _v19))) <$> tokenRefSequence_textSpan record- , (\_v19 -> (5, ("rawTextSpan",Spans_Types.from_TextSpan _v19))) <$> tokenRefSequence_rawTextSpan record- , (\_v19 -> (6, ("audioSpan",Spans_Types.from_AudioSpan _v19))) <$> tokenRefSequence_audioSpan record- ]-write_TokenRefSequence :: (T.Protocol p, T.Transport t) => p t -> TokenRefSequence -> P.IO ()-write_TokenRefSequence oprot record = T.writeVal oprot $ from_TokenRefSequence record-encode_TokenRefSequence :: (T.Protocol p, T.Transport t) => p t -> TokenRefSequence -> LBS.ByteString-encode_TokenRefSequence oprot record = T.serializeVal oprot $ from_TokenRefSequence record-to_TokenRefSequence :: T.ThriftVal -> TokenRefSequence-to_TokenRefSequence (T.TStruct fields) = TokenRefSequence{- tokenRefSequence_tokenIndexList = P.maybe (P.error "Missing required field: tokenIndexList") (\(_,_val23) -> (case _val23 of {T.TList _ _val24 -> (Vector.fromList $ P.map (\_v25 -> (case _v25 of {T.TI32 _val26 -> _val26; _ -> P.error "wrong type"})) _val24); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- tokenRefSequence_anchorTokenIndex = P.maybe (tokenRefSequence_anchorTokenIndex default_TokenRefSequence) (\(_,_val23) -> P.Just (case _val23 of {T.TI32 _val27 -> _val27; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- tokenRefSequence_tokenizationId = P.maybe (P.error "Missing required field: tokenizationId") (\(_,_val23) -> (case _val23 of {T.TStruct _val28 -> (Uuid_Types.to_UUID (T.TStruct _val28)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- tokenRefSequence_textSpan = P.maybe (P.Nothing) (\(_,_val23) -> P.Just (case _val23 of {T.TStruct _val29 -> (Spans_Types.to_TextSpan (T.TStruct _val29)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- tokenRefSequence_rawTextSpan = P.maybe (P.Nothing) (\(_,_val23) -> P.Just (case _val23 of {T.TStruct _val30 -> (Spans_Types.to_TextSpan (T.TStruct _val30)); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- tokenRefSequence_audioSpan = P.maybe (P.Nothing) (\(_,_val23) -> P.Just (case _val23 of {T.TStruct _val31 -> (Spans_Types.to_AudioSpan (T.TStruct _val31)); _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_TokenRefSequence _ = P.error "not a struct"-read_TokenRefSequence :: (T.Transport t, T.Protocol p) => p t -> P.IO TokenRefSequence-read_TokenRefSequence iprot = to_TokenRefSequence <$> T.readVal iprot (T.T_STRUCT typemap_TokenRefSequence)-decode_TokenRefSequence :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TokenRefSequence-decode_TokenRefSequence iprot bs = to_TokenRefSequence $ T.deserializeVal iprot (T.T_STRUCT typemap_TokenRefSequence) bs-typemap_TokenRefSequence :: T.TypeMap-typemap_TokenRefSequence = Map.fromList [(1,("tokenIndexList",(T.T_LIST T.T_I32))),(2,("anchorTokenIndex",T.T_I32)),(3,("tokenizationId",(T.T_STRUCT Uuid_Types.typemap_UUID))),(4,("textSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(5,("rawTextSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(6,("audioSpan",(T.T_STRUCT Spans_Types.typemap_AudioSpan)))]-default_TokenRefSequence :: TokenRefSequence-default_TokenRefSequence = TokenRefSequence{- tokenRefSequence_tokenIndexList = Vector.empty,- tokenRefSequence_anchorTokenIndex = P.Just (-1),- tokenRefSequence_tokenizationId = Uuid_Types.default_UUID,- tokenRefSequence_textSpan = P.Nothing,- tokenRefSequence_rawTextSpan = P.Nothing,- tokenRefSequence_audioSpan = P.Nothing}-data TaggedToken = TaggedToken { taggedToken_tokenIndex :: P.Maybe I.Int32- , taggedToken_tag :: P.Maybe LT.Text- , taggedToken_confidence :: P.Maybe P.Double- , taggedToken_tagList :: P.Maybe (Vector.Vector LT.Text)- , taggedToken_confidenceList :: P.Maybe (Vector.Vector P.Double)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TaggedToken where- hashWithSalt salt record = salt `H.hashWithSalt` taggedToken_tokenIndex record `H.hashWithSalt` taggedToken_tag record `H.hashWithSalt` taggedToken_confidence record `H.hashWithSalt` taggedToken_tagList record `H.hashWithSalt` taggedToken_confidenceList record -instance QC.Arbitrary TaggedToken where - arbitrary = M.liftM TaggedToken (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TaggedToken = []- | P.otherwise = M.catMaybes- [ if obj == default_TaggedToken{taggedToken_tokenIndex = taggedToken_tokenIndex obj} then P.Nothing else P.Just $ default_TaggedToken{taggedToken_tokenIndex = taggedToken_tokenIndex obj}- , if obj == default_TaggedToken{taggedToken_tag = taggedToken_tag obj} then P.Nothing else P.Just $ default_TaggedToken{taggedToken_tag = taggedToken_tag obj}- , if obj == default_TaggedToken{taggedToken_confidence = taggedToken_confidence obj} then P.Nothing else P.Just $ default_TaggedToken{taggedToken_confidence = taggedToken_confidence obj}- , if obj == default_TaggedToken{taggedToken_tagList = taggedToken_tagList obj} then P.Nothing else P.Just $ default_TaggedToken{taggedToken_tagList = taggedToken_tagList obj}- , if obj == default_TaggedToken{taggedToken_confidenceList = taggedToken_confidenceList obj} then P.Nothing else P.Just $ default_TaggedToken{taggedToken_confidenceList = taggedToken_confidenceList obj}- ]-from_TaggedToken :: TaggedToken -> T.ThriftVal-from_TaggedToken record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v34 -> (1, ("tokenIndex",T.TI32 _v34))) <$> taggedToken_tokenIndex record- , (\_v34 -> (2, ("tag",T.TString $ E.encodeUtf8 _v34))) <$> taggedToken_tag record- , (\_v34 -> (3, ("confidence",T.TDouble _v34))) <$> taggedToken_confidence record- , (\_v34 -> (4, ("tagList",T.TList T.T_STRING $ P.map (\_v36 -> T.TString $ E.encodeUtf8 _v36) $ Vector.toList _v34))) <$> taggedToken_tagList record- , (\_v34 -> (5, ("confidenceList",T.TList T.T_DOUBLE $ P.map (\_v38 -> T.TDouble _v38) $ Vector.toList _v34))) <$> taggedToken_confidenceList record- ]-write_TaggedToken :: (T.Protocol p, T.Transport t) => p t -> TaggedToken -> P.IO ()-write_TaggedToken oprot record = T.writeVal oprot $ from_TaggedToken record-encode_TaggedToken :: (T.Protocol p, T.Transport t) => p t -> TaggedToken -> LBS.ByteString-encode_TaggedToken oprot record = T.serializeVal oprot $ from_TaggedToken record-to_TaggedToken :: T.ThriftVal -> TaggedToken-to_TaggedToken (T.TStruct fields) = TaggedToken{- taggedToken_tokenIndex = P.maybe (P.Nothing) (\(_,_val40) -> P.Just (case _val40 of {T.TI32 _val41 -> _val41; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- taggedToken_tag = P.maybe (P.Nothing) (\(_,_val40) -> P.Just (case _val40 of {T.TString _val42 -> E.decodeUtf8 _val42; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- taggedToken_confidence = P.maybe (P.Nothing) (\(_,_val40) -> P.Just (case _val40 of {T.TDouble _val43 -> _val43; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- taggedToken_tagList = P.maybe (P.Nothing) (\(_,_val40) -> P.Just (case _val40 of {T.TList _ _val44 -> (Vector.fromList $ P.map (\_v45 -> (case _v45 of {T.TString _val46 -> E.decodeUtf8 _val46; _ -> P.error "wrong type"})) _val44); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- taggedToken_confidenceList = P.maybe (P.Nothing) (\(_,_val40) -> P.Just (case _val40 of {T.TList _ _val47 -> (Vector.fromList $ P.map (\_v48 -> (case _v48 of {T.TDouble _val49 -> _val49; _ -> P.error "wrong type"})) _val47); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_TaggedToken _ = P.error "not a struct"-read_TaggedToken :: (T.Transport t, T.Protocol p) => p t -> P.IO TaggedToken-read_TaggedToken iprot = to_TaggedToken <$> T.readVal iprot (T.T_STRUCT typemap_TaggedToken)-decode_TaggedToken :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TaggedToken-decode_TaggedToken iprot bs = to_TaggedToken $ T.deserializeVal iprot (T.T_STRUCT typemap_TaggedToken) bs-typemap_TaggedToken :: T.TypeMap-typemap_TaggedToken = Map.fromList [(1,("tokenIndex",T.T_I32)),(2,("tag",T.T_STRING)),(3,("confidence",T.T_DOUBLE)),(4,("tagList",(T.T_LIST T.T_STRING))),(5,("confidenceList",(T.T_LIST T.T_DOUBLE)))]-default_TaggedToken :: TaggedToken-default_TaggedToken = TaggedToken{- taggedToken_tokenIndex = P.Nothing,- taggedToken_tag = P.Nothing,- taggedToken_confidence = P.Nothing,- taggedToken_tagList = P.Nothing,- taggedToken_confidenceList = P.Nothing}-data TokenTagging = TokenTagging { tokenTagging_uuid :: Uuid_Types.UUID- , tokenTagging_metadata :: Metadata_Types.AnnotationMetadata- , tokenTagging_taggedTokenList :: (Vector.Vector TaggedToken)- , tokenTagging_taggingType :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TokenTagging where- hashWithSalt salt record = salt `H.hashWithSalt` tokenTagging_uuid record `H.hashWithSalt` tokenTagging_metadata record `H.hashWithSalt` tokenTagging_taggedTokenList record `H.hashWithSalt` tokenTagging_taggingType record -instance QC.Arbitrary TokenTagging where - arbitrary = M.liftM TokenTagging (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TokenTagging = []- | P.otherwise = M.catMaybes- [ if obj == default_TokenTagging{tokenTagging_uuid = tokenTagging_uuid obj} then P.Nothing else P.Just $ default_TokenTagging{tokenTagging_uuid = tokenTagging_uuid obj}- , if obj == default_TokenTagging{tokenTagging_metadata = tokenTagging_metadata obj} then P.Nothing else P.Just $ default_TokenTagging{tokenTagging_metadata = tokenTagging_metadata obj}- , if obj == default_TokenTagging{tokenTagging_taggedTokenList = tokenTagging_taggedTokenList obj} then P.Nothing else P.Just $ default_TokenTagging{tokenTagging_taggedTokenList = tokenTagging_taggedTokenList obj}- , if obj == default_TokenTagging{tokenTagging_taggingType = tokenTagging_taggingType obj} then P.Nothing else P.Just $ default_TokenTagging{tokenTagging_taggingType = tokenTagging_taggingType obj}- ]-from_TokenTagging :: TokenTagging -> T.ThriftVal-from_TokenTagging record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v52 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v52))) $ tokenTagging_uuid record- , (\_v52 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v52))) $ tokenTagging_metadata record- , (\_v52 -> P.Just (3, ("taggedTokenList",T.TList (T.T_STRUCT typemap_TaggedToken) $ P.map (\_v54 -> from_TaggedToken _v54) $ Vector.toList _v52))) $ tokenTagging_taggedTokenList record- , (\_v52 -> (4, ("taggingType",T.TString $ E.encodeUtf8 _v52))) <$> tokenTagging_taggingType record- ]-write_TokenTagging :: (T.Protocol p, T.Transport t) => p t -> TokenTagging -> P.IO ()-write_TokenTagging oprot record = T.writeVal oprot $ from_TokenTagging record-encode_TokenTagging :: (T.Protocol p, T.Transport t) => p t -> TokenTagging -> LBS.ByteString-encode_TokenTagging oprot record = T.serializeVal oprot $ from_TokenTagging record-to_TokenTagging :: T.ThriftVal -> TokenTagging-to_TokenTagging (T.TStruct fields) = TokenTagging{- tokenTagging_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val56) -> (case _val56 of {T.TStruct _val57 -> (Uuid_Types.to_UUID (T.TStruct _val57)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- tokenTagging_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val56) -> (case _val56 of {T.TStruct _val58 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val58)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- tokenTagging_taggedTokenList = P.maybe (P.error "Missing required field: taggedTokenList") (\(_,_val56) -> (case _val56 of {T.TList _ _val59 -> (Vector.fromList $ P.map (\_v60 -> (case _v60 of {T.TStruct _val61 -> (to_TaggedToken (T.TStruct _val61)); _ -> P.error "wrong type"})) _val59); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- tokenTagging_taggingType = P.maybe (P.Nothing) (\(_,_val56) -> P.Just (case _val56 of {T.TString _val62 -> E.decodeUtf8 _val62; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_TokenTagging _ = P.error "not a struct"-read_TokenTagging :: (T.Transport t, T.Protocol p) => p t -> P.IO TokenTagging-read_TokenTagging iprot = to_TokenTagging <$> T.readVal iprot (T.T_STRUCT typemap_TokenTagging)-decode_TokenTagging :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TokenTagging-decode_TokenTagging iprot bs = to_TokenTagging $ T.deserializeVal iprot (T.T_STRUCT typemap_TokenTagging) bs-typemap_TokenTagging :: T.TypeMap-typemap_TokenTagging = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("taggedTokenList",(T.T_LIST (T.T_STRUCT typemap_TaggedToken)))),(4,("taggingType",T.T_STRING))]-default_TokenTagging :: TokenTagging-default_TokenTagging = TokenTagging{- tokenTagging_uuid = Uuid_Types.default_UUID,- tokenTagging_metadata = Metadata_Types.default_AnnotationMetadata,- tokenTagging_taggedTokenList = Vector.empty,- tokenTagging_taggingType = P.Nothing}-data Dependency = Dependency { dependency_gov :: P.Maybe I.Int32- , dependency_dep :: I.Int32- , dependency_edgeType :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Dependency where- hashWithSalt salt record = salt `H.hashWithSalt` dependency_gov record `H.hashWithSalt` dependency_dep record `H.hashWithSalt` dependency_edgeType record -instance QC.Arbitrary Dependency where - arbitrary = M.liftM Dependency (M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Dependency = []- | P.otherwise = M.catMaybes- [ if obj == default_Dependency{dependency_gov = dependency_gov obj} then P.Nothing else P.Just $ default_Dependency{dependency_gov = dependency_gov obj}- , if obj == default_Dependency{dependency_dep = dependency_dep obj} then P.Nothing else P.Just $ default_Dependency{dependency_dep = dependency_dep obj}- , if obj == default_Dependency{dependency_edgeType = dependency_edgeType obj} then P.Nothing else P.Just $ default_Dependency{dependency_edgeType = dependency_edgeType obj}- ]-from_Dependency :: Dependency -> T.ThriftVal-from_Dependency record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v65 -> (1, ("gov",T.TI32 _v65))) <$> dependency_gov record- , (\_v65 -> P.Just (2, ("dep",T.TI32 _v65))) $ dependency_dep record- , (\_v65 -> (3, ("edgeType",T.TString $ E.encodeUtf8 _v65))) <$> dependency_edgeType record- ]-write_Dependency :: (T.Protocol p, T.Transport t) => p t -> Dependency -> P.IO ()-write_Dependency oprot record = T.writeVal oprot $ from_Dependency record-encode_Dependency :: (T.Protocol p, T.Transport t) => p t -> Dependency -> LBS.ByteString-encode_Dependency oprot record = T.serializeVal oprot $ from_Dependency record-to_Dependency :: T.ThriftVal -> Dependency-to_Dependency (T.TStruct fields) = Dependency{- dependency_gov = P.maybe (dependency_gov default_Dependency) (\(_,_val67) -> P.Just (case _val67 of {T.TI32 _val68 -> _val68; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- dependency_dep = P.maybe (P.error "Missing required field: dep") (\(_,_val67) -> (case _val67 of {T.TI32 _val69 -> _val69; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- dependency_edgeType = P.maybe (P.Nothing) (\(_,_val67) -> P.Just (case _val67 of {T.TString _val70 -> E.decodeUtf8 _val70; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Dependency _ = P.error "not a struct"-read_Dependency :: (T.Transport t, T.Protocol p) => p t -> P.IO Dependency-read_Dependency iprot = to_Dependency <$> T.readVal iprot (T.T_STRUCT typemap_Dependency)-decode_Dependency :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Dependency-decode_Dependency iprot bs = to_Dependency $ T.deserializeVal iprot (T.T_STRUCT typemap_Dependency) bs-typemap_Dependency :: T.TypeMap-typemap_Dependency = Map.fromList [(1,("gov",T.T_I32)),(2,("dep",T.T_I32)),(3,("edgeType",T.T_STRING))]-default_Dependency :: Dependency-default_Dependency = Dependency{- dependency_gov = P.Just (-1),- dependency_dep = 0,- dependency_edgeType = P.Nothing}-data DependencyParseStructure = DependencyParseStructure { dependencyParseStructure_isAcyclic :: P.Bool- , dependencyParseStructure_isConnected :: P.Bool- , dependencyParseStructure_isSingleHeaded :: P.Bool- , dependencyParseStructure_isProjective :: P.Bool- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable DependencyParseStructure where- hashWithSalt salt record = salt `H.hashWithSalt` dependencyParseStructure_isAcyclic record `H.hashWithSalt` dependencyParseStructure_isConnected record `H.hashWithSalt` dependencyParseStructure_isSingleHeaded record `H.hashWithSalt` dependencyParseStructure_isProjective record -instance QC.Arbitrary DependencyParseStructure where - arbitrary = M.liftM DependencyParseStructure (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_DependencyParseStructure = []- | P.otherwise = M.catMaybes- [ if obj == default_DependencyParseStructure{dependencyParseStructure_isAcyclic = dependencyParseStructure_isAcyclic obj} then P.Nothing else P.Just $ default_DependencyParseStructure{dependencyParseStructure_isAcyclic = dependencyParseStructure_isAcyclic obj}- , if obj == default_DependencyParseStructure{dependencyParseStructure_isConnected = dependencyParseStructure_isConnected obj} then P.Nothing else P.Just $ default_DependencyParseStructure{dependencyParseStructure_isConnected = dependencyParseStructure_isConnected obj}- , if obj == default_DependencyParseStructure{dependencyParseStructure_isSingleHeaded = dependencyParseStructure_isSingleHeaded obj} then P.Nothing else P.Just $ default_DependencyParseStructure{dependencyParseStructure_isSingleHeaded = dependencyParseStructure_isSingleHeaded obj}- , if obj == default_DependencyParseStructure{dependencyParseStructure_isProjective = dependencyParseStructure_isProjective obj} then P.Nothing else P.Just $ default_DependencyParseStructure{dependencyParseStructure_isProjective = dependencyParseStructure_isProjective obj}- ]-from_DependencyParseStructure :: DependencyParseStructure -> T.ThriftVal-from_DependencyParseStructure record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v73 -> P.Just (1, ("isAcyclic",T.TBool _v73))) $ dependencyParseStructure_isAcyclic record- , (\_v73 -> P.Just (2, ("isConnected",T.TBool _v73))) $ dependencyParseStructure_isConnected record- , (\_v73 -> P.Just (3, ("isSingleHeaded",T.TBool _v73))) $ dependencyParseStructure_isSingleHeaded record- , (\_v73 -> P.Just (4, ("isProjective",T.TBool _v73))) $ dependencyParseStructure_isProjective record- ]-write_DependencyParseStructure :: (T.Protocol p, T.Transport t) => p t -> DependencyParseStructure -> P.IO ()-write_DependencyParseStructure oprot record = T.writeVal oprot $ from_DependencyParseStructure record-encode_DependencyParseStructure :: (T.Protocol p, T.Transport t) => p t -> DependencyParseStructure -> LBS.ByteString-encode_DependencyParseStructure oprot record = T.serializeVal oprot $ from_DependencyParseStructure record-to_DependencyParseStructure :: T.ThriftVal -> DependencyParseStructure-to_DependencyParseStructure (T.TStruct fields) = DependencyParseStructure{- dependencyParseStructure_isAcyclic = P.maybe (P.error "Missing required field: isAcyclic") (\(_,_val75) -> (case _val75 of {T.TBool _val76 -> _val76; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- dependencyParseStructure_isConnected = P.maybe (P.error "Missing required field: isConnected") (\(_,_val75) -> (case _val75 of {T.TBool _val77 -> _val77; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- dependencyParseStructure_isSingleHeaded = P.maybe (P.error "Missing required field: isSingleHeaded") (\(_,_val75) -> (case _val75 of {T.TBool _val78 -> _val78; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- dependencyParseStructure_isProjective = P.maybe (P.error "Missing required field: isProjective") (\(_,_val75) -> (case _val75 of {T.TBool _val79 -> _val79; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_DependencyParseStructure _ = P.error "not a struct"-read_DependencyParseStructure :: (T.Transport t, T.Protocol p) => p t -> P.IO DependencyParseStructure-read_DependencyParseStructure iprot = to_DependencyParseStructure <$> T.readVal iprot (T.T_STRUCT typemap_DependencyParseStructure)-decode_DependencyParseStructure :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> DependencyParseStructure-decode_DependencyParseStructure iprot bs = to_DependencyParseStructure $ T.deserializeVal iprot (T.T_STRUCT typemap_DependencyParseStructure) bs-typemap_DependencyParseStructure :: T.TypeMap-typemap_DependencyParseStructure = Map.fromList [(1,("isAcyclic",T.T_BOOL)),(2,("isConnected",T.T_BOOL)),(3,("isSingleHeaded",T.T_BOOL)),(4,("isProjective",T.T_BOOL))]-default_DependencyParseStructure :: DependencyParseStructure-default_DependencyParseStructure = DependencyParseStructure{- dependencyParseStructure_isAcyclic = P.False,- dependencyParseStructure_isConnected = P.False,- dependencyParseStructure_isSingleHeaded = P.False,- dependencyParseStructure_isProjective = P.False}-data DependencyParse = DependencyParse { dependencyParse_uuid :: Uuid_Types.UUID- , dependencyParse_metadata :: Metadata_Types.AnnotationMetadata- , dependencyParse_dependencyList :: (Vector.Vector Dependency)- , dependencyParse_structureInformation :: P.Maybe DependencyParseStructure- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable DependencyParse where- hashWithSalt salt record = salt `H.hashWithSalt` dependencyParse_uuid record `H.hashWithSalt` dependencyParse_metadata record `H.hashWithSalt` dependencyParse_dependencyList record `H.hashWithSalt` dependencyParse_structureInformation record -instance QC.Arbitrary DependencyParse where - arbitrary = M.liftM DependencyParse (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_DependencyParse = []- | P.otherwise = M.catMaybes- [ if obj == default_DependencyParse{dependencyParse_uuid = dependencyParse_uuid obj} then P.Nothing else P.Just $ default_DependencyParse{dependencyParse_uuid = dependencyParse_uuid obj}- , if obj == default_DependencyParse{dependencyParse_metadata = dependencyParse_metadata obj} then P.Nothing else P.Just $ default_DependencyParse{dependencyParse_metadata = dependencyParse_metadata obj}- , if obj == default_DependencyParse{dependencyParse_dependencyList = dependencyParse_dependencyList obj} then P.Nothing else P.Just $ default_DependencyParse{dependencyParse_dependencyList = dependencyParse_dependencyList obj}- , if obj == default_DependencyParse{dependencyParse_structureInformation = dependencyParse_structureInformation obj} then P.Nothing else P.Just $ default_DependencyParse{dependencyParse_structureInformation = dependencyParse_structureInformation obj}- ]-from_DependencyParse :: DependencyParse -> T.ThriftVal-from_DependencyParse record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v82 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v82))) $ dependencyParse_uuid record- , (\_v82 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v82))) $ dependencyParse_metadata record- , (\_v82 -> P.Just (3, ("dependencyList",T.TList (T.T_STRUCT typemap_Dependency) $ P.map (\_v84 -> from_Dependency _v84) $ Vector.toList _v82))) $ dependencyParse_dependencyList record- , (\_v82 -> (4, ("structureInformation",from_DependencyParseStructure _v82))) <$> dependencyParse_structureInformation record- ]-write_DependencyParse :: (T.Protocol p, T.Transport t) => p t -> DependencyParse -> P.IO ()-write_DependencyParse oprot record = T.writeVal oprot $ from_DependencyParse record-encode_DependencyParse :: (T.Protocol p, T.Transport t) => p t -> DependencyParse -> LBS.ByteString-encode_DependencyParse oprot record = T.serializeVal oprot $ from_DependencyParse record-to_DependencyParse :: T.ThriftVal -> DependencyParse-to_DependencyParse (T.TStruct fields) = DependencyParse{- dependencyParse_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val86) -> (case _val86 of {T.TStruct _val87 -> (Uuid_Types.to_UUID (T.TStruct _val87)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- dependencyParse_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val86) -> (case _val86 of {T.TStruct _val88 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val88)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- dependencyParse_dependencyList = P.maybe (P.error "Missing required field: dependencyList") (\(_,_val86) -> (case _val86 of {T.TList _ _val89 -> (Vector.fromList $ P.map (\_v90 -> (case _v90 of {T.TStruct _val91 -> (to_Dependency (T.TStruct _val91)); _ -> P.error "wrong type"})) _val89); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- dependencyParse_structureInformation = P.maybe (P.Nothing) (\(_,_val86) -> P.Just (case _val86 of {T.TStruct _val92 -> (to_DependencyParseStructure (T.TStruct _val92)); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_DependencyParse _ = P.error "not a struct"-read_DependencyParse :: (T.Transport t, T.Protocol p) => p t -> P.IO DependencyParse-read_DependencyParse iprot = to_DependencyParse <$> T.readVal iprot (T.T_STRUCT typemap_DependencyParse)-decode_DependencyParse :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> DependencyParse-decode_DependencyParse iprot bs = to_DependencyParse $ T.deserializeVal iprot (T.T_STRUCT typemap_DependencyParse) bs-typemap_DependencyParse :: T.TypeMap-typemap_DependencyParse = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("dependencyList",(T.T_LIST (T.T_STRUCT typemap_Dependency)))),(4,("structureInformation",(T.T_STRUCT typemap_DependencyParseStructure)))]-default_DependencyParse :: DependencyParse-default_DependencyParse = DependencyParse{- dependencyParse_uuid = Uuid_Types.default_UUID,- dependencyParse_metadata = Metadata_Types.default_AnnotationMetadata,- dependencyParse_dependencyList = Vector.empty,- dependencyParse_structureInformation = P.Nothing}-data Constituent = Constituent { constituent_id :: I.Int32- , constituent_tag :: P.Maybe LT.Text- , constituent_childList :: (Vector.Vector I.Int32)- , constituent_headChildIndex :: P.Maybe I.Int32- , constituent_start :: P.Maybe I.Int32- , constituent_ending :: P.Maybe I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Constituent where- hashWithSalt salt record = salt `H.hashWithSalt` constituent_id record `H.hashWithSalt` constituent_tag record `H.hashWithSalt` constituent_childList record `H.hashWithSalt` constituent_headChildIndex record `H.hashWithSalt` constituent_start record `H.hashWithSalt` constituent_ending record -instance QC.Arbitrary Constituent where - arbitrary = M.liftM Constituent (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Constituent = []- | P.otherwise = M.catMaybes- [ if obj == default_Constituent{constituent_id = constituent_id obj} then P.Nothing else P.Just $ default_Constituent{constituent_id = constituent_id obj}- , if obj == default_Constituent{constituent_tag = constituent_tag obj} then P.Nothing else P.Just $ default_Constituent{constituent_tag = constituent_tag obj}- , if obj == default_Constituent{constituent_childList = constituent_childList obj} then P.Nothing else P.Just $ default_Constituent{constituent_childList = constituent_childList obj}- , if obj == default_Constituent{constituent_headChildIndex = constituent_headChildIndex obj} then P.Nothing else P.Just $ default_Constituent{constituent_headChildIndex = constituent_headChildIndex obj}- , if obj == default_Constituent{constituent_start = constituent_start obj} then P.Nothing else P.Just $ default_Constituent{constituent_start = constituent_start obj}- , if obj == default_Constituent{constituent_ending = constituent_ending obj} then P.Nothing else P.Just $ default_Constituent{constituent_ending = constituent_ending obj}- ]-from_Constituent :: Constituent -> T.ThriftVal-from_Constituent record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v95 -> P.Just (1, ("id",T.TI32 _v95))) $ constituent_id record- , (\_v95 -> (2, ("tag",T.TString $ E.encodeUtf8 _v95))) <$> constituent_tag record- , (\_v95 -> P.Just (3, ("childList",T.TList T.T_I32 $ P.map (\_v97 -> T.TI32 _v97) $ Vector.toList _v95))) $ constituent_childList record- , (\_v95 -> (4, ("headChildIndex",T.TI32 _v95))) <$> constituent_headChildIndex record- , (\_v95 -> (5, ("start",T.TI32 _v95))) <$> constituent_start record- , (\_v95 -> (6, ("ending",T.TI32 _v95))) <$> constituent_ending record- ]-write_Constituent :: (T.Protocol p, T.Transport t) => p t -> Constituent -> P.IO ()-write_Constituent oprot record = T.writeVal oprot $ from_Constituent record-encode_Constituent :: (T.Protocol p, T.Transport t) => p t -> Constituent -> LBS.ByteString-encode_Constituent oprot record = T.serializeVal oprot $ from_Constituent record-to_Constituent :: T.ThriftVal -> Constituent-to_Constituent (T.TStruct fields) = Constituent{- constituent_id = P.maybe (P.error "Missing required field: id") (\(_,_val99) -> (case _val99 of {T.TI32 _val100 -> _val100; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- constituent_tag = P.maybe (P.Nothing) (\(_,_val99) -> P.Just (case _val99 of {T.TString _val101 -> E.decodeUtf8 _val101; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- constituent_childList = P.maybe (P.error "Missing required field: childList") (\(_,_val99) -> (case _val99 of {T.TList _ _val102 -> (Vector.fromList $ P.map (\_v103 -> (case _v103 of {T.TI32 _val104 -> _val104; _ -> P.error "wrong type"})) _val102); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- constituent_headChildIndex = P.maybe (constituent_headChildIndex default_Constituent) (\(_,_val99) -> P.Just (case _val99 of {T.TI32 _val105 -> _val105; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- constituent_start = P.maybe (P.Nothing) (\(_,_val99) -> P.Just (case _val99 of {T.TI32 _val106 -> _val106; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- constituent_ending = P.maybe (P.Nothing) (\(_,_val99) -> P.Just (case _val99 of {T.TI32 _val107 -> _val107; _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_Constituent _ = P.error "not a struct"-read_Constituent :: (T.Transport t, T.Protocol p) => p t -> P.IO Constituent-read_Constituent iprot = to_Constituent <$> T.readVal iprot (T.T_STRUCT typemap_Constituent)-decode_Constituent :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Constituent-decode_Constituent iprot bs = to_Constituent $ T.deserializeVal iprot (T.T_STRUCT typemap_Constituent) bs-typemap_Constituent :: T.TypeMap-typemap_Constituent = Map.fromList [(1,("id",T.T_I32)),(2,("tag",T.T_STRING)),(3,("childList",(T.T_LIST T.T_I32))),(4,("headChildIndex",T.T_I32)),(5,("start",T.T_I32)),(6,("ending",T.T_I32))]-default_Constituent :: Constituent-default_Constituent = Constituent{- constituent_id = 0,- constituent_tag = P.Nothing,- constituent_childList = Vector.empty,- constituent_headChildIndex = P.Just (-1),- constituent_start = P.Nothing,- constituent_ending = P.Nothing}-data Parse = Parse { parse_uuid :: Uuid_Types.UUID- , parse_metadata :: Metadata_Types.AnnotationMetadata- , parse_constituentList :: (Vector.Vector Constituent)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Parse where- hashWithSalt salt record = salt `H.hashWithSalt` parse_uuid record `H.hashWithSalt` parse_metadata record `H.hashWithSalt` parse_constituentList record -instance QC.Arbitrary Parse where - arbitrary = M.liftM Parse (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_Parse = []- | P.otherwise = M.catMaybes- [ if obj == default_Parse{parse_uuid = parse_uuid obj} then P.Nothing else P.Just $ default_Parse{parse_uuid = parse_uuid obj}- , if obj == default_Parse{parse_metadata = parse_metadata obj} then P.Nothing else P.Just $ default_Parse{parse_metadata = parse_metadata obj}- , if obj == default_Parse{parse_constituentList = parse_constituentList obj} then P.Nothing else P.Just $ default_Parse{parse_constituentList = parse_constituentList obj}- ]-from_Parse :: Parse -> T.ThriftVal-from_Parse record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v110 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v110))) $ parse_uuid record- , (\_v110 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v110))) $ parse_metadata record- , (\_v110 -> P.Just (3, ("constituentList",T.TList (T.T_STRUCT typemap_Constituent) $ P.map (\_v112 -> from_Constituent _v112) $ Vector.toList _v110))) $ parse_constituentList record- ]-write_Parse :: (T.Protocol p, T.Transport t) => p t -> Parse -> P.IO ()-write_Parse oprot record = T.writeVal oprot $ from_Parse record-encode_Parse :: (T.Protocol p, T.Transport t) => p t -> Parse -> LBS.ByteString-encode_Parse oprot record = T.serializeVal oprot $ from_Parse record-to_Parse :: T.ThriftVal -> Parse-to_Parse (T.TStruct fields) = Parse{- parse_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val114) -> (case _val114 of {T.TStruct _val115 -> (Uuid_Types.to_UUID (T.TStruct _val115)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- parse_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val114) -> (case _val114 of {T.TStruct _val116 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val116)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- parse_constituentList = P.maybe (P.error "Missing required field: constituentList") (\(_,_val114) -> (case _val114 of {T.TList _ _val117 -> (Vector.fromList $ P.map (\_v118 -> (case _v118 of {T.TStruct _val119 -> (to_Constituent (T.TStruct _val119)); _ -> P.error "wrong type"})) _val117); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_Parse _ = P.error "not a struct"-read_Parse :: (T.Transport t, T.Protocol p) => p t -> P.IO Parse-read_Parse iprot = to_Parse <$> T.readVal iprot (T.T_STRUCT typemap_Parse)-decode_Parse :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Parse-decode_Parse iprot bs = to_Parse $ T.deserializeVal iprot (T.T_STRUCT typemap_Parse) bs-typemap_Parse :: T.TypeMap-typemap_Parse = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("constituentList",(T.T_LIST (T.T_STRUCT typemap_Constituent))))]-default_Parse :: Parse-default_Parse = Parse{- parse_uuid = Uuid_Types.default_UUID,- parse_metadata = Metadata_Types.default_AnnotationMetadata,- parse_constituentList = Vector.empty}-data LatticePath = LatticePath { latticePath_weight :: P.Maybe P.Double- , latticePath_tokenList :: (Vector.Vector Token)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable LatticePath where- hashWithSalt salt record = salt `H.hashWithSalt` latticePath_weight record `H.hashWithSalt` latticePath_tokenList record -instance QC.Arbitrary LatticePath where - arbitrary = M.liftM LatticePath (M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_LatticePath = []- | P.otherwise = M.catMaybes- [ if obj == default_LatticePath{latticePath_weight = latticePath_weight obj} then P.Nothing else P.Just $ default_LatticePath{latticePath_weight = latticePath_weight obj}- , if obj == default_LatticePath{latticePath_tokenList = latticePath_tokenList obj} then P.Nothing else P.Just $ default_LatticePath{latticePath_tokenList = latticePath_tokenList obj}- ]-from_LatticePath :: LatticePath -> T.ThriftVal-from_LatticePath record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v122 -> (1, ("weight",T.TDouble _v122))) <$> latticePath_weight record- , (\_v122 -> P.Just (2, ("tokenList",T.TList (T.T_STRUCT typemap_Token) $ P.map (\_v124 -> from_Token _v124) $ Vector.toList _v122))) $ latticePath_tokenList record- ]-write_LatticePath :: (T.Protocol p, T.Transport t) => p t -> LatticePath -> P.IO ()-write_LatticePath oprot record = T.writeVal oprot $ from_LatticePath record-encode_LatticePath :: (T.Protocol p, T.Transport t) => p t -> LatticePath -> LBS.ByteString-encode_LatticePath oprot record = T.serializeVal oprot $ from_LatticePath record-to_LatticePath :: T.ThriftVal -> LatticePath-to_LatticePath (T.TStruct fields) = LatticePath{- latticePath_weight = P.maybe (P.Nothing) (\(_,_val126) -> P.Just (case _val126 of {T.TDouble _val127 -> _val127; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- latticePath_tokenList = P.maybe (P.error "Missing required field: tokenList") (\(_,_val126) -> (case _val126 of {T.TList _ _val128 -> (Vector.fromList $ P.map (\_v129 -> (case _v129 of {T.TStruct _val130 -> (to_Token (T.TStruct _val130)); _ -> P.error "wrong type"})) _val128); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_LatticePath _ = P.error "not a struct"-read_LatticePath :: (T.Transport t, T.Protocol p) => p t -> P.IO LatticePath-read_LatticePath iprot = to_LatticePath <$> T.readVal iprot (T.T_STRUCT typemap_LatticePath)-decode_LatticePath :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> LatticePath-decode_LatticePath iprot bs = to_LatticePath $ T.deserializeVal iprot (T.T_STRUCT typemap_LatticePath) bs-typemap_LatticePath :: T.TypeMap-typemap_LatticePath = Map.fromList [(1,("weight",T.T_DOUBLE)),(2,("tokenList",(T.T_LIST (T.T_STRUCT typemap_Token))))]-default_LatticePath :: LatticePath-default_LatticePath = LatticePath{- latticePath_weight = P.Nothing,- latticePath_tokenList = Vector.empty}-data Arc = Arc { arc_src :: P.Maybe I.Int32- , arc_dst :: P.Maybe I.Int32- , arc_token :: P.Maybe Token- , arc_weight :: P.Maybe P.Double- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Arc where- hashWithSalt salt record = salt `H.hashWithSalt` arc_src record `H.hashWithSalt` arc_dst record `H.hashWithSalt` arc_token record `H.hashWithSalt` arc_weight record -instance QC.Arbitrary Arc where - arbitrary = M.liftM Arc (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Arc = []- | P.otherwise = M.catMaybes- [ if obj == default_Arc{arc_src = arc_src obj} then P.Nothing else P.Just $ default_Arc{arc_src = arc_src obj}- , if obj == default_Arc{arc_dst = arc_dst obj} then P.Nothing else P.Just $ default_Arc{arc_dst = arc_dst obj}- , if obj == default_Arc{arc_token = arc_token obj} then P.Nothing else P.Just $ default_Arc{arc_token = arc_token obj}- , if obj == default_Arc{arc_weight = arc_weight obj} then P.Nothing else P.Just $ default_Arc{arc_weight = arc_weight obj}- ]-from_Arc :: Arc -> T.ThriftVal-from_Arc record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v133 -> (1, ("src",T.TI32 _v133))) <$> arc_src record- , (\_v133 -> (2, ("dst",T.TI32 _v133))) <$> arc_dst record- , (\_v133 -> (3, ("token",from_Token _v133))) <$> arc_token record- , (\_v133 -> (4, ("weight",T.TDouble _v133))) <$> arc_weight record- ]-write_Arc :: (T.Protocol p, T.Transport t) => p t -> Arc -> P.IO ()-write_Arc oprot record = T.writeVal oprot $ from_Arc record-encode_Arc :: (T.Protocol p, T.Transport t) => p t -> Arc -> LBS.ByteString-encode_Arc oprot record = T.serializeVal oprot $ from_Arc record-to_Arc :: T.ThriftVal -> Arc-to_Arc (T.TStruct fields) = Arc{- arc_src = P.maybe (P.Nothing) (\(_,_val135) -> P.Just (case _val135 of {T.TI32 _val136 -> _val136; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- arc_dst = P.maybe (P.Nothing) (\(_,_val135) -> P.Just (case _val135 of {T.TI32 _val137 -> _val137; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- arc_token = P.maybe (P.Nothing) (\(_,_val135) -> P.Just (case _val135 of {T.TStruct _val138 -> (to_Token (T.TStruct _val138)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- arc_weight = P.maybe (P.Nothing) (\(_,_val135) -> P.Just (case _val135 of {T.TDouble _val139 -> _val139; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_Arc _ = P.error "not a struct"-read_Arc :: (T.Transport t, T.Protocol p) => p t -> P.IO Arc-read_Arc iprot = to_Arc <$> T.readVal iprot (T.T_STRUCT typemap_Arc)-decode_Arc :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Arc-decode_Arc iprot bs = to_Arc $ T.deserializeVal iprot (T.T_STRUCT typemap_Arc) bs-typemap_Arc :: T.TypeMap-typemap_Arc = Map.fromList [(1,("src",T.T_I32)),(2,("dst",T.T_I32)),(3,("token",(T.T_STRUCT typemap_Token))),(4,("weight",T.T_DOUBLE))]-default_Arc :: Arc-default_Arc = Arc{- arc_src = P.Nothing,- arc_dst = P.Nothing,- arc_token = P.Nothing,- arc_weight = P.Nothing}-data TokenLattice = TokenLattice { tokenLattice_startState :: P.Maybe I.Int32- , tokenLattice_endState :: P.Maybe I.Int32- , tokenLattice_arcList :: (Vector.Vector Arc)- , tokenLattice_cachedBestPath :: P.Maybe LatticePath- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TokenLattice where- hashWithSalt salt record = salt `H.hashWithSalt` tokenLattice_startState record `H.hashWithSalt` tokenLattice_endState record `H.hashWithSalt` tokenLattice_arcList record `H.hashWithSalt` tokenLattice_cachedBestPath record -instance QC.Arbitrary TokenLattice where - arbitrary = M.liftM TokenLattice (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TokenLattice = []- | P.otherwise = M.catMaybes- [ if obj == default_TokenLattice{tokenLattice_startState = tokenLattice_startState obj} then P.Nothing else P.Just $ default_TokenLattice{tokenLattice_startState = tokenLattice_startState obj}- , if obj == default_TokenLattice{tokenLattice_endState = tokenLattice_endState obj} then P.Nothing else P.Just $ default_TokenLattice{tokenLattice_endState = tokenLattice_endState obj}- , if obj == default_TokenLattice{tokenLattice_arcList = tokenLattice_arcList obj} then P.Nothing else P.Just $ default_TokenLattice{tokenLattice_arcList = tokenLattice_arcList obj}- , if obj == default_TokenLattice{tokenLattice_cachedBestPath = tokenLattice_cachedBestPath obj} then P.Nothing else P.Just $ default_TokenLattice{tokenLattice_cachedBestPath = tokenLattice_cachedBestPath obj}- ]-from_TokenLattice :: TokenLattice -> T.ThriftVal-from_TokenLattice record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v142 -> (1, ("startState",T.TI32 _v142))) <$> tokenLattice_startState record- , (\_v142 -> (2, ("endState",T.TI32 _v142))) <$> tokenLattice_endState record- , (\_v142 -> P.Just (3, ("arcList",T.TList (T.T_STRUCT typemap_Arc) $ P.map (\_v144 -> from_Arc _v144) $ Vector.toList _v142))) $ tokenLattice_arcList record- , (\_v142 -> (4, ("cachedBestPath",from_LatticePath _v142))) <$> tokenLattice_cachedBestPath record- ]-write_TokenLattice :: (T.Protocol p, T.Transport t) => p t -> TokenLattice -> P.IO ()-write_TokenLattice oprot record = T.writeVal oprot $ from_TokenLattice record-encode_TokenLattice :: (T.Protocol p, T.Transport t) => p t -> TokenLattice -> LBS.ByteString-encode_TokenLattice oprot record = T.serializeVal oprot $ from_TokenLattice record-to_TokenLattice :: T.ThriftVal -> TokenLattice-to_TokenLattice (T.TStruct fields) = TokenLattice{- tokenLattice_startState = P.maybe (tokenLattice_startState default_TokenLattice) (\(_,_val146) -> P.Just (case _val146 of {T.TI32 _val147 -> _val147; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- tokenLattice_endState = P.maybe (tokenLattice_endState default_TokenLattice) (\(_,_val146) -> P.Just (case _val146 of {T.TI32 _val148 -> _val148; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- tokenLattice_arcList = P.maybe (P.error "Missing required field: arcList") (\(_,_val146) -> (case _val146 of {T.TList _ _val149 -> (Vector.fromList $ P.map (\_v150 -> (case _v150 of {T.TStruct _val151 -> (to_Arc (T.TStruct _val151)); _ -> P.error "wrong type"})) _val149); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- tokenLattice_cachedBestPath = P.maybe (P.Nothing) (\(_,_val146) -> P.Just (case _val146 of {T.TStruct _val152 -> (to_LatticePath (T.TStruct _val152)); _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_TokenLattice _ = P.error "not a struct"-read_TokenLattice :: (T.Transport t, T.Protocol p) => p t -> P.IO TokenLattice-read_TokenLattice iprot = to_TokenLattice <$> T.readVal iprot (T.T_STRUCT typemap_TokenLattice)-decode_TokenLattice :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TokenLattice-decode_TokenLattice iprot bs = to_TokenLattice $ T.deserializeVal iprot (T.T_STRUCT typemap_TokenLattice) bs-typemap_TokenLattice :: T.TypeMap-typemap_TokenLattice = Map.fromList [(1,("startState",T.T_I32)),(2,("endState",T.T_I32)),(3,("arcList",(T.T_LIST (T.T_STRUCT typemap_Arc)))),(4,("cachedBestPath",(T.T_STRUCT typemap_LatticePath)))]-default_TokenLattice :: TokenLattice-default_TokenLattice = TokenLattice{- tokenLattice_startState = P.Just (0),- tokenLattice_endState = P.Just (0),- tokenLattice_arcList = Vector.empty,- tokenLattice_cachedBestPath = P.Nothing}-data TokenList = TokenList { tokenList_tokenList :: (Vector.Vector Token)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TokenList where- hashWithSalt salt record = salt `H.hashWithSalt` tokenList_tokenList record -instance QC.Arbitrary TokenList where - arbitrary = M.liftM TokenList (QC.arbitrary)- shrink obj | obj == default_TokenList = []- | P.otherwise = M.catMaybes- [ if obj == default_TokenList{tokenList_tokenList = tokenList_tokenList obj} then P.Nothing else P.Just $ default_TokenList{tokenList_tokenList = tokenList_tokenList obj}- ]-from_TokenList :: TokenList -> T.ThriftVal-from_TokenList record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v155 -> P.Just (1, ("tokenList",T.TList (T.T_STRUCT typemap_Token) $ P.map (\_v157 -> from_Token _v157) $ Vector.toList _v155))) $ tokenList_tokenList record- ]-write_TokenList :: (T.Protocol p, T.Transport t) => p t -> TokenList -> P.IO ()-write_TokenList oprot record = T.writeVal oprot $ from_TokenList record-encode_TokenList :: (T.Protocol p, T.Transport t) => p t -> TokenList -> LBS.ByteString-encode_TokenList oprot record = T.serializeVal oprot $ from_TokenList record-to_TokenList :: T.ThriftVal -> TokenList-to_TokenList (T.TStruct fields) = TokenList{- tokenList_tokenList = P.maybe (P.error "Missing required field: tokenList") (\(_,_val159) -> (case _val159 of {T.TList _ _val160 -> (Vector.fromList $ P.map (\_v161 -> (case _v161 of {T.TStruct _val162 -> (to_Token (T.TStruct _val162)); _ -> P.error "wrong type"})) _val160); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_TokenList _ = P.error "not a struct"-read_TokenList :: (T.Transport t, T.Protocol p) => p t -> P.IO TokenList-read_TokenList iprot = to_TokenList <$> T.readVal iprot (T.T_STRUCT typemap_TokenList)-decode_TokenList :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TokenList-decode_TokenList iprot bs = to_TokenList $ T.deserializeVal iprot (T.T_STRUCT typemap_TokenList) bs-typemap_TokenList :: T.TypeMap-typemap_TokenList = Map.fromList [(1,("tokenList",(T.T_LIST (T.T_STRUCT typemap_Token))))]-default_TokenList :: TokenList-default_TokenList = TokenList{- tokenList_tokenList = Vector.empty}-data SpanLink = SpanLink { spanLink_tokens :: TokenRefSequence- , spanLink_concreteTarget :: P.Maybe Uuid_Types.UUID- , spanLink_externalTarget :: P.Maybe LT.Text- , spanLink_linkType :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SpanLink where- hashWithSalt salt record = salt `H.hashWithSalt` spanLink_tokens record `H.hashWithSalt` spanLink_concreteTarget record `H.hashWithSalt` spanLink_externalTarget record `H.hashWithSalt` spanLink_linkType record -instance QC.Arbitrary SpanLink where - arbitrary = M.liftM SpanLink (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SpanLink = []- | P.otherwise = M.catMaybes- [ if obj == default_SpanLink{spanLink_tokens = spanLink_tokens obj} then P.Nothing else P.Just $ default_SpanLink{spanLink_tokens = spanLink_tokens obj}- , if obj == default_SpanLink{spanLink_concreteTarget = spanLink_concreteTarget obj} then P.Nothing else P.Just $ default_SpanLink{spanLink_concreteTarget = spanLink_concreteTarget obj}- , if obj == default_SpanLink{spanLink_externalTarget = spanLink_externalTarget obj} then P.Nothing else P.Just $ default_SpanLink{spanLink_externalTarget = spanLink_externalTarget obj}- , if obj == default_SpanLink{spanLink_linkType = spanLink_linkType obj} then P.Nothing else P.Just $ default_SpanLink{spanLink_linkType = spanLink_linkType obj}- ]-from_SpanLink :: SpanLink -> T.ThriftVal-from_SpanLink record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v165 -> P.Just (1, ("tokens",from_TokenRefSequence _v165))) $ spanLink_tokens record- , (\_v165 -> (2, ("concreteTarget",Uuid_Types.from_UUID _v165))) <$> spanLink_concreteTarget record- , (\_v165 -> (3, ("externalTarget",T.TString $ E.encodeUtf8 _v165))) <$> spanLink_externalTarget record- , (\_v165 -> P.Just (4, ("linkType",T.TString $ E.encodeUtf8 _v165))) $ spanLink_linkType record- ]-write_SpanLink :: (T.Protocol p, T.Transport t) => p t -> SpanLink -> P.IO ()-write_SpanLink oprot record = T.writeVal oprot $ from_SpanLink record-encode_SpanLink :: (T.Protocol p, T.Transport t) => p t -> SpanLink -> LBS.ByteString-encode_SpanLink oprot record = T.serializeVal oprot $ from_SpanLink record-to_SpanLink :: T.ThriftVal -> SpanLink-to_SpanLink (T.TStruct fields) = SpanLink{- spanLink_tokens = P.maybe (P.error "Missing required field: tokens") (\(_,_val167) -> (case _val167 of {T.TStruct _val168 -> (to_TokenRefSequence (T.TStruct _val168)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- spanLink_concreteTarget = P.maybe (P.Nothing) (\(_,_val167) -> P.Just (case _val167 of {T.TStruct _val169 -> (Uuid_Types.to_UUID (T.TStruct _val169)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- spanLink_externalTarget = P.maybe (P.Nothing) (\(_,_val167) -> P.Just (case _val167 of {T.TString _val170 -> E.decodeUtf8 _val170; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- spanLink_linkType = P.maybe (P.error "Missing required field: linkType") (\(_,_val167) -> (case _val167 of {T.TString _val171 -> E.decodeUtf8 _val171; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_SpanLink _ = P.error "not a struct"-read_SpanLink :: (T.Transport t, T.Protocol p) => p t -> P.IO SpanLink-read_SpanLink iprot = to_SpanLink <$> T.readVal iprot (T.T_STRUCT typemap_SpanLink)-decode_SpanLink :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SpanLink-decode_SpanLink iprot bs = to_SpanLink $ T.deserializeVal iprot (T.T_STRUCT typemap_SpanLink) bs-typemap_SpanLink :: T.TypeMap-typemap_SpanLink = Map.fromList [(1,("tokens",(T.T_STRUCT typemap_TokenRefSequence))),(2,("concreteTarget",(T.T_STRUCT Uuid_Types.typemap_UUID))),(3,("externalTarget",T.T_STRING)),(4,("linkType",T.T_STRING))]-default_SpanLink :: SpanLink-default_SpanLink = SpanLink{- spanLink_tokens = default_TokenRefSequence,- spanLink_concreteTarget = P.Nothing,- spanLink_externalTarget = P.Nothing,- spanLink_linkType = ""}-data Tokenization = Tokenization { tokenization_uuid :: Uuid_Types.UUID- , tokenization_metadata :: Metadata_Types.AnnotationMetadata- , tokenization_tokenList :: P.Maybe TokenList- , tokenization_lattice :: P.Maybe TokenLattice- , tokenization_kind :: TokenizationKind- , tokenization_tokenTaggingList :: P.Maybe (Vector.Vector TokenTagging)- , tokenization_parseList :: P.Maybe (Vector.Vector Parse)- , tokenization_dependencyParseList :: P.Maybe (Vector.Vector DependencyParse)- , tokenization_spanLinkList :: P.Maybe (Vector.Vector SpanLink)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Tokenization where- hashWithSalt salt record = salt `H.hashWithSalt` tokenization_uuid record `H.hashWithSalt` tokenization_metadata record `H.hashWithSalt` tokenization_tokenList record `H.hashWithSalt` tokenization_lattice record `H.hashWithSalt` tokenization_kind record `H.hashWithSalt` tokenization_tokenTaggingList record `H.hashWithSalt` tokenization_parseList record `H.hashWithSalt` tokenization_dependencyParseList record `H.hashWithSalt` tokenization_spanLinkList record -instance QC.Arbitrary Tokenization where - arbitrary = M.liftM Tokenization (QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Tokenization = []- | P.otherwise = M.catMaybes- [ if obj == default_Tokenization{tokenization_uuid = tokenization_uuid obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_uuid = tokenization_uuid obj}- , if obj == default_Tokenization{tokenization_metadata = tokenization_metadata obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_metadata = tokenization_metadata obj}- , if obj == default_Tokenization{tokenization_tokenList = tokenization_tokenList obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_tokenList = tokenization_tokenList obj}- , if obj == default_Tokenization{tokenization_lattice = tokenization_lattice obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_lattice = tokenization_lattice obj}- , if obj == default_Tokenization{tokenization_kind = tokenization_kind obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_kind = tokenization_kind obj}- , if obj == default_Tokenization{tokenization_tokenTaggingList = tokenization_tokenTaggingList obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_tokenTaggingList = tokenization_tokenTaggingList obj}- , if obj == default_Tokenization{tokenization_parseList = tokenization_parseList obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_parseList = tokenization_parseList obj}- , if obj == default_Tokenization{tokenization_dependencyParseList = tokenization_dependencyParseList obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_dependencyParseList = tokenization_dependencyParseList obj}- , if obj == default_Tokenization{tokenization_spanLinkList = tokenization_spanLinkList obj} then P.Nothing else P.Just $ default_Tokenization{tokenization_spanLinkList = tokenization_spanLinkList obj}- ]-from_Tokenization :: Tokenization -> T.ThriftVal-from_Tokenization record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v174 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v174))) $ tokenization_uuid record- , (\_v174 -> P.Just (2, ("metadata",Metadata_Types.from_AnnotationMetadata _v174))) $ tokenization_metadata record- , (\_v174 -> (3, ("tokenList",from_TokenList _v174))) <$> tokenization_tokenList record- , (\_v174 -> (4, ("lattice",from_TokenLattice _v174))) <$> tokenization_lattice record- , (\_v174 -> P.Just (5, ("kind",T.TI32 $ P.fromIntegral $ P.fromEnum _v174))) $ tokenization_kind record- , (\_v174 -> (6, ("tokenTaggingList",T.TList (T.T_STRUCT typemap_TokenTagging) $ P.map (\_v176 -> from_TokenTagging _v176) $ Vector.toList _v174))) <$> tokenization_tokenTaggingList record- , (\_v174 -> (7, ("parseList",T.TList (T.T_STRUCT typemap_Parse) $ P.map (\_v178 -> from_Parse _v178) $ Vector.toList _v174))) <$> tokenization_parseList record- , (\_v174 -> (8, ("dependencyParseList",T.TList (T.T_STRUCT typemap_DependencyParse) $ P.map (\_v180 -> from_DependencyParse _v180) $ Vector.toList _v174))) <$> tokenization_dependencyParseList record- , (\_v174 -> (9, ("spanLinkList",T.TList (T.T_STRUCT typemap_SpanLink) $ P.map (\_v182 -> from_SpanLink _v182) $ Vector.toList _v174))) <$> tokenization_spanLinkList record- ]-write_Tokenization :: (T.Protocol p, T.Transport t) => p t -> Tokenization -> P.IO ()-write_Tokenization oprot record = T.writeVal oprot $ from_Tokenization record-encode_Tokenization :: (T.Protocol p, T.Transport t) => p t -> Tokenization -> LBS.ByteString-encode_Tokenization oprot record = T.serializeVal oprot $ from_Tokenization record-to_Tokenization :: T.ThriftVal -> Tokenization-to_Tokenization (T.TStruct fields) = Tokenization{- tokenization_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val184) -> (case _val184 of {T.TStruct _val185 -> (Uuid_Types.to_UUID (T.TStruct _val185)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- tokenization_metadata = P.maybe (P.error "Missing required field: metadata") (\(_,_val184) -> (case _val184 of {T.TStruct _val186 -> (Metadata_Types.to_AnnotationMetadata (T.TStruct _val186)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- tokenization_tokenList = P.maybe (P.Nothing) (\(_,_val184) -> P.Just (case _val184 of {T.TStruct _val187 -> (to_TokenList (T.TStruct _val187)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- tokenization_lattice = P.maybe (P.Nothing) (\(_,_val184) -> P.Just (case _val184 of {T.TStruct _val188 -> (to_TokenLattice (T.TStruct _val188)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- tokenization_kind = P.maybe (P.error "Missing required field: kind") (\(_,_val184) -> (case _val184 of {T.TI32 _val189 -> P.toEnum $ P.fromIntegral _val189; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- tokenization_tokenTaggingList = P.maybe (P.Nothing) (\(_,_val184) -> P.Just (case _val184 of {T.TList _ _val190 -> (Vector.fromList $ P.map (\_v191 -> (case _v191 of {T.TStruct _val192 -> (to_TokenTagging (T.TStruct _val192)); _ -> P.error "wrong type"})) _val190); _ -> P.error "wrong type"})) (Map.lookup (6) fields),- tokenization_parseList = P.maybe (P.Nothing) (\(_,_val184) -> P.Just (case _val184 of {T.TList _ _val193 -> (Vector.fromList $ P.map (\_v194 -> (case _v194 of {T.TStruct _val195 -> (to_Parse (T.TStruct _val195)); _ -> P.error "wrong type"})) _val193); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- tokenization_dependencyParseList = P.maybe (P.Nothing) (\(_,_val184) -> P.Just (case _val184 of {T.TList _ _val196 -> (Vector.fromList $ P.map (\_v197 -> (case _v197 of {T.TStruct _val198 -> (to_DependencyParse (T.TStruct _val198)); _ -> P.error "wrong type"})) _val196); _ -> P.error "wrong type"})) (Map.lookup (8) fields),- tokenization_spanLinkList = P.maybe (P.Nothing) (\(_,_val184) -> P.Just (case _val184 of {T.TList _ _val199 -> (Vector.fromList $ P.map (\_v200 -> (case _v200 of {T.TStruct _val201 -> (to_SpanLink (T.TStruct _val201)); _ -> P.error "wrong type"})) _val199); _ -> P.error "wrong type"})) (Map.lookup (9) fields)- }-to_Tokenization _ = P.error "not a struct"-read_Tokenization :: (T.Transport t, T.Protocol p) => p t -> P.IO Tokenization-read_Tokenization iprot = to_Tokenization <$> T.readVal iprot (T.T_STRUCT typemap_Tokenization)-decode_Tokenization :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Tokenization-decode_Tokenization iprot bs = to_Tokenization $ T.deserializeVal iprot (T.T_STRUCT typemap_Tokenization) bs-typemap_Tokenization :: T.TypeMap-typemap_Tokenization = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("metadata",(T.T_STRUCT Metadata_Types.typemap_AnnotationMetadata))),(3,("tokenList",(T.T_STRUCT typemap_TokenList))),(4,("lattice",(T.T_STRUCT typemap_TokenLattice))),(5,("kind",T.T_I32)),(6,("tokenTaggingList",(T.T_LIST (T.T_STRUCT typemap_TokenTagging)))),(7,("parseList",(T.T_LIST (T.T_STRUCT typemap_Parse)))),(8,("dependencyParseList",(T.T_LIST (T.T_STRUCT typemap_DependencyParse)))),(9,("spanLinkList",(T.T_LIST (T.T_STRUCT typemap_SpanLink))))]-default_Tokenization :: Tokenization-default_Tokenization = Tokenization{- tokenization_uuid = Uuid_Types.default_UUID,- tokenization_metadata = Metadata_Types.default_AnnotationMetadata,- tokenization_tokenList = P.Nothing,- tokenization_lattice = P.Nothing,- tokenization_kind = (P.toEnum 0),- tokenization_tokenTaggingList = P.Nothing,- tokenization_parseList = P.Nothing,- tokenization_dependencyParseList = P.Nothing,- tokenization_spanLinkList = P.Nothing}-data Sentence = Sentence { sentence_uuid :: Uuid_Types.UUID- , sentence_tokenization :: P.Maybe Tokenization- , sentence_textSpan :: P.Maybe Spans_Types.TextSpan- , sentence_rawTextSpan :: P.Maybe Spans_Types.TextSpan- , sentence_audioSpan :: P.Maybe Spans_Types.AudioSpan- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Sentence where- hashWithSalt salt record = salt `H.hashWithSalt` sentence_uuid record `H.hashWithSalt` sentence_tokenization record `H.hashWithSalt` sentence_textSpan record `H.hashWithSalt` sentence_rawTextSpan record `H.hashWithSalt` sentence_audioSpan record -instance QC.Arbitrary Sentence where - arbitrary = M.liftM Sentence (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Sentence = []- | P.otherwise = M.catMaybes- [ if obj == default_Sentence{sentence_uuid = sentence_uuid obj} then P.Nothing else P.Just $ default_Sentence{sentence_uuid = sentence_uuid obj}- , if obj == default_Sentence{sentence_tokenization = sentence_tokenization obj} then P.Nothing else P.Just $ default_Sentence{sentence_tokenization = sentence_tokenization obj}- , if obj == default_Sentence{sentence_textSpan = sentence_textSpan obj} then P.Nothing else P.Just $ default_Sentence{sentence_textSpan = sentence_textSpan obj}- , if obj == default_Sentence{sentence_rawTextSpan = sentence_rawTextSpan obj} then P.Nothing else P.Just $ default_Sentence{sentence_rawTextSpan = sentence_rawTextSpan obj}- , if obj == default_Sentence{sentence_audioSpan = sentence_audioSpan obj} then P.Nothing else P.Just $ default_Sentence{sentence_audioSpan = sentence_audioSpan obj}- ]-from_Sentence :: Sentence -> T.ThriftVal-from_Sentence record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v204 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v204))) $ sentence_uuid record- , (\_v204 -> (2, ("tokenization",from_Tokenization _v204))) <$> sentence_tokenization record- , (\_v204 -> (3, ("textSpan",Spans_Types.from_TextSpan _v204))) <$> sentence_textSpan record- , (\_v204 -> (4, ("rawTextSpan",Spans_Types.from_TextSpan _v204))) <$> sentence_rawTextSpan record- , (\_v204 -> (5, ("audioSpan",Spans_Types.from_AudioSpan _v204))) <$> sentence_audioSpan record- ]-write_Sentence :: (T.Protocol p, T.Transport t) => p t -> Sentence -> P.IO ()-write_Sentence oprot record = T.writeVal oprot $ from_Sentence record-encode_Sentence :: (T.Protocol p, T.Transport t) => p t -> Sentence -> LBS.ByteString-encode_Sentence oprot record = T.serializeVal oprot $ from_Sentence record-to_Sentence :: T.ThriftVal -> Sentence-to_Sentence (T.TStruct fields) = Sentence{- sentence_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val206) -> (case _val206 of {T.TStruct _val207 -> (Uuid_Types.to_UUID (T.TStruct _val207)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- sentence_tokenization = P.maybe (P.Nothing) (\(_,_val206) -> P.Just (case _val206 of {T.TStruct _val208 -> (to_Tokenization (T.TStruct _val208)); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- sentence_textSpan = P.maybe (P.Nothing) (\(_,_val206) -> P.Just (case _val206 of {T.TStruct _val209 -> (Spans_Types.to_TextSpan (T.TStruct _val209)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- sentence_rawTextSpan = P.maybe (P.Nothing) (\(_,_val206) -> P.Just (case _val206 of {T.TStruct _val210 -> (Spans_Types.to_TextSpan (T.TStruct _val210)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- sentence_audioSpan = P.maybe (P.Nothing) (\(_,_val206) -> P.Just (case _val206 of {T.TStruct _val211 -> (Spans_Types.to_AudioSpan (T.TStruct _val211)); _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_Sentence _ = P.error "not a struct"-read_Sentence :: (T.Transport t, T.Protocol p) => p t -> P.IO Sentence-read_Sentence iprot = to_Sentence <$> T.readVal iprot (T.T_STRUCT typemap_Sentence)-decode_Sentence :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Sentence-decode_Sentence iprot bs = to_Sentence $ T.deserializeVal iprot (T.T_STRUCT typemap_Sentence) bs-typemap_Sentence :: T.TypeMap-typemap_Sentence = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("tokenization",(T.T_STRUCT typemap_Tokenization))),(3,("textSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(4,("rawTextSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(5,("audioSpan",(T.T_STRUCT Spans_Types.typemap_AudioSpan)))]-default_Sentence :: Sentence-default_Sentence = Sentence{- sentence_uuid = Uuid_Types.default_UUID,- sentence_tokenization = P.Nothing,- sentence_textSpan = P.Nothing,- sentence_rawTextSpan = P.Nothing,- sentence_audioSpan = P.Nothing}-data Section = Section { section_uuid :: Uuid_Types.UUID- , section_sentenceList :: P.Maybe (Vector.Vector Sentence)- , section_textSpan :: P.Maybe Spans_Types.TextSpan- , section_rawTextSpan :: P.Maybe Spans_Types.TextSpan- , section_audioSpan :: P.Maybe Spans_Types.AudioSpan- , section_kind :: LT.Text- , section_label :: P.Maybe LT.Text- , section_numberList :: P.Maybe (Vector.Vector I.Int32)- , section_lidList :: P.Maybe (Vector.Vector Language_Types.LanguageIdentification)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Section where- hashWithSalt salt record = salt `H.hashWithSalt` section_uuid record `H.hashWithSalt` section_sentenceList record `H.hashWithSalt` section_textSpan record `H.hashWithSalt` section_rawTextSpan record `H.hashWithSalt` section_audioSpan record `H.hashWithSalt` section_kind record `H.hashWithSalt` section_label record `H.hashWithSalt` section_numberList record `H.hashWithSalt` section_lidList record -instance QC.Arbitrary Section where - arbitrary = M.liftM Section (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Section = []- | P.otherwise = M.catMaybes- [ if obj == default_Section{section_uuid = section_uuid obj} then P.Nothing else P.Just $ default_Section{section_uuid = section_uuid obj}- , if obj == default_Section{section_sentenceList = section_sentenceList obj} then P.Nothing else P.Just $ default_Section{section_sentenceList = section_sentenceList obj}- , if obj == default_Section{section_textSpan = section_textSpan obj} then P.Nothing else P.Just $ default_Section{section_textSpan = section_textSpan obj}- , if obj == default_Section{section_rawTextSpan = section_rawTextSpan obj} then P.Nothing else P.Just $ default_Section{section_rawTextSpan = section_rawTextSpan obj}- , if obj == default_Section{section_audioSpan = section_audioSpan obj} then P.Nothing else P.Just $ default_Section{section_audioSpan = section_audioSpan obj}- , if obj == default_Section{section_kind = section_kind obj} then P.Nothing else P.Just $ default_Section{section_kind = section_kind obj}- , if obj == default_Section{section_label = section_label obj} then P.Nothing else P.Just $ default_Section{section_label = section_label obj}- , if obj == default_Section{section_numberList = section_numberList obj} then P.Nothing else P.Just $ default_Section{section_numberList = section_numberList obj}- , if obj == default_Section{section_lidList = section_lidList obj} then P.Nothing else P.Just $ default_Section{section_lidList = section_lidList obj}- ]-from_Section :: Section -> T.ThriftVal-from_Section record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v214 -> P.Just (1, ("uuid",Uuid_Types.from_UUID _v214))) $ section_uuid record- , (\_v214 -> (2, ("sentenceList",T.TList (T.T_STRUCT typemap_Sentence) $ P.map (\_v216 -> from_Sentence _v216) $ Vector.toList _v214))) <$> section_sentenceList record- , (\_v214 -> (3, ("textSpan",Spans_Types.from_TextSpan _v214))) <$> section_textSpan record- , (\_v214 -> (4, ("rawTextSpan",Spans_Types.from_TextSpan _v214))) <$> section_rawTextSpan record- , (\_v214 -> P.Just (5, ("kind",T.TString $ E.encodeUtf8 _v214))) $ section_kind record- , (\_v214 -> (6, ("label",T.TString $ E.encodeUtf8 _v214))) <$> section_label record- , (\_v214 -> (7, ("numberList",T.TList T.T_I32 $ P.map (\_v218 -> T.TI32 _v218) $ Vector.toList _v214))) <$> section_numberList record- , (\_v214 -> (8, ("lidList",T.TList (T.T_STRUCT Language_Types.typemap_LanguageIdentification) $ P.map (\_v220 -> Language_Types.from_LanguageIdentification _v220) $ Vector.toList _v214))) <$> section_lidList record- , (\_v214 -> (9, ("audioSpan",Spans_Types.from_AudioSpan _v214))) <$> section_audioSpan record- ]-write_Section :: (T.Protocol p, T.Transport t) => p t -> Section -> P.IO ()-write_Section oprot record = T.writeVal oprot $ from_Section record-encode_Section :: (T.Protocol p, T.Transport t) => p t -> Section -> LBS.ByteString-encode_Section oprot record = T.serializeVal oprot $ from_Section record-to_Section :: T.ThriftVal -> Section-to_Section (T.TStruct fields) = Section{- section_uuid = P.maybe (P.error "Missing required field: uuid") (\(_,_val222) -> (case _val222 of {T.TStruct _val223 -> (Uuid_Types.to_UUID (T.TStruct _val223)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- section_sentenceList = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TList _ _val224 -> (Vector.fromList $ P.map (\_v225 -> (case _v225 of {T.TStruct _val226 -> (to_Sentence (T.TStruct _val226)); _ -> P.error "wrong type"})) _val224); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- section_textSpan = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TStruct _val227 -> (Spans_Types.to_TextSpan (T.TStruct _val227)); _ -> P.error "wrong type"})) (Map.lookup (3) fields),- section_rawTextSpan = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TStruct _val228 -> (Spans_Types.to_TextSpan (T.TStruct _val228)); _ -> P.error "wrong type"})) (Map.lookup (4) fields),- section_audioSpan = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TStruct _val229 -> (Spans_Types.to_AudioSpan (T.TStruct _val229)); _ -> P.error "wrong type"})) (Map.lookup (9) fields),- section_kind = P.maybe (P.error "Missing required field: kind") (\(_,_val222) -> (case _val222 of {T.TString _val230 -> E.decodeUtf8 _val230; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- section_label = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TString _val231 -> E.decodeUtf8 _val231; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- section_numberList = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TList _ _val232 -> (Vector.fromList $ P.map (\_v233 -> (case _v233 of {T.TI32 _val234 -> _val234; _ -> P.error "wrong type"})) _val232); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- section_lidList = P.maybe (P.Nothing) (\(_,_val222) -> P.Just (case _val222 of {T.TList _ _val235 -> (Vector.fromList $ P.map (\_v236 -> (case _v236 of {T.TStruct _val237 -> (Language_Types.to_LanguageIdentification (T.TStruct _val237)); _ -> P.error "wrong type"})) _val235); _ -> P.error "wrong type"})) (Map.lookup (8) fields)- }-to_Section _ = P.error "not a struct"-read_Section :: (T.Transport t, T.Protocol p) => p t -> P.IO Section-read_Section iprot = to_Section <$> T.readVal iprot (T.T_STRUCT typemap_Section)-decode_Section :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Section-decode_Section iprot bs = to_Section $ T.deserializeVal iprot (T.T_STRUCT typemap_Section) bs-typemap_Section :: T.TypeMap-typemap_Section = Map.fromList [(1,("uuid",(T.T_STRUCT Uuid_Types.typemap_UUID))),(2,("sentenceList",(T.T_LIST (T.T_STRUCT typemap_Sentence)))),(3,("textSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(4,("rawTextSpan",(T.T_STRUCT Spans_Types.typemap_TextSpan))),(5,("kind",T.T_STRING)),(6,("label",T.T_STRING)),(7,("numberList",(T.T_LIST T.T_I32))),(8,("lidList",(T.T_LIST (T.T_STRUCT Language_Types.typemap_LanguageIdentification)))),(9,("audioSpan",(T.T_STRUCT Spans_Types.typemap_AudioSpan)))]-default_Section :: Section-default_Section = Section{- section_uuid = Uuid_Types.default_UUID,- section_sentenceList = P.Nothing,- section_textSpan = P.Nothing,- section_rawTextSpan = P.Nothing,- section_kind = "",- section_label = P.Nothing,- section_numberList = P.Nothing,- section_lidList = P.Nothing,- section_audioSpan = P.Nothing}
− src/SummarizationService.hs
@@ -1,243 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SummarizationService where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import qualified Service-import Summarization_Types-import qualified SummarizationService_Iface as Iface--- HELPER FUNCTIONS AND STRUCTURES ----data Summarize_args = Summarize_args { summarize_args_query :: SummarizationRequest- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Summarize_args where- hashWithSalt salt record = salt `H.hashWithSalt` summarize_args_query record -instance QC.Arbitrary Summarize_args where - arbitrary = M.liftM Summarize_args (QC.arbitrary)- shrink obj | obj == default_Summarize_args = []- | P.otherwise = M.catMaybes- [ if obj == default_Summarize_args{summarize_args_query = summarize_args_query obj} then P.Nothing else P.Just $ default_Summarize_args{summarize_args_query = summarize_args_query obj}- ]-from_Summarize_args :: Summarize_args -> T.ThriftVal-from_Summarize_args record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v48 -> P.Just (1, ("query",from_SummarizationRequest _v48))) $ summarize_args_query record- ]-write_Summarize_args :: (T.Protocol p, T.Transport t) => p t -> Summarize_args -> P.IO ()-write_Summarize_args oprot record = T.writeVal oprot $ from_Summarize_args record-encode_Summarize_args :: (T.Protocol p, T.Transport t) => p t -> Summarize_args -> LBS.ByteString-encode_Summarize_args oprot record = T.serializeVal oprot $ from_Summarize_args record-to_Summarize_args :: T.ThriftVal -> Summarize_args-to_Summarize_args (T.TStruct fields) = Summarize_args{- summarize_args_query = P.maybe (summarize_args_query default_Summarize_args) (\(_,_val50) -> (case _val50 of {T.TStruct _val51 -> (to_SummarizationRequest (T.TStruct _val51)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Summarize_args _ = P.error "not a struct"-read_Summarize_args :: (T.Transport t, T.Protocol p) => p t -> P.IO Summarize_args-read_Summarize_args iprot = to_Summarize_args <$> T.readVal iprot (T.T_STRUCT typemap_Summarize_args)-decode_Summarize_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Summarize_args-decode_Summarize_args iprot bs = to_Summarize_args $ T.deserializeVal iprot (T.T_STRUCT typemap_Summarize_args) bs-typemap_Summarize_args :: T.TypeMap-typemap_Summarize_args = Map.fromList [(1,("query",(T.T_STRUCT typemap_SummarizationRequest)))]-default_Summarize_args :: Summarize_args-default_Summarize_args = Summarize_args{- summarize_args_query = default_SummarizationRequest}-data Summarize_result = Summarize_result { summarize_result_success :: Summary- , summarize_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Summarize_result where- hashWithSalt salt record = salt `H.hashWithSalt` summarize_result_success record `H.hashWithSalt` summarize_result_ex record -instance QC.Arbitrary Summarize_result where - arbitrary = M.liftM Summarize_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Summarize_result = []- | P.otherwise = M.catMaybes- [ if obj == default_Summarize_result{summarize_result_success = summarize_result_success obj} then P.Nothing else P.Just $ default_Summarize_result{summarize_result_success = summarize_result_success obj}- , if obj == default_Summarize_result{summarize_result_ex = summarize_result_ex obj} then P.Nothing else P.Just $ default_Summarize_result{summarize_result_ex = summarize_result_ex obj}- ]-from_Summarize_result :: Summarize_result -> T.ThriftVal-from_Summarize_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v54 -> (1, ("ex",Services_Types.from_ServicesException _v54))) <$> summarize_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v54 -> P.Just (0, ("success",from_Summary _v54))) $ summarize_result_success record- , (\_v54 -> (1, ("ex",Services_Types.from_ServicesException _v54))) <$> summarize_result_ex record- ]- )-write_Summarize_result :: (T.Protocol p, T.Transport t) => p t -> Summarize_result -> P.IO ()-write_Summarize_result oprot record = T.writeVal oprot $ from_Summarize_result record-encode_Summarize_result :: (T.Protocol p, T.Transport t) => p t -> Summarize_result -> LBS.ByteString-encode_Summarize_result oprot record = T.serializeVal oprot $ from_Summarize_result record-to_Summarize_result :: T.ThriftVal -> Summarize_result-to_Summarize_result (T.TStruct fields) = Summarize_result{- summarize_result_success = P.maybe (summarize_result_success default_Summarize_result) (\(_,_val56) -> (case _val56 of {T.TStruct _val57 -> (to_Summary (T.TStruct _val57)); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- summarize_result_ex = P.maybe (P.Nothing) (\(_,_val56) -> P.Just (case _val56 of {T.TStruct _val58 -> (Services_Types.to_ServicesException (T.TStruct _val58)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_Summarize_result _ = P.error "not a struct"-read_Summarize_result :: (T.Transport t, T.Protocol p) => p t -> P.IO Summarize_result-read_Summarize_result iprot = to_Summarize_result <$> T.readVal iprot (T.T_STRUCT typemap_Summarize_result)-decode_Summarize_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Summarize_result-decode_Summarize_result iprot bs = to_Summarize_result $ T.deserializeVal iprot (T.T_STRUCT typemap_Summarize_result) bs-typemap_Summarize_result :: T.TypeMap-typemap_Summarize_result = Map.fromList [(0,("success",(T.T_STRUCT typemap_Summary))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_Summarize_result :: Summarize_result-default_Summarize_result = Summarize_result{- summarize_result_success = default_Summary,- summarize_result_ex = P.Nothing}-data GetCapabilities_args = GetCapabilities_args deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_args where- hashWithSalt salt record = salt -instance QC.Arbitrary GetCapabilities_args where - arbitrary = QC.elements [GetCapabilities_args]-from_GetCapabilities_args :: GetCapabilities_args -> T.ThriftVal-from_GetCapabilities_args record = T.TStruct $ Map.fromList $ M.catMaybes- []-write_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> P.IO ()-write_GetCapabilities_args oprot record = T.writeVal oprot $ from_GetCapabilities_args record-encode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_args -> LBS.ByteString-encode_GetCapabilities_args oprot record = T.serializeVal oprot $ from_GetCapabilities_args record-to_GetCapabilities_args :: T.ThriftVal -> GetCapabilities_args-to_GetCapabilities_args (T.TStruct fields) = GetCapabilities_args{-- }-to_GetCapabilities_args _ = P.error "not a struct"-read_GetCapabilities_args :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_args-read_GetCapabilities_args iprot = to_GetCapabilities_args <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_args)-decode_GetCapabilities_args :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_args-decode_GetCapabilities_args iprot bs = to_GetCapabilities_args $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_args) bs-typemap_GetCapabilities_args :: T.TypeMap-typemap_GetCapabilities_args = Map.fromList []-default_GetCapabilities_args :: GetCapabilities_args-default_GetCapabilities_args = GetCapabilities_args{-}-data GetCapabilities_result = GetCapabilities_result { getCapabilities_result_success :: (Vector.Vector SummarizationCapability)- , getCapabilities_result_ex :: P.Maybe Services_Types.ServicesException- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable GetCapabilities_result where- hashWithSalt salt record = salt `H.hashWithSalt` getCapabilities_result_success record `H.hashWithSalt` getCapabilities_result_ex record -instance QC.Arbitrary GetCapabilities_result where - arbitrary = M.liftM GetCapabilities_result (QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_GetCapabilities_result = []- | P.otherwise = M.catMaybes- [ if obj == default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_success = getCapabilities_result_success obj}- , if obj == default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj} then P.Nothing else P.Just $ default_GetCapabilities_result{getCapabilities_result_ex = getCapabilities_result_ex obj}- ]-from_GetCapabilities_result :: GetCapabilities_result -> T.ThriftVal-from_GetCapabilities_result record = T.TStruct $ Map.fromList - (let exns = M.catMaybes [ (\_v66 -> (1, ("ex",Services_Types.from_ServicesException _v66))) <$> getCapabilities_result_ex record]- in if P.not (P.null exns) then exns else M.catMaybes- [ (\_v66 -> P.Just (0, ("success",T.TList (T.T_STRUCT typemap_SummarizationCapability) $ P.map (\_v68 -> from_SummarizationCapability _v68) $ Vector.toList _v66))) $ getCapabilities_result_success record- , (\_v66 -> (1, ("ex",Services_Types.from_ServicesException _v66))) <$> getCapabilities_result_ex record- ]- )-write_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> P.IO ()-write_GetCapabilities_result oprot record = T.writeVal oprot $ from_GetCapabilities_result record-encode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> GetCapabilities_result -> LBS.ByteString-encode_GetCapabilities_result oprot record = T.serializeVal oprot $ from_GetCapabilities_result record-to_GetCapabilities_result :: T.ThriftVal -> GetCapabilities_result-to_GetCapabilities_result (T.TStruct fields) = GetCapabilities_result{- getCapabilities_result_success = P.maybe (getCapabilities_result_success default_GetCapabilities_result) (\(_,_val70) -> (case _val70 of {T.TList _ _val71 -> (Vector.fromList $ P.map (\_v72 -> (case _v72 of {T.TStruct _val73 -> (to_SummarizationCapability (T.TStruct _val73)); _ -> P.error "wrong type"})) _val71); _ -> P.error "wrong type"})) (Map.lookup (0) fields),- getCapabilities_result_ex = P.maybe (P.Nothing) (\(_,_val70) -> P.Just (case _val70 of {T.TStruct _val74 -> (Services_Types.to_ServicesException (T.TStruct _val74)); _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_GetCapabilities_result _ = P.error "not a struct"-read_GetCapabilities_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetCapabilities_result-read_GetCapabilities_result iprot = to_GetCapabilities_result <$> T.readVal iprot (T.T_STRUCT typemap_GetCapabilities_result)-decode_GetCapabilities_result :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> GetCapabilities_result-decode_GetCapabilities_result iprot bs = to_GetCapabilities_result $ T.deserializeVal iprot (T.T_STRUCT typemap_GetCapabilities_result) bs-typemap_GetCapabilities_result :: T.TypeMap-typemap_GetCapabilities_result = Map.fromList [(0,("success",(T.T_LIST (T.T_STRUCT typemap_SummarizationCapability)))),(1,("ex",(T.T_STRUCT Services_Types.typemap_ServicesException)))]-default_GetCapabilities_result :: GetCapabilities_result-default_GetCapabilities_result = GetCapabilities_result{- getCapabilities_result_success = Vector.empty,- getCapabilities_result_ex = P.Nothing}-process_summarize (seqid, iprot, oprot, handler) = do- args <- read_Summarize_args iprot- (X.catch- (X.catch- (do- val <- Iface.summarize handler (summarize_args_query args)- let res = default_Summarize_result{summarize_result_success = val}- T.writeMessageBegin oprot ("summarize", T.M_REPLY, seqid)- write_Summarize_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_Summarize_result{summarize_result_ex = P.Just e}- T.writeMessageBegin oprot ("summarize", T.M_REPLY, seqid)- write_Summarize_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("summarize", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-process_getCapabilities (seqid, iprot, oprot, handler) = do- args <- read_GetCapabilities_args iprot- (X.catch- (X.catch- (do- val <- Iface.getCapabilities handler- let res = default_GetCapabilities_result{getCapabilities_result_success = val}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot))- (\e -> do- let res = default_GetCapabilities_result{getCapabilities_result_ex = P.Just e}- T.writeMessageBegin oprot ("getCapabilities", T.M_REPLY, seqid)- write_GetCapabilities_result oprot res- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)))- ((\_ -> do- T.writeMessageBegin oprot ("getCapabilities", T.M_EXCEPTION, seqid)- T.writeAppExn oprot (T.AppExn T.AE_UNKNOWN "")- T.writeMessageEnd oprot- T.tFlush (T.getTransport oprot)) :: X.SomeException -> P.IO ()))-proc_ handler (iprot,oprot) (name,typ,seqid) = case name of- "summarize" -> process_summarize (seqid,iprot,oprot,handler)- "getCapabilities" -> process_getCapabilities (seqid,iprot,oprot,handler)- _ -> Service.proc_ handler (iprot,oprot) (name,typ,seqid)-process handler (iprot, oprot) = do- (name, typ, seqid) <- T.readMessageBegin iprot- proc_ handler (iprot,oprot) (name,typ,seqid)- T.readMessageEnd iprot- P.return P.True
− src/SummarizationService_Client.hs
@@ -1,84 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SummarizationService_Client(summarize,getCapabilities) where-import Service_Client-import qualified Data.IORef as R-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import Summarization_Types-import SummarizationService-seqid = R.newIORef 0-summarize (ip,op) arg_query = do- send_summarize op arg_query- recv_summarize ip-send_summarize op arg_query = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("summarize", T.M_CALL, seqn)- write_Summarize_args op (Summarize_args{summarize_args_query=arg_query})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_summarize ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_Summarize_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (summarize_result_ex res)- P.return $ summarize_result_success res-getCapabilities (ip,op) = do- send_getCapabilities op- recv_getCapabilities ip-send_getCapabilities op = do- seq <- seqid- seqn <- R.readIORef seq- T.writeMessageBegin op ("getCapabilities", T.M_CALL, seqn)- write_GetCapabilities_args op (GetCapabilities_args{})- T.writeMessageEnd op- T.tFlush (T.getTransport op)-recv_getCapabilities ip = do- (fname, mtype, rseqid) <- T.readMessageBegin ip- M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn }- res <- read_GetCapabilities_result ip- T.readMessageEnd ip- P.maybe (P.return ()) X.throw (getCapabilities_result_ex res)- P.return $ getCapabilities_result_success res
− src/SummarizationService_Iface.hs
@@ -1,51 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module SummarizationService_Iface where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import Summarization_Types--import Service_Iface-class Service_Iface a => SummarizationService_Iface a where- summarize :: a -> SummarizationRequest -> P.IO Summary- getCapabilities :: a -> P.IO (Vector.Vector SummarizationCapability)
− src/Summarization_Consts.hs
@@ -1,46 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Summarization_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---import Summarization_Types
− src/Summarization_Types.hs
@@ -1,248 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Summarization_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T--import qualified Communication_Types-import qualified Services_Types-import qualified Structure_Types-import qualified Uuid_Types---data SummarySourceType = DOCUMENT|TOKENIZATION|ENTITY deriving (P.Show, P.Eq, G.Generic, TY.Typeable, P.Ord, P.Bounded)-instance P.Enum SummarySourceType where- fromEnum t = case t of- DOCUMENT -> 0- TOKENIZATION -> 1- ENTITY -> 2- toEnum t = case t of- 0 -> DOCUMENT- 1 -> TOKENIZATION- 2 -> ENTITY- _ -> X.throw T.ThriftException-instance H.Hashable SummarySourceType where- hashWithSalt salt = H.hashWithSalt salt P.. P.fromEnum-instance QC.Arbitrary SummarySourceType where- arbitrary = QC.elements (P.enumFromTo P.minBound P.maxBound)-data SummarizationRequest = SummarizationRequest { summarizationRequest_queryTerms :: P.Maybe (Vector.Vector LT.Text)- , summarizationRequest_maximumTokens :: P.Maybe I.Int32- , summarizationRequest_maximumCharacters :: P.Maybe I.Int32- , summarizationRequest_sourceType :: P.Maybe SummarySourceType- , summarizationRequest_sourceIds :: P.Maybe (Vector.Vector Uuid_Types.UUID)- , summarizationRequest_sourceCommunication :: P.Maybe Communication_Types.Communication- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SummarizationRequest where- hashWithSalt salt record = salt `H.hashWithSalt` summarizationRequest_queryTerms record `H.hashWithSalt` summarizationRequest_maximumTokens record `H.hashWithSalt` summarizationRequest_maximumCharacters record `H.hashWithSalt` summarizationRequest_sourceType record `H.hashWithSalt` summarizationRequest_sourceIds record `H.hashWithSalt` summarizationRequest_sourceCommunication record -instance QC.Arbitrary SummarizationRequest where - arbitrary = M.liftM SummarizationRequest (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SummarizationRequest = []- | P.otherwise = M.catMaybes- [ if obj == default_SummarizationRequest{summarizationRequest_queryTerms = summarizationRequest_queryTerms obj} then P.Nothing else P.Just $ default_SummarizationRequest{summarizationRequest_queryTerms = summarizationRequest_queryTerms obj}- , if obj == default_SummarizationRequest{summarizationRequest_maximumTokens = summarizationRequest_maximumTokens obj} then P.Nothing else P.Just $ default_SummarizationRequest{summarizationRequest_maximumTokens = summarizationRequest_maximumTokens obj}- , if obj == default_SummarizationRequest{summarizationRequest_maximumCharacters = summarizationRequest_maximumCharacters obj} then P.Nothing else P.Just $ default_SummarizationRequest{summarizationRequest_maximumCharacters = summarizationRequest_maximumCharacters obj}- , if obj == default_SummarizationRequest{summarizationRequest_sourceType = summarizationRequest_sourceType obj} then P.Nothing else P.Just $ default_SummarizationRequest{summarizationRequest_sourceType = summarizationRequest_sourceType obj}- , if obj == default_SummarizationRequest{summarizationRequest_sourceIds = summarizationRequest_sourceIds obj} then P.Nothing else P.Just $ default_SummarizationRequest{summarizationRequest_sourceIds = summarizationRequest_sourceIds obj}- , if obj == default_SummarizationRequest{summarizationRequest_sourceCommunication = summarizationRequest_sourceCommunication obj} then P.Nothing else P.Just $ default_SummarizationRequest{summarizationRequest_sourceCommunication = summarizationRequest_sourceCommunication obj}- ]-from_SummarizationRequest :: SummarizationRequest -> T.ThriftVal-from_SummarizationRequest record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("queryTerms",T.TList T.T_STRING $ P.map (\_v4 -> T.TString $ E.encodeUtf8 _v4) $ Vector.toList _v2))) <$> summarizationRequest_queryTerms record- , (\_v2 -> (2, ("maximumTokens",T.TI32 _v2))) <$> summarizationRequest_maximumTokens record- , (\_v2 -> (3, ("maximumCharacters",T.TI32 _v2))) <$> summarizationRequest_maximumCharacters record- , (\_v2 -> (4, ("sourceType",T.TI32 $ P.fromIntegral $ P.fromEnum _v2))) <$> summarizationRequest_sourceType record- , (\_v2 -> (5, ("sourceIds",T.TList (T.T_STRUCT Uuid_Types.typemap_UUID) $ P.map (\_v6 -> Uuid_Types.from_UUID _v6) $ Vector.toList _v2))) <$> summarizationRequest_sourceIds record- , (\_v2 -> (6, ("sourceCommunication",Communication_Types.from_Communication _v2))) <$> summarizationRequest_sourceCommunication record- ]-write_SummarizationRequest :: (T.Protocol p, T.Transport t) => p t -> SummarizationRequest -> P.IO ()-write_SummarizationRequest oprot record = T.writeVal oprot $ from_SummarizationRequest record-encode_SummarizationRequest :: (T.Protocol p, T.Transport t) => p t -> SummarizationRequest -> LBS.ByteString-encode_SummarizationRequest oprot record = T.serializeVal oprot $ from_SummarizationRequest record-to_SummarizationRequest :: T.ThriftVal -> SummarizationRequest-to_SummarizationRequest (T.TStruct fields) = SummarizationRequest{- summarizationRequest_queryTerms = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TList _ _val9 -> (Vector.fromList $ P.map (\_v10 -> (case _v10 of {T.TString _val11 -> E.decodeUtf8 _val11; _ -> P.error "wrong type"})) _val9); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- summarizationRequest_maximumTokens = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TI32 _val12 -> _val12; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- summarizationRequest_maximumCharacters = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TI32 _val13 -> _val13; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- summarizationRequest_sourceType = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TI32 _val14 -> P.toEnum $ P.fromIntegral _val14; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- summarizationRequest_sourceIds = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TList _ _val15 -> (Vector.fromList $ P.map (\_v16 -> (case _v16 of {T.TStruct _val17 -> (Uuid_Types.to_UUID (T.TStruct _val17)); _ -> P.error "wrong type"})) _val15); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- summarizationRequest_sourceCommunication = P.maybe (P.Nothing) (\(_,_val8) -> P.Just (case _val8 of {T.TStruct _val18 -> (Communication_Types.to_Communication (T.TStruct _val18)); _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_SummarizationRequest _ = P.error "not a struct"-read_SummarizationRequest :: (T.Transport t, T.Protocol p) => p t -> P.IO SummarizationRequest-read_SummarizationRequest iprot = to_SummarizationRequest <$> T.readVal iprot (T.T_STRUCT typemap_SummarizationRequest)-decode_SummarizationRequest :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SummarizationRequest-decode_SummarizationRequest iprot bs = to_SummarizationRequest $ T.deserializeVal iprot (T.T_STRUCT typemap_SummarizationRequest) bs-typemap_SummarizationRequest :: T.TypeMap-typemap_SummarizationRequest = Map.fromList [(1,("queryTerms",(T.T_LIST T.T_STRING))),(2,("maximumTokens",T.T_I32)),(3,("maximumCharacters",T.T_I32)),(4,("sourceType",T.T_I32)),(5,("sourceIds",(T.T_LIST (T.T_STRUCT Uuid_Types.typemap_UUID)))),(6,("sourceCommunication",(T.T_STRUCT Communication_Types.typemap_Communication)))]-default_SummarizationRequest :: SummarizationRequest-default_SummarizationRequest = SummarizationRequest{- summarizationRequest_queryTerms = P.Nothing,- summarizationRequest_maximumTokens = P.Nothing,- summarizationRequest_maximumCharacters = P.Nothing,- summarizationRequest_sourceType = P.Nothing,- summarizationRequest_sourceIds = P.Nothing,- summarizationRequest_sourceCommunication = P.Nothing}-data Summary = Summary { summary_summaryCommunication :: P.Maybe Communication_Types.Communication- , summary_concepts :: P.Maybe (Vector.Vector SummaryConcept)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable Summary where- hashWithSalt salt record = salt `H.hashWithSalt` summary_summaryCommunication record `H.hashWithSalt` summary_concepts record -instance QC.Arbitrary Summary where - arbitrary = M.liftM Summary (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_Summary = []- | P.otherwise = M.catMaybes- [ if obj == default_Summary{summary_summaryCommunication = summary_summaryCommunication obj} then P.Nothing else P.Just $ default_Summary{summary_summaryCommunication = summary_summaryCommunication obj}- , if obj == default_Summary{summary_concepts = summary_concepts obj} then P.Nothing else P.Just $ default_Summary{summary_concepts = summary_concepts obj}- ]-from_Summary :: Summary -> T.ThriftVal-from_Summary record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v21 -> (1, ("summaryCommunication",Communication_Types.from_Communication _v21))) <$> summary_summaryCommunication record- , (\_v21 -> (2, ("concepts",T.TList (T.T_STRUCT typemap_SummaryConcept) $ P.map (\_v23 -> from_SummaryConcept _v23) $ Vector.toList _v21))) <$> summary_concepts record- ]-write_Summary :: (T.Protocol p, T.Transport t) => p t -> Summary -> P.IO ()-write_Summary oprot record = T.writeVal oprot $ from_Summary record-encode_Summary :: (T.Protocol p, T.Transport t) => p t -> Summary -> LBS.ByteString-encode_Summary oprot record = T.serializeVal oprot $ from_Summary record-to_Summary :: T.ThriftVal -> Summary-to_Summary (T.TStruct fields) = Summary{- summary_summaryCommunication = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TStruct _val26 -> (Communication_Types.to_Communication (T.TStruct _val26)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- summary_concepts = P.maybe (P.Nothing) (\(_,_val25) -> P.Just (case _val25 of {T.TList _ _val27 -> (Vector.fromList $ P.map (\_v28 -> (case _v28 of {T.TStruct _val29 -> (to_SummaryConcept (T.TStruct _val29)); _ -> P.error "wrong type"})) _val27); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_Summary _ = P.error "not a struct"-read_Summary :: (T.Transport t, T.Protocol p) => p t -> P.IO Summary-read_Summary iprot = to_Summary <$> T.readVal iprot (T.T_STRUCT typemap_Summary)-decode_Summary :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> Summary-decode_Summary iprot bs = to_Summary $ T.deserializeVal iprot (T.T_STRUCT typemap_Summary) bs-typemap_Summary :: T.TypeMap-typemap_Summary = Map.fromList [(1,("summaryCommunication",(T.T_STRUCT Communication_Types.typemap_Communication))),(2,("concepts",(T.T_LIST (T.T_STRUCT typemap_SummaryConcept))))]-default_Summary :: Summary-default_Summary = Summary{- summary_summaryCommunication = P.Nothing,- summary_concepts = P.Nothing}-data SummaryConcept = SummaryConcept { summaryConcept_tokens :: P.Maybe Structure_Types.TokenRefSequence- , summaryConcept_concept :: P.Maybe LT.Text- , summaryConcept_confidence :: P.Maybe P.Double- , summaryConcept_utility :: P.Maybe P.Double- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SummaryConcept where- hashWithSalt salt record = salt `H.hashWithSalt` summaryConcept_tokens record `H.hashWithSalt` summaryConcept_concept record `H.hashWithSalt` summaryConcept_confidence record `H.hashWithSalt` summaryConcept_utility record -instance QC.Arbitrary SummaryConcept where - arbitrary = M.liftM SummaryConcept (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_SummaryConcept = []- | P.otherwise = M.catMaybes- [ if obj == default_SummaryConcept{summaryConcept_tokens = summaryConcept_tokens obj} then P.Nothing else P.Just $ default_SummaryConcept{summaryConcept_tokens = summaryConcept_tokens obj}- , if obj == default_SummaryConcept{summaryConcept_concept = summaryConcept_concept obj} then P.Nothing else P.Just $ default_SummaryConcept{summaryConcept_concept = summaryConcept_concept obj}- , if obj == default_SummaryConcept{summaryConcept_confidence = summaryConcept_confidence obj} then P.Nothing else P.Just $ default_SummaryConcept{summaryConcept_confidence = summaryConcept_confidence obj}- , if obj == default_SummaryConcept{summaryConcept_utility = summaryConcept_utility obj} then P.Nothing else P.Just $ default_SummaryConcept{summaryConcept_utility = summaryConcept_utility obj}- ]-from_SummaryConcept :: SummaryConcept -> T.ThriftVal-from_SummaryConcept record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v32 -> (1, ("tokens",Structure_Types.from_TokenRefSequence _v32))) <$> summaryConcept_tokens record- , (\_v32 -> (2, ("concept",T.TString $ E.encodeUtf8 _v32))) <$> summaryConcept_concept record- , (\_v32 -> (3, ("confidence",T.TDouble _v32))) <$> summaryConcept_confidence record- , (\_v32 -> (4, ("utility",T.TDouble _v32))) <$> summaryConcept_utility record- ]-write_SummaryConcept :: (T.Protocol p, T.Transport t) => p t -> SummaryConcept -> P.IO ()-write_SummaryConcept oprot record = T.writeVal oprot $ from_SummaryConcept record-encode_SummaryConcept :: (T.Protocol p, T.Transport t) => p t -> SummaryConcept -> LBS.ByteString-encode_SummaryConcept oprot record = T.serializeVal oprot $ from_SummaryConcept record-to_SummaryConcept :: T.ThriftVal -> SummaryConcept-to_SummaryConcept (T.TStruct fields) = SummaryConcept{- summaryConcept_tokens = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TStruct _val35 -> (Structure_Types.to_TokenRefSequence (T.TStruct _val35)); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- summaryConcept_concept = P.maybe (P.Nothing) (\(_,_val34) -> P.Just (case _val34 of {T.TString _val36 -> E.decodeUtf8 _val36; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- summaryConcept_confidence = P.maybe (summaryConcept_confidence default_SummaryConcept) (\(_,_val34) -> P.Just (case _val34 of {T.TDouble _val37 -> _val37; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- summaryConcept_utility = P.maybe (summaryConcept_utility default_SummaryConcept) (\(_,_val34) -> P.Just (case _val34 of {T.TDouble _val38 -> _val38; _ -> P.error "wrong type"})) (Map.lookup (4) fields)- }-to_SummaryConcept _ = P.error "not a struct"-read_SummaryConcept :: (T.Transport t, T.Protocol p) => p t -> P.IO SummaryConcept-read_SummaryConcept iprot = to_SummaryConcept <$> T.readVal iprot (T.T_STRUCT typemap_SummaryConcept)-decode_SummaryConcept :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SummaryConcept-decode_SummaryConcept iprot bs = to_SummaryConcept $ T.deserializeVal iprot (T.T_STRUCT typemap_SummaryConcept) bs-typemap_SummaryConcept :: T.TypeMap-typemap_SummaryConcept = Map.fromList [(1,("tokens",(T.T_STRUCT Structure_Types.typemap_TokenRefSequence))),(2,("concept",T.T_STRING)),(3,("confidence",T.T_DOUBLE)),(4,("utility",T.T_DOUBLE))]-default_SummaryConcept :: SummaryConcept-default_SummaryConcept = SummaryConcept{- summaryConcept_tokens = P.Nothing,- summaryConcept_concept = P.Nothing,- summaryConcept_confidence = P.Just (1),- summaryConcept_utility = P.Just (1)}-data SummarizationCapability = SummarizationCapability { summarizationCapability_type :: SummarySourceType- , summarizationCapability_lang :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable SummarizationCapability where- hashWithSalt salt record = salt `H.hashWithSalt` summarizationCapability_type record `H.hashWithSalt` summarizationCapability_lang record -instance QC.Arbitrary SummarizationCapability where - arbitrary = M.liftM SummarizationCapability (QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_SummarizationCapability = []- | P.otherwise = M.catMaybes- [ if obj == default_SummarizationCapability{summarizationCapability_type = summarizationCapability_type obj} then P.Nothing else P.Just $ default_SummarizationCapability{summarizationCapability_type = summarizationCapability_type obj}- , if obj == default_SummarizationCapability{summarizationCapability_lang = summarizationCapability_lang obj} then P.Nothing else P.Just $ default_SummarizationCapability{summarizationCapability_lang = summarizationCapability_lang obj}- ]-from_SummarizationCapability :: SummarizationCapability -> T.ThriftVal-from_SummarizationCapability record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v41 -> P.Just (1, ("type",T.TI32 $ P.fromIntegral $ P.fromEnum _v41))) $ summarizationCapability_type record- , (\_v41 -> P.Just (2, ("lang",T.TString $ E.encodeUtf8 _v41))) $ summarizationCapability_lang record- ]-write_SummarizationCapability :: (T.Protocol p, T.Transport t) => p t -> SummarizationCapability -> P.IO ()-write_SummarizationCapability oprot record = T.writeVal oprot $ from_SummarizationCapability record-encode_SummarizationCapability :: (T.Protocol p, T.Transport t) => p t -> SummarizationCapability -> LBS.ByteString-encode_SummarizationCapability oprot record = T.serializeVal oprot $ from_SummarizationCapability record-to_SummarizationCapability :: T.ThriftVal -> SummarizationCapability-to_SummarizationCapability (T.TStruct fields) = SummarizationCapability{- summarizationCapability_type = P.maybe (P.error "Missing required field: type") (\(_,_val43) -> (case _val43 of {T.TI32 _val44 -> P.toEnum $ P.fromIntegral _val44; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- summarizationCapability_lang = P.maybe (P.error "Missing required field: lang") (\(_,_val43) -> (case _val43 of {T.TString _val45 -> E.decodeUtf8 _val45; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_SummarizationCapability _ = P.error "not a struct"-read_SummarizationCapability :: (T.Transport t, T.Protocol p) => p t -> P.IO SummarizationCapability-read_SummarizationCapability iprot = to_SummarizationCapability <$> T.readVal iprot (T.T_STRUCT typemap_SummarizationCapability)-decode_SummarizationCapability :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> SummarizationCapability-decode_SummarizationCapability iprot bs = to_SummarizationCapability $ T.deserializeVal iprot (T.T_STRUCT typemap_SummarizationCapability) bs-typemap_SummarizationCapability :: T.TypeMap-typemap_SummarizationCapability = Map.fromList [(1,("type",T.T_I32)),(2,("lang",T.T_STRING))]-default_SummarizationCapability :: SummarizationCapability-default_SummarizationCapability = SummarizationCapability{- summarizationCapability_type = (P.toEnum 0),- summarizationCapability_lang = ""}
− src/Twitter_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Twitter_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Twitter_Types
− src/Twitter_Types.hs
@@ -1,740 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Twitter_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data TwitterUser = TwitterUser { twitterUser_id :: P.Maybe I.Int64- , twitterUser_name :: P.Maybe LT.Text- , twitterUser_screenName :: P.Maybe LT.Text- , twitterUser_lang :: P.Maybe LT.Text- , twitterUser_geoEnabled :: P.Maybe P.Bool- , twitterUser_createdAt :: P.Maybe LT.Text- , twitterUser_friendsCount :: P.Maybe I.Int32- , twitterUser_statusesCount :: P.Maybe I.Int32- , twitterUser_verified :: P.Maybe P.Bool- , twitterUser_listedCount :: P.Maybe I.Int32- , twitterUser_favouritesCount :: P.Maybe I.Int32- , twitterUser_followersCount :: P.Maybe I.Int32- , twitterUser_location :: P.Maybe LT.Text- , twitterUser_timeZone :: P.Maybe LT.Text- , twitterUser_description :: P.Maybe LT.Text- , twitterUser_utcOffset :: P.Maybe I.Int32- , twitterUser_url :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TwitterUser where- hashWithSalt salt record = salt `H.hashWithSalt` twitterUser_id record `H.hashWithSalt` twitterUser_name record `H.hashWithSalt` twitterUser_screenName record `H.hashWithSalt` twitterUser_lang record `H.hashWithSalt` twitterUser_geoEnabled record `H.hashWithSalt` twitterUser_createdAt record `H.hashWithSalt` twitterUser_friendsCount record `H.hashWithSalt` twitterUser_statusesCount record `H.hashWithSalt` twitterUser_verified record `H.hashWithSalt` twitterUser_listedCount record `H.hashWithSalt` twitterUser_favouritesCount record `H.hashWithSalt` twitterUser_followersCount record `H.hashWithSalt` twitterUser_location record `H.hashWithSalt` twitterUser_timeZone record `H.hashWithSalt` twitterUser_description record `H.hashWithSalt` twitterUser_utcOffset record `H.hashWithSalt` twitterUser_url record -instance QC.Arbitrary TwitterUser where - arbitrary = M.liftM TwitterUser (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TwitterUser = []- | P.otherwise = M.catMaybes- [ if obj == default_TwitterUser{twitterUser_id = twitterUser_id obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_id = twitterUser_id obj}- , if obj == default_TwitterUser{twitterUser_name = twitterUser_name obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_name = twitterUser_name obj}- , if obj == default_TwitterUser{twitterUser_screenName = twitterUser_screenName obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_screenName = twitterUser_screenName obj}- , if obj == default_TwitterUser{twitterUser_lang = twitterUser_lang obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_lang = twitterUser_lang obj}- , if obj == default_TwitterUser{twitterUser_geoEnabled = twitterUser_geoEnabled obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_geoEnabled = twitterUser_geoEnabled obj}- , if obj == default_TwitterUser{twitterUser_createdAt = twitterUser_createdAt obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_createdAt = twitterUser_createdAt obj}- , if obj == default_TwitterUser{twitterUser_friendsCount = twitterUser_friendsCount obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_friendsCount = twitterUser_friendsCount obj}- , if obj == default_TwitterUser{twitterUser_statusesCount = twitterUser_statusesCount obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_statusesCount = twitterUser_statusesCount obj}- , if obj == default_TwitterUser{twitterUser_verified = twitterUser_verified obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_verified = twitterUser_verified obj}- , if obj == default_TwitterUser{twitterUser_listedCount = twitterUser_listedCount obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_listedCount = twitterUser_listedCount obj}- , if obj == default_TwitterUser{twitterUser_favouritesCount = twitterUser_favouritesCount obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_favouritesCount = twitterUser_favouritesCount obj}- , if obj == default_TwitterUser{twitterUser_followersCount = twitterUser_followersCount obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_followersCount = twitterUser_followersCount obj}- , if obj == default_TwitterUser{twitterUser_location = twitterUser_location obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_location = twitterUser_location obj}- , if obj == default_TwitterUser{twitterUser_timeZone = twitterUser_timeZone obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_timeZone = twitterUser_timeZone obj}- , if obj == default_TwitterUser{twitterUser_description = twitterUser_description obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_description = twitterUser_description obj}- , if obj == default_TwitterUser{twitterUser_utcOffset = twitterUser_utcOffset obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_utcOffset = twitterUser_utcOffset obj}- , if obj == default_TwitterUser{twitterUser_url = twitterUser_url obj} then P.Nothing else P.Just $ default_TwitterUser{twitterUser_url = twitterUser_url obj}- ]-from_TwitterUser :: TwitterUser -> T.ThriftVal-from_TwitterUser record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> (1, ("id",T.TI64 _v2))) <$> twitterUser_id record- , (\_v2 -> (3, ("name",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_name record- , (\_v2 -> (4, ("screenName",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_screenName record- , (\_v2 -> (5, ("lang",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_lang record- , (\_v2 -> (6, ("geoEnabled",T.TBool _v2))) <$> twitterUser_geoEnabled record- , (\_v2 -> (7, ("createdAt",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_createdAt record- , (\_v2 -> (8, ("friendsCount",T.TI32 _v2))) <$> twitterUser_friendsCount record- , (\_v2 -> (9, ("statusesCount",T.TI32 _v2))) <$> twitterUser_statusesCount record- , (\_v2 -> (10, ("verified",T.TBool _v2))) <$> twitterUser_verified record- , (\_v2 -> (11, ("listedCount",T.TI32 _v2))) <$> twitterUser_listedCount record- , (\_v2 -> (12, ("favouritesCount",T.TI32 _v2))) <$> twitterUser_favouritesCount record- , (\_v2 -> (13, ("followersCount",T.TI32 _v2))) <$> twitterUser_followersCount record- , (\_v2 -> (14, ("location",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_location record- , (\_v2 -> (15, ("timeZone",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_timeZone record- , (\_v2 -> (16, ("description",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_description record- , (\_v2 -> (18, ("utcOffset",T.TI32 _v2))) <$> twitterUser_utcOffset record- , (\_v2 -> (19, ("url",T.TString $ E.encodeUtf8 _v2))) <$> twitterUser_url record- ]-write_TwitterUser :: (T.Protocol p, T.Transport t) => p t -> TwitterUser -> P.IO ()-write_TwitterUser oprot record = T.writeVal oprot $ from_TwitterUser record-encode_TwitterUser :: (T.Protocol p, T.Transport t) => p t -> TwitterUser -> LBS.ByteString-encode_TwitterUser oprot record = T.serializeVal oprot $ from_TwitterUser record-to_TwitterUser :: T.ThriftVal -> TwitterUser-to_TwitterUser (T.TStruct fields) = TwitterUser{- twitterUser_id = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI64 _val5 -> _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- twitterUser_name = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val6 -> E.decodeUtf8 _val6; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- twitterUser_screenName = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val7 -> E.decodeUtf8 _val7; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- twitterUser_lang = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val8 -> E.decodeUtf8 _val8; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- twitterUser_geoEnabled = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBool _val9 -> _val9; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- twitterUser_createdAt = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val10 -> E.decodeUtf8 _val10; _ -> P.error "wrong type"})) (Map.lookup (7) fields),- twitterUser_friendsCount = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI32 _val11 -> _val11; _ -> P.error "wrong type"})) (Map.lookup (8) fields),- twitterUser_statusesCount = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI32 _val12 -> _val12; _ -> P.error "wrong type"})) (Map.lookup (9) fields),- twitterUser_verified = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TBool _val13 -> _val13; _ -> P.error "wrong type"})) (Map.lookup (10) fields),- twitterUser_listedCount = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI32 _val14 -> _val14; _ -> P.error "wrong type"})) (Map.lookup (11) fields),- twitterUser_favouritesCount = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI32 _val15 -> _val15; _ -> P.error "wrong type"})) (Map.lookup (12) fields),- twitterUser_followersCount = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI32 _val16 -> _val16; _ -> P.error "wrong type"})) (Map.lookup (13) fields),- twitterUser_location = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val17 -> E.decodeUtf8 _val17; _ -> P.error "wrong type"})) (Map.lookup (14) fields),- twitterUser_timeZone = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val18 -> E.decodeUtf8 _val18; _ -> P.error "wrong type"})) (Map.lookup (15) fields),- twitterUser_description = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val19 -> E.decodeUtf8 _val19; _ -> P.error "wrong type"})) (Map.lookup (16) fields),- twitterUser_utcOffset = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TI32 _val20 -> _val20; _ -> P.error "wrong type"})) (Map.lookup (18) fields),- twitterUser_url = P.maybe (P.Nothing) (\(_,_val4) -> P.Just (case _val4 of {T.TString _val21 -> E.decodeUtf8 _val21; _ -> P.error "wrong type"})) (Map.lookup (19) fields)- }-to_TwitterUser _ = P.error "not a struct"-read_TwitterUser :: (T.Transport t, T.Protocol p) => p t -> P.IO TwitterUser-read_TwitterUser iprot = to_TwitterUser <$> T.readVal iprot (T.T_STRUCT typemap_TwitterUser)-decode_TwitterUser :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TwitterUser-decode_TwitterUser iprot bs = to_TwitterUser $ T.deserializeVal iprot (T.T_STRUCT typemap_TwitterUser) bs-typemap_TwitterUser :: T.TypeMap-typemap_TwitterUser = Map.fromList [(1,("id",T.T_I64)),(3,("name",T.T_STRING)),(4,("screenName",T.T_STRING)),(5,("lang",T.T_STRING)),(6,("geoEnabled",T.T_BOOL)),(7,("createdAt",T.T_STRING)),(8,("friendsCount",T.T_I32)),(9,("statusesCount",T.T_I32)),(10,("verified",T.T_BOOL)),(11,("listedCount",T.T_I32)),(12,("favouritesCount",T.T_I32)),(13,("followersCount",T.T_I32)),(14,("location",T.T_STRING)),(15,("timeZone",T.T_STRING)),(16,("description",T.T_STRING)),(18,("utcOffset",T.T_I32)),(19,("url",T.T_STRING))]-default_TwitterUser :: TwitterUser-default_TwitterUser = TwitterUser{- twitterUser_id = P.Nothing,- twitterUser_name = P.Nothing,- twitterUser_screenName = P.Nothing,- twitterUser_lang = P.Nothing,- twitterUser_geoEnabled = P.Nothing,- twitterUser_createdAt = P.Nothing,- twitterUser_friendsCount = P.Nothing,- twitterUser_statusesCount = P.Nothing,- twitterUser_verified = P.Nothing,- twitterUser_listedCount = P.Nothing,- twitterUser_favouritesCount = P.Nothing,- twitterUser_followersCount = P.Nothing,- twitterUser_location = P.Nothing,- twitterUser_timeZone = P.Nothing,- twitterUser_description = P.Nothing,- twitterUser_utcOffset = P.Nothing,- twitterUser_url = P.Nothing}-data TwitterLatLong = TwitterLatLong { twitterLatLong_latitude :: P.Maybe P.Double- , twitterLatLong_longitude :: P.Maybe P.Double- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TwitterLatLong where- hashWithSalt salt record = salt `H.hashWithSalt` twitterLatLong_latitude record `H.hashWithSalt` twitterLatLong_longitude record -instance QC.Arbitrary TwitterLatLong where - arbitrary = M.liftM TwitterLatLong (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TwitterLatLong = []- | P.otherwise = M.catMaybes- [ if obj == default_TwitterLatLong{twitterLatLong_latitude = twitterLatLong_latitude obj} then P.Nothing else P.Just $ default_TwitterLatLong{twitterLatLong_latitude = twitterLatLong_latitude obj}- , if obj == default_TwitterLatLong{twitterLatLong_longitude = twitterLatLong_longitude obj} then P.Nothing else P.Just $ default_TwitterLatLong{twitterLatLong_longitude = twitterLatLong_longitude obj}- ]-from_TwitterLatLong :: TwitterLatLong -> T.ThriftVal-from_TwitterLatLong record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v24 -> (1, ("latitude",T.TDouble _v24))) <$> twitterLatLong_latitude record- , (\_v24 -> (2, ("longitude",T.TDouble _v24))) <$> twitterLatLong_longitude record- ]-write_TwitterLatLong :: (T.Protocol p, T.Transport t) => p t -> TwitterLatLong -> P.IO ()-write_TwitterLatLong oprot record = T.writeVal oprot $ from_TwitterLatLong record-encode_TwitterLatLong :: (T.Protocol p, T.Transport t) => p t -> TwitterLatLong -> LBS.ByteString-encode_TwitterLatLong oprot record = T.serializeVal oprot $ from_TwitterLatLong record-to_TwitterLatLong :: T.ThriftVal -> TwitterLatLong-to_TwitterLatLong (T.TStruct fields) = TwitterLatLong{- twitterLatLong_latitude = P.maybe (P.Nothing) (\(_,_val26) -> P.Just (case _val26 of {T.TDouble _val27 -> _val27; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- twitterLatLong_longitude = P.maybe (P.Nothing) (\(_,_val26) -> P.Just (case _val26 of {T.TDouble _val28 -> _val28; _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_TwitterLatLong _ = P.error "not a struct"-read_TwitterLatLong :: (T.Transport t, T.Protocol p) => p t -> P.IO TwitterLatLong-read_TwitterLatLong iprot = to_TwitterLatLong <$> T.readVal iprot (T.T_STRUCT typemap_TwitterLatLong)-decode_TwitterLatLong :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TwitterLatLong-decode_TwitterLatLong iprot bs = to_TwitterLatLong $ T.deserializeVal iprot (T.T_STRUCT typemap_TwitterLatLong) bs-typemap_TwitterLatLong :: T.TypeMap-typemap_TwitterLatLong = Map.fromList [(1,("latitude",T.T_DOUBLE)),(2,("longitude",T.T_DOUBLE))]-default_TwitterLatLong :: TwitterLatLong-default_TwitterLatLong = TwitterLatLong{- twitterLatLong_latitude = P.Nothing,- twitterLatLong_longitude = P.Nothing}-data BoundingBox = BoundingBox { boundingBox_type :: P.Maybe LT.Text- , boundingBox_coordinateList :: (Vector.Vector TwitterLatLong)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable BoundingBox where- hashWithSalt salt record = salt `H.hashWithSalt` boundingBox_type record `H.hashWithSalt` boundingBox_coordinateList record -instance QC.Arbitrary BoundingBox where - arbitrary = M.liftM BoundingBox (M.liftM P.Just QC.arbitrary)- `M.ap`(QC.arbitrary)- shrink obj | obj == default_BoundingBox = []- | P.otherwise = M.catMaybes- [ if obj == default_BoundingBox{boundingBox_type = boundingBox_type obj} then P.Nothing else P.Just $ default_BoundingBox{boundingBox_type = boundingBox_type obj}- , if obj == default_BoundingBox{boundingBox_coordinateList = boundingBox_coordinateList obj} then P.Nothing else P.Just $ default_BoundingBox{boundingBox_coordinateList = boundingBox_coordinateList obj}- ]-from_BoundingBox :: BoundingBox -> T.ThriftVal-from_BoundingBox record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v31 -> (1, ("type",T.TString $ E.encodeUtf8 _v31))) <$> boundingBox_type record- , (\_v31 -> P.Just (2, ("coordinateList",T.TList (T.T_STRUCT typemap_TwitterLatLong) $ P.map (\_v33 -> from_TwitterLatLong _v33) $ Vector.toList _v31))) $ boundingBox_coordinateList record- ]-write_BoundingBox :: (T.Protocol p, T.Transport t) => p t -> BoundingBox -> P.IO ()-write_BoundingBox oprot record = T.writeVal oprot $ from_BoundingBox record-encode_BoundingBox :: (T.Protocol p, T.Transport t) => p t -> BoundingBox -> LBS.ByteString-encode_BoundingBox oprot record = T.serializeVal oprot $ from_BoundingBox record-to_BoundingBox :: T.ThriftVal -> BoundingBox-to_BoundingBox (T.TStruct fields) = BoundingBox{- boundingBox_type = P.maybe (P.Nothing) (\(_,_val35) -> P.Just (case _val35 of {T.TString _val36 -> E.decodeUtf8 _val36; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- boundingBox_coordinateList = P.maybe (P.error "Missing required field: coordinateList") (\(_,_val35) -> (case _val35 of {T.TList _ _val37 -> (Vector.fromList $ P.map (\_v38 -> (case _v38 of {T.TStruct _val39 -> (to_TwitterLatLong (T.TStruct _val39)); _ -> P.error "wrong type"})) _val37); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_BoundingBox _ = P.error "not a struct"-read_BoundingBox :: (T.Transport t, T.Protocol p) => p t -> P.IO BoundingBox-read_BoundingBox iprot = to_BoundingBox <$> T.readVal iprot (T.T_STRUCT typemap_BoundingBox)-decode_BoundingBox :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> BoundingBox-decode_BoundingBox iprot bs = to_BoundingBox $ T.deserializeVal iprot (T.T_STRUCT typemap_BoundingBox) bs-typemap_BoundingBox :: T.TypeMap-typemap_BoundingBox = Map.fromList [(1,("type",T.T_STRING)),(2,("coordinateList",(T.T_LIST (T.T_STRUCT typemap_TwitterLatLong))))]-default_BoundingBox :: BoundingBox-default_BoundingBox = BoundingBox{- boundingBox_type = P.Nothing,- boundingBox_coordinateList = Vector.empty}-data PlaceAttributes = PlaceAttributes { placeAttributes_streetAddress :: P.Maybe LT.Text- , placeAttributes_region :: P.Maybe LT.Text- , placeAttributes_locality :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable PlaceAttributes where- hashWithSalt salt record = salt `H.hashWithSalt` placeAttributes_streetAddress record `H.hashWithSalt` placeAttributes_region record `H.hashWithSalt` placeAttributes_locality record -instance QC.Arbitrary PlaceAttributes where - arbitrary = M.liftM PlaceAttributes (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_PlaceAttributes = []- | P.otherwise = M.catMaybes- [ if obj == default_PlaceAttributes{placeAttributes_streetAddress = placeAttributes_streetAddress obj} then P.Nothing else P.Just $ default_PlaceAttributes{placeAttributes_streetAddress = placeAttributes_streetAddress obj}- , if obj == default_PlaceAttributes{placeAttributes_region = placeAttributes_region obj} then P.Nothing else P.Just $ default_PlaceAttributes{placeAttributes_region = placeAttributes_region obj}- , if obj == default_PlaceAttributes{placeAttributes_locality = placeAttributes_locality obj} then P.Nothing else P.Just $ default_PlaceAttributes{placeAttributes_locality = placeAttributes_locality obj}- ]-from_PlaceAttributes :: PlaceAttributes -> T.ThriftVal-from_PlaceAttributes record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v42 -> (1, ("streetAddress",T.TString $ E.encodeUtf8 _v42))) <$> placeAttributes_streetAddress record- , (\_v42 -> (2, ("region",T.TString $ E.encodeUtf8 _v42))) <$> placeAttributes_region record- , (\_v42 -> (3, ("locality",T.TString $ E.encodeUtf8 _v42))) <$> placeAttributes_locality record- ]-write_PlaceAttributes :: (T.Protocol p, T.Transport t) => p t -> PlaceAttributes -> P.IO ()-write_PlaceAttributes oprot record = T.writeVal oprot $ from_PlaceAttributes record-encode_PlaceAttributes :: (T.Protocol p, T.Transport t) => p t -> PlaceAttributes -> LBS.ByteString-encode_PlaceAttributes oprot record = T.serializeVal oprot $ from_PlaceAttributes record-to_PlaceAttributes :: T.ThriftVal -> PlaceAttributes-to_PlaceAttributes (T.TStruct fields) = PlaceAttributes{- placeAttributes_streetAddress = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TString _val45 -> E.decodeUtf8 _val45; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- placeAttributes_region = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TString _val46 -> E.decodeUtf8 _val46; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- placeAttributes_locality = P.maybe (P.Nothing) (\(_,_val44) -> P.Just (case _val44 of {T.TString _val47 -> E.decodeUtf8 _val47; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_PlaceAttributes _ = P.error "not a struct"-read_PlaceAttributes :: (T.Transport t, T.Protocol p) => p t -> P.IO PlaceAttributes-read_PlaceAttributes iprot = to_PlaceAttributes <$> T.readVal iprot (T.T_STRUCT typemap_PlaceAttributes)-decode_PlaceAttributes :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> PlaceAttributes-decode_PlaceAttributes iprot bs = to_PlaceAttributes $ T.deserializeVal iprot (T.T_STRUCT typemap_PlaceAttributes) bs-typemap_PlaceAttributes :: T.TypeMap-typemap_PlaceAttributes = Map.fromList [(1,("streetAddress",T.T_STRING)),(2,("region",T.T_STRING)),(3,("locality",T.T_STRING))]-default_PlaceAttributes :: PlaceAttributes-default_PlaceAttributes = PlaceAttributes{- placeAttributes_streetAddress = P.Nothing,- placeAttributes_region = P.Nothing,- placeAttributes_locality = P.Nothing}-data UserMention = UserMention { userMention_startOffset :: P.Maybe I.Int32- , userMention_endOffset :: P.Maybe I.Int32- , userMention_screenName :: P.Maybe LT.Text- , userMention_name :: P.Maybe LT.Text- , userMention_id :: P.Maybe I.Int64- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable UserMention where- hashWithSalt salt record = salt `H.hashWithSalt` userMention_startOffset record `H.hashWithSalt` userMention_endOffset record `H.hashWithSalt` userMention_screenName record `H.hashWithSalt` userMention_name record `H.hashWithSalt` userMention_id record -instance QC.Arbitrary UserMention where - arbitrary = M.liftM UserMention (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_UserMention = []- | P.otherwise = M.catMaybes- [ if obj == default_UserMention{userMention_startOffset = userMention_startOffset obj} then P.Nothing else P.Just $ default_UserMention{userMention_startOffset = userMention_startOffset obj}- , if obj == default_UserMention{userMention_endOffset = userMention_endOffset obj} then P.Nothing else P.Just $ default_UserMention{userMention_endOffset = userMention_endOffset obj}- , if obj == default_UserMention{userMention_screenName = userMention_screenName obj} then P.Nothing else P.Just $ default_UserMention{userMention_screenName = userMention_screenName obj}- , if obj == default_UserMention{userMention_name = userMention_name obj} then P.Nothing else P.Just $ default_UserMention{userMention_name = userMention_name obj}- , if obj == default_UserMention{userMention_id = userMention_id obj} then P.Nothing else P.Just $ default_UserMention{userMention_id = userMention_id obj}- ]-from_UserMention :: UserMention -> T.ThriftVal-from_UserMention record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v50 -> (1, ("startOffset",T.TI32 _v50))) <$> userMention_startOffset record- , (\_v50 -> (2, ("endOffset",T.TI32 _v50))) <$> userMention_endOffset record- , (\_v50 -> (4, ("screenName",T.TString $ E.encodeUtf8 _v50))) <$> userMention_screenName record- , (\_v50 -> (5, ("name",T.TString $ E.encodeUtf8 _v50))) <$> userMention_name record- , (\_v50 -> (6, ("id",T.TI64 _v50))) <$> userMention_id record- ]-write_UserMention :: (T.Protocol p, T.Transport t) => p t -> UserMention -> P.IO ()-write_UserMention oprot record = T.writeVal oprot $ from_UserMention record-encode_UserMention :: (T.Protocol p, T.Transport t) => p t -> UserMention -> LBS.ByteString-encode_UserMention oprot record = T.serializeVal oprot $ from_UserMention record-to_UserMention :: T.ThriftVal -> UserMention-to_UserMention (T.TStruct fields) = UserMention{- userMention_startOffset = P.maybe (P.Nothing) (\(_,_val52) -> P.Just (case _val52 of {T.TI32 _val53 -> _val53; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- userMention_endOffset = P.maybe (P.Nothing) (\(_,_val52) -> P.Just (case _val52 of {T.TI32 _val54 -> _val54; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- userMention_screenName = P.maybe (P.Nothing) (\(_,_val52) -> P.Just (case _val52 of {T.TString _val55 -> E.decodeUtf8 _val55; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- userMention_name = P.maybe (P.Nothing) (\(_,_val52) -> P.Just (case _val52 of {T.TString _val56 -> E.decodeUtf8 _val56; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- userMention_id = P.maybe (P.Nothing) (\(_,_val52) -> P.Just (case _val52 of {T.TI64 _val57 -> _val57; _ -> P.error "wrong type"})) (Map.lookup (6) fields)- }-to_UserMention _ = P.error "not a struct"-read_UserMention :: (T.Transport t, T.Protocol p) => p t -> P.IO UserMention-read_UserMention iprot = to_UserMention <$> T.readVal iprot (T.T_STRUCT typemap_UserMention)-decode_UserMention :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> UserMention-decode_UserMention iprot bs = to_UserMention $ T.deserializeVal iprot (T.T_STRUCT typemap_UserMention) bs-typemap_UserMention :: T.TypeMap-typemap_UserMention = Map.fromList [(1,("startOffset",T.T_I32)),(2,("endOffset",T.T_I32)),(4,("screenName",T.T_STRING)),(5,("name",T.T_STRING)),(6,("id",T.T_I64))]-default_UserMention :: UserMention-default_UserMention = UserMention{- userMention_startOffset = P.Nothing,- userMention_endOffset = P.Nothing,- userMention_screenName = P.Nothing,- userMention_name = P.Nothing,- userMention_id = P.Nothing}-data URL = URL { uRL_startOffset :: P.Maybe I.Int32- , uRL_endOffset :: P.Maybe I.Int32- , uRL_expandedUrl :: P.Maybe LT.Text- , uRL_url :: P.Maybe LT.Text- , uRL_displayUrl :: P.Maybe LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable URL where- hashWithSalt salt record = salt `H.hashWithSalt` uRL_startOffset record `H.hashWithSalt` uRL_endOffset record `H.hashWithSalt` uRL_expandedUrl record `H.hashWithSalt` uRL_url record `H.hashWithSalt` uRL_displayUrl record -instance QC.Arbitrary URL where - arbitrary = M.liftM URL (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_URL = []- | P.otherwise = M.catMaybes- [ if obj == default_URL{uRL_startOffset = uRL_startOffset obj} then P.Nothing else P.Just $ default_URL{uRL_startOffset = uRL_startOffset obj}- , if obj == default_URL{uRL_endOffset = uRL_endOffset obj} then P.Nothing else P.Just $ default_URL{uRL_endOffset = uRL_endOffset obj}- , if obj == default_URL{uRL_expandedUrl = uRL_expandedUrl obj} then P.Nothing else P.Just $ default_URL{uRL_expandedUrl = uRL_expandedUrl obj}- , if obj == default_URL{uRL_url = uRL_url obj} then P.Nothing else P.Just $ default_URL{uRL_url = uRL_url obj}- , if obj == default_URL{uRL_displayUrl = uRL_displayUrl obj} then P.Nothing else P.Just $ default_URL{uRL_displayUrl = uRL_displayUrl obj}- ]-from_URL :: URL -> T.ThriftVal-from_URL record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v60 -> (1, ("startOffset",T.TI32 _v60))) <$> uRL_startOffset record- , (\_v60 -> (2, ("endOffset",T.TI32 _v60))) <$> uRL_endOffset record- , (\_v60 -> (3, ("expandedUrl",T.TString $ E.encodeUtf8 _v60))) <$> uRL_expandedUrl record- , (\_v60 -> (4, ("url",T.TString $ E.encodeUtf8 _v60))) <$> uRL_url record- , (\_v60 -> (5, ("displayUrl",T.TString $ E.encodeUtf8 _v60))) <$> uRL_displayUrl record- ]-write_URL :: (T.Protocol p, T.Transport t) => p t -> URL -> P.IO ()-write_URL oprot record = T.writeVal oprot $ from_URL record-encode_URL :: (T.Protocol p, T.Transport t) => p t -> URL -> LBS.ByteString-encode_URL oprot record = T.serializeVal oprot $ from_URL record-to_URL :: T.ThriftVal -> URL-to_URL (T.TStruct fields) = URL{- uRL_startOffset = P.maybe (P.Nothing) (\(_,_val62) -> P.Just (case _val62 of {T.TI32 _val63 -> _val63; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- uRL_endOffset = P.maybe (P.Nothing) (\(_,_val62) -> P.Just (case _val62 of {T.TI32 _val64 -> _val64; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- uRL_expandedUrl = P.maybe (P.Nothing) (\(_,_val62) -> P.Just (case _val62 of {T.TString _val65 -> E.decodeUtf8 _val65; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- uRL_url = P.maybe (P.Nothing) (\(_,_val62) -> P.Just (case _val62 of {T.TString _val66 -> E.decodeUtf8 _val66; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- uRL_displayUrl = P.maybe (P.Nothing) (\(_,_val62) -> P.Just (case _val62 of {T.TString _val67 -> E.decodeUtf8 _val67; _ -> P.error "wrong type"})) (Map.lookup (5) fields)- }-to_URL _ = P.error "not a struct"-read_URL :: (T.Transport t, T.Protocol p) => p t -> P.IO URL-read_URL iprot = to_URL <$> T.readVal iprot (T.T_STRUCT typemap_URL)-decode_URL :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> URL-decode_URL iprot bs = to_URL $ T.deserializeVal iprot (T.T_STRUCT typemap_URL) bs-typemap_URL :: T.TypeMap-typemap_URL = Map.fromList [(1,("startOffset",T.T_I32)),(2,("endOffset",T.T_I32)),(3,("expandedUrl",T.T_STRING)),(4,("url",T.T_STRING)),(5,("displayUrl",T.T_STRING))]-default_URL :: URL-default_URL = URL{- uRL_startOffset = P.Nothing,- uRL_endOffset = P.Nothing,- uRL_expandedUrl = P.Nothing,- uRL_url = P.Nothing,- uRL_displayUrl = P.Nothing}-data HashTag = HashTag { hashTag_text :: P.Maybe LT.Text- , hashTag_startOffset :: P.Maybe I.Int32- , hashTag_endOffset :: P.Maybe I.Int32- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable HashTag where- hashWithSalt salt record = salt `H.hashWithSalt` hashTag_text record `H.hashWithSalt` hashTag_startOffset record `H.hashWithSalt` hashTag_endOffset record -instance QC.Arbitrary HashTag where - arbitrary = M.liftM HashTag (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_HashTag = []- | P.otherwise = M.catMaybes- [ if obj == default_HashTag{hashTag_text = hashTag_text obj} then P.Nothing else P.Just $ default_HashTag{hashTag_text = hashTag_text obj}- , if obj == default_HashTag{hashTag_startOffset = hashTag_startOffset obj} then P.Nothing else P.Just $ default_HashTag{hashTag_startOffset = hashTag_startOffset obj}- , if obj == default_HashTag{hashTag_endOffset = hashTag_endOffset obj} then P.Nothing else P.Just $ default_HashTag{hashTag_endOffset = hashTag_endOffset obj}- ]-from_HashTag :: HashTag -> T.ThriftVal-from_HashTag record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v70 -> (1, ("text",T.TString $ E.encodeUtf8 _v70))) <$> hashTag_text record- , (\_v70 -> (2, ("startOffset",T.TI32 _v70))) <$> hashTag_startOffset record- , (\_v70 -> (3, ("endOffset",T.TI32 _v70))) <$> hashTag_endOffset record- ]-write_HashTag :: (T.Protocol p, T.Transport t) => p t -> HashTag -> P.IO ()-write_HashTag oprot record = T.writeVal oprot $ from_HashTag record-encode_HashTag :: (T.Protocol p, T.Transport t) => p t -> HashTag -> LBS.ByteString-encode_HashTag oprot record = T.serializeVal oprot $ from_HashTag record-to_HashTag :: T.ThriftVal -> HashTag-to_HashTag (T.TStruct fields) = HashTag{- hashTag_text = P.maybe (P.Nothing) (\(_,_val72) -> P.Just (case _val72 of {T.TString _val73 -> E.decodeUtf8 _val73; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- hashTag_startOffset = P.maybe (P.Nothing) (\(_,_val72) -> P.Just (case _val72 of {T.TI32 _val74 -> _val74; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- hashTag_endOffset = P.maybe (P.Nothing) (\(_,_val72) -> P.Just (case _val72 of {T.TI32 _val75 -> _val75; _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_HashTag _ = P.error "not a struct"-read_HashTag :: (T.Transport t, T.Protocol p) => p t -> P.IO HashTag-read_HashTag iprot = to_HashTag <$> T.readVal iprot (T.T_STRUCT typemap_HashTag)-decode_HashTag :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> HashTag-decode_HashTag iprot bs = to_HashTag $ T.deserializeVal iprot (T.T_STRUCT typemap_HashTag) bs-typemap_HashTag :: T.TypeMap-typemap_HashTag = Map.fromList [(1,("text",T.T_STRING)),(2,("startOffset",T.T_I32)),(3,("endOffset",T.T_I32))]-default_HashTag :: HashTag-default_HashTag = HashTag{- hashTag_text = P.Nothing,- hashTag_startOffset = P.Nothing,- hashTag_endOffset = P.Nothing}-data TwitterEntities = TwitterEntities { twitterEntities_hashtagList :: P.Maybe (Vector.Vector HashTag)- , twitterEntities_urlList :: P.Maybe (Vector.Vector URL)- , twitterEntities_userMentionList :: P.Maybe (Vector.Vector UserMention)- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TwitterEntities where- hashWithSalt salt record = salt `H.hashWithSalt` twitterEntities_hashtagList record `H.hashWithSalt` twitterEntities_urlList record `H.hashWithSalt` twitterEntities_userMentionList record -instance QC.Arbitrary TwitterEntities where - arbitrary = M.liftM TwitterEntities (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TwitterEntities = []- | P.otherwise = M.catMaybes- [ if obj == default_TwitterEntities{twitterEntities_hashtagList = twitterEntities_hashtagList obj} then P.Nothing else P.Just $ default_TwitterEntities{twitterEntities_hashtagList = twitterEntities_hashtagList obj}- , if obj == default_TwitterEntities{twitterEntities_urlList = twitterEntities_urlList obj} then P.Nothing else P.Just $ default_TwitterEntities{twitterEntities_urlList = twitterEntities_urlList obj}- , if obj == default_TwitterEntities{twitterEntities_userMentionList = twitterEntities_userMentionList obj} then P.Nothing else P.Just $ default_TwitterEntities{twitterEntities_userMentionList = twitterEntities_userMentionList obj}- ]-from_TwitterEntities :: TwitterEntities -> T.ThriftVal-from_TwitterEntities record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v78 -> (1, ("hashtagList",T.TList (T.T_STRUCT typemap_HashTag) $ P.map (\_v80 -> from_HashTag _v80) $ Vector.toList _v78))) <$> twitterEntities_hashtagList record- , (\_v78 -> (2, ("urlList",T.TList (T.T_STRUCT typemap_URL) $ P.map (\_v82 -> from_URL _v82) $ Vector.toList _v78))) <$> twitterEntities_urlList record- , (\_v78 -> (3, ("userMentionList",T.TList (T.T_STRUCT typemap_UserMention) $ P.map (\_v84 -> from_UserMention _v84) $ Vector.toList _v78))) <$> twitterEntities_userMentionList record- ]-write_TwitterEntities :: (T.Protocol p, T.Transport t) => p t -> TwitterEntities -> P.IO ()-write_TwitterEntities oprot record = T.writeVal oprot $ from_TwitterEntities record-encode_TwitterEntities :: (T.Protocol p, T.Transport t) => p t -> TwitterEntities -> LBS.ByteString-encode_TwitterEntities oprot record = T.serializeVal oprot $ from_TwitterEntities record-to_TwitterEntities :: T.ThriftVal -> TwitterEntities-to_TwitterEntities (T.TStruct fields) = TwitterEntities{- twitterEntities_hashtagList = P.maybe (P.Nothing) (\(_,_val86) -> P.Just (case _val86 of {T.TList _ _val87 -> (Vector.fromList $ P.map (\_v88 -> (case _v88 of {T.TStruct _val89 -> (to_HashTag (T.TStruct _val89)); _ -> P.error "wrong type"})) _val87); _ -> P.error "wrong type"})) (Map.lookup (1) fields),- twitterEntities_urlList = P.maybe (P.Nothing) (\(_,_val86) -> P.Just (case _val86 of {T.TList _ _val90 -> (Vector.fromList $ P.map (\_v91 -> (case _v91 of {T.TStruct _val92 -> (to_URL (T.TStruct _val92)); _ -> P.error "wrong type"})) _val90); _ -> P.error "wrong type"})) (Map.lookup (2) fields),- twitterEntities_userMentionList = P.maybe (P.Nothing) (\(_,_val86) -> P.Just (case _val86 of {T.TList _ _val93 -> (Vector.fromList $ P.map (\_v94 -> (case _v94 of {T.TStruct _val95 -> (to_UserMention (T.TStruct _val95)); _ -> P.error "wrong type"})) _val93); _ -> P.error "wrong type"})) (Map.lookup (3) fields)- }-to_TwitterEntities _ = P.error "not a struct"-read_TwitterEntities :: (T.Transport t, T.Protocol p) => p t -> P.IO TwitterEntities-read_TwitterEntities iprot = to_TwitterEntities <$> T.readVal iprot (T.T_STRUCT typemap_TwitterEntities)-decode_TwitterEntities :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TwitterEntities-decode_TwitterEntities iprot bs = to_TwitterEntities $ T.deserializeVal iprot (T.T_STRUCT typemap_TwitterEntities) bs-typemap_TwitterEntities :: T.TypeMap-typemap_TwitterEntities = Map.fromList [(1,("hashtagList",(T.T_LIST (T.T_STRUCT typemap_HashTag)))),(2,("urlList",(T.T_LIST (T.T_STRUCT typemap_URL)))),(3,("userMentionList",(T.T_LIST (T.T_STRUCT typemap_UserMention))))]-default_TwitterEntities :: TwitterEntities-default_TwitterEntities = TwitterEntities{- twitterEntities_hashtagList = P.Nothing,- twitterEntities_urlList = P.Nothing,- twitterEntities_userMentionList = P.Nothing}-data TwitterPlace = TwitterPlace { twitterPlace_placeType :: P.Maybe LT.Text- , twitterPlace_countryCode :: P.Maybe LT.Text- , twitterPlace_country :: P.Maybe LT.Text- , twitterPlace_fullName :: P.Maybe LT.Text- , twitterPlace_name :: P.Maybe LT.Text- , twitterPlace_id :: P.Maybe LT.Text- , twitterPlace_url :: P.Maybe LT.Text- , twitterPlace_boundingBox :: P.Maybe BoundingBox- , twitterPlace_attributes :: P.Maybe PlaceAttributes- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TwitterPlace where- hashWithSalt salt record = salt `H.hashWithSalt` twitterPlace_placeType record `H.hashWithSalt` twitterPlace_countryCode record `H.hashWithSalt` twitterPlace_country record `H.hashWithSalt` twitterPlace_fullName record `H.hashWithSalt` twitterPlace_name record `H.hashWithSalt` twitterPlace_id record `H.hashWithSalt` twitterPlace_url record `H.hashWithSalt` twitterPlace_boundingBox record `H.hashWithSalt` twitterPlace_attributes record -instance QC.Arbitrary TwitterPlace where - arbitrary = M.liftM TwitterPlace (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TwitterPlace = []- | P.otherwise = M.catMaybes- [ if obj == default_TwitterPlace{twitterPlace_placeType = twitterPlace_placeType obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_placeType = twitterPlace_placeType obj}- , if obj == default_TwitterPlace{twitterPlace_countryCode = twitterPlace_countryCode obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_countryCode = twitterPlace_countryCode obj}- , if obj == default_TwitterPlace{twitterPlace_country = twitterPlace_country obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_country = twitterPlace_country obj}- , if obj == default_TwitterPlace{twitterPlace_fullName = twitterPlace_fullName obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_fullName = twitterPlace_fullName obj}- , if obj == default_TwitterPlace{twitterPlace_name = twitterPlace_name obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_name = twitterPlace_name obj}- , if obj == default_TwitterPlace{twitterPlace_id = twitterPlace_id obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_id = twitterPlace_id obj}- , if obj == default_TwitterPlace{twitterPlace_url = twitterPlace_url obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_url = twitterPlace_url obj}- , if obj == default_TwitterPlace{twitterPlace_boundingBox = twitterPlace_boundingBox obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_boundingBox = twitterPlace_boundingBox obj}- , if obj == default_TwitterPlace{twitterPlace_attributes = twitterPlace_attributes obj} then P.Nothing else P.Just $ default_TwitterPlace{twitterPlace_attributes = twitterPlace_attributes obj}- ]-from_TwitterPlace :: TwitterPlace -> T.ThriftVal-from_TwitterPlace record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v98 -> (1, ("placeType",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_placeType record- , (\_v98 -> (2, ("countryCode",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_countryCode record- , (\_v98 -> (3, ("country",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_country record- , (\_v98 -> (4, ("fullName",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_fullName record- , (\_v98 -> (5, ("name",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_name record- , (\_v98 -> (6, ("id",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_id record- , (\_v98 -> (7, ("url",T.TString $ E.encodeUtf8 _v98))) <$> twitterPlace_url record- , (\_v98 -> (8, ("boundingBox",from_BoundingBox _v98))) <$> twitterPlace_boundingBox record- , (\_v98 -> (9, ("attributes",from_PlaceAttributes _v98))) <$> twitterPlace_attributes record- ]-write_TwitterPlace :: (T.Protocol p, T.Transport t) => p t -> TwitterPlace -> P.IO ()-write_TwitterPlace oprot record = T.writeVal oprot $ from_TwitterPlace record-encode_TwitterPlace :: (T.Protocol p, T.Transport t) => p t -> TwitterPlace -> LBS.ByteString-encode_TwitterPlace oprot record = T.serializeVal oprot $ from_TwitterPlace record-to_TwitterPlace :: T.ThriftVal -> TwitterPlace-to_TwitterPlace (T.TStruct fields) = TwitterPlace{- twitterPlace_placeType = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val101 -> E.decodeUtf8 _val101; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- twitterPlace_countryCode = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val102 -> E.decodeUtf8 _val102; _ -> P.error "wrong type"})) (Map.lookup (2) fields),- twitterPlace_country = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val103 -> E.decodeUtf8 _val103; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- twitterPlace_fullName = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val104 -> E.decodeUtf8 _val104; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- twitterPlace_name = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val105 -> E.decodeUtf8 _val105; _ -> P.error "wrong type"})) (Map.lookup (5) fields),- twitterPlace_id = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val106 -> E.decodeUtf8 _val106; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- twitterPlace_url = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TString _val107 -> E.decodeUtf8 _val107; _ -> P.error "wrong type"})) (Map.lookup (7) fields),- twitterPlace_boundingBox = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TStruct _val108 -> (to_BoundingBox (T.TStruct _val108)); _ -> P.error "wrong type"})) (Map.lookup (8) fields),- twitterPlace_attributes = P.maybe (P.Nothing) (\(_,_val100) -> P.Just (case _val100 of {T.TStruct _val109 -> (to_PlaceAttributes (T.TStruct _val109)); _ -> P.error "wrong type"})) (Map.lookup (9) fields)- }-to_TwitterPlace _ = P.error "not a struct"-read_TwitterPlace :: (T.Transport t, T.Protocol p) => p t -> P.IO TwitterPlace-read_TwitterPlace iprot = to_TwitterPlace <$> T.readVal iprot (T.T_STRUCT typemap_TwitterPlace)-decode_TwitterPlace :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TwitterPlace-decode_TwitterPlace iprot bs = to_TwitterPlace $ T.deserializeVal iprot (T.T_STRUCT typemap_TwitterPlace) bs-typemap_TwitterPlace :: T.TypeMap-typemap_TwitterPlace = Map.fromList [(1,("placeType",T.T_STRING)),(2,("countryCode",T.T_STRING)),(3,("country",T.T_STRING)),(4,("fullName",T.T_STRING)),(5,("name",T.T_STRING)),(6,("id",T.T_STRING)),(7,("url",T.T_STRING)),(8,("boundingBox",(T.T_STRUCT typemap_BoundingBox))),(9,("attributes",(T.T_STRUCT typemap_PlaceAttributes)))]-default_TwitterPlace :: TwitterPlace-default_TwitterPlace = TwitterPlace{- twitterPlace_placeType = P.Nothing,- twitterPlace_countryCode = P.Nothing,- twitterPlace_country = P.Nothing,- twitterPlace_fullName = P.Nothing,- twitterPlace_name = P.Nothing,- twitterPlace_id = P.Nothing,- twitterPlace_url = P.Nothing,- twitterPlace_boundingBox = P.Nothing,- twitterPlace_attributes = P.Nothing}-data TwitterCoordinates = TwitterCoordinates { twitterCoordinates_type :: P.Maybe LT.Text- , twitterCoordinates_coordinates :: P.Maybe TwitterLatLong- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TwitterCoordinates where- hashWithSalt salt record = salt `H.hashWithSalt` twitterCoordinates_type record `H.hashWithSalt` twitterCoordinates_coordinates record -instance QC.Arbitrary TwitterCoordinates where - arbitrary = M.liftM TwitterCoordinates (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TwitterCoordinates = []- | P.otherwise = M.catMaybes- [ if obj == default_TwitterCoordinates{twitterCoordinates_type = twitterCoordinates_type obj} then P.Nothing else P.Just $ default_TwitterCoordinates{twitterCoordinates_type = twitterCoordinates_type obj}- , if obj == default_TwitterCoordinates{twitterCoordinates_coordinates = twitterCoordinates_coordinates obj} then P.Nothing else P.Just $ default_TwitterCoordinates{twitterCoordinates_coordinates = twitterCoordinates_coordinates obj}- ]-from_TwitterCoordinates :: TwitterCoordinates -> T.ThriftVal-from_TwitterCoordinates record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v112 -> (1, ("type",T.TString $ E.encodeUtf8 _v112))) <$> twitterCoordinates_type record- , (\_v112 -> (2, ("coordinates",from_TwitterLatLong _v112))) <$> twitterCoordinates_coordinates record- ]-write_TwitterCoordinates :: (T.Protocol p, T.Transport t) => p t -> TwitterCoordinates -> P.IO ()-write_TwitterCoordinates oprot record = T.writeVal oprot $ from_TwitterCoordinates record-encode_TwitterCoordinates :: (T.Protocol p, T.Transport t) => p t -> TwitterCoordinates -> LBS.ByteString-encode_TwitterCoordinates oprot record = T.serializeVal oprot $ from_TwitterCoordinates record-to_TwitterCoordinates :: T.ThriftVal -> TwitterCoordinates-to_TwitterCoordinates (T.TStruct fields) = TwitterCoordinates{- twitterCoordinates_type = P.maybe (P.Nothing) (\(_,_val114) -> P.Just (case _val114 of {T.TString _val115 -> E.decodeUtf8 _val115; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- twitterCoordinates_coordinates = P.maybe (P.Nothing) (\(_,_val114) -> P.Just (case _val114 of {T.TStruct _val116 -> (to_TwitterLatLong (T.TStruct _val116)); _ -> P.error "wrong type"})) (Map.lookup (2) fields)- }-to_TwitterCoordinates _ = P.error "not a struct"-read_TwitterCoordinates :: (T.Transport t, T.Protocol p) => p t -> P.IO TwitterCoordinates-read_TwitterCoordinates iprot = to_TwitterCoordinates <$> T.readVal iprot (T.T_STRUCT typemap_TwitterCoordinates)-decode_TwitterCoordinates :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TwitterCoordinates-decode_TwitterCoordinates iprot bs = to_TwitterCoordinates $ T.deserializeVal iprot (T.T_STRUCT typemap_TwitterCoordinates) bs-typemap_TwitterCoordinates :: T.TypeMap-typemap_TwitterCoordinates = Map.fromList [(1,("type",T.T_STRING)),(2,("coordinates",(T.T_STRUCT typemap_TwitterLatLong)))]-default_TwitterCoordinates :: TwitterCoordinates-default_TwitterCoordinates = TwitterCoordinates{- twitterCoordinates_type = P.Nothing,- twitterCoordinates_coordinates = P.Nothing}-data TweetInfo = TweetInfo { tweetInfo_id :: P.Maybe I.Int64- , tweetInfo_text :: P.Maybe LT.Text- , tweetInfo_createdAt :: P.Maybe LT.Text- , tweetInfo_user :: P.Maybe TwitterUser- , tweetInfo_truncated :: P.Maybe P.Bool- , tweetInfo_entities :: P.Maybe TwitterEntities- , tweetInfo_source :: P.Maybe LT.Text- , tweetInfo_coordinates :: P.Maybe TwitterCoordinates- , tweetInfo_place :: P.Maybe TwitterPlace- , tweetInfo_favorited :: P.Maybe P.Bool- , tweetInfo_retweeted :: P.Maybe P.Bool- , tweetInfo_retweetCount :: P.Maybe I.Int32- , tweetInfo_inReplyToScreenName :: P.Maybe LT.Text- , tweetInfo_inReplyToStatusId :: P.Maybe I.Int64- , tweetInfo_inReplyToUserId :: P.Maybe I.Int64- , tweetInfo_retweetedScreenName :: P.Maybe LT.Text- , tweetInfo_retweetedStatusId :: P.Maybe I.Int64- , tweetInfo_retweetedUserId :: P.Maybe I.Int64- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable TweetInfo where- hashWithSalt salt record = salt `H.hashWithSalt` tweetInfo_id record `H.hashWithSalt` tweetInfo_text record `H.hashWithSalt` tweetInfo_createdAt record `H.hashWithSalt` tweetInfo_user record `H.hashWithSalt` tweetInfo_truncated record `H.hashWithSalt` tweetInfo_entities record `H.hashWithSalt` tweetInfo_source record `H.hashWithSalt` tweetInfo_coordinates record `H.hashWithSalt` tweetInfo_place record `H.hashWithSalt` tweetInfo_favorited record `H.hashWithSalt` tweetInfo_retweeted record `H.hashWithSalt` tweetInfo_retweetCount record `H.hashWithSalt` tweetInfo_inReplyToScreenName record `H.hashWithSalt` tweetInfo_inReplyToStatusId record `H.hashWithSalt` tweetInfo_inReplyToUserId record `H.hashWithSalt` tweetInfo_retweetedScreenName record `H.hashWithSalt` tweetInfo_retweetedStatusId record `H.hashWithSalt` tweetInfo_retweetedUserId record -instance QC.Arbitrary TweetInfo where - arbitrary = M.liftM TweetInfo (M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- `M.ap`(M.liftM P.Just QC.arbitrary)- shrink obj | obj == default_TweetInfo = []- | P.otherwise = M.catMaybes- [ if obj == default_TweetInfo{tweetInfo_id = tweetInfo_id obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_id = tweetInfo_id obj}- , if obj == default_TweetInfo{tweetInfo_text = tweetInfo_text obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_text = tweetInfo_text obj}- , if obj == default_TweetInfo{tweetInfo_createdAt = tweetInfo_createdAt obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_createdAt = tweetInfo_createdAt obj}- , if obj == default_TweetInfo{tweetInfo_user = tweetInfo_user obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_user = tweetInfo_user obj}- , if obj == default_TweetInfo{tweetInfo_truncated = tweetInfo_truncated obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_truncated = tweetInfo_truncated obj}- , if obj == default_TweetInfo{tweetInfo_entities = tweetInfo_entities obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_entities = tweetInfo_entities obj}- , if obj == default_TweetInfo{tweetInfo_source = tweetInfo_source obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_source = tweetInfo_source obj}- , if obj == default_TweetInfo{tweetInfo_coordinates = tweetInfo_coordinates obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_coordinates = tweetInfo_coordinates obj}- , if obj == default_TweetInfo{tweetInfo_place = tweetInfo_place obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_place = tweetInfo_place obj}- , if obj == default_TweetInfo{tweetInfo_favorited = tweetInfo_favorited obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_favorited = tweetInfo_favorited obj}- , if obj == default_TweetInfo{tweetInfo_retweeted = tweetInfo_retweeted obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_retweeted = tweetInfo_retweeted obj}- , if obj == default_TweetInfo{tweetInfo_retweetCount = tweetInfo_retweetCount obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_retweetCount = tweetInfo_retweetCount obj}- , if obj == default_TweetInfo{tweetInfo_inReplyToScreenName = tweetInfo_inReplyToScreenName obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_inReplyToScreenName = tweetInfo_inReplyToScreenName obj}- , if obj == default_TweetInfo{tweetInfo_inReplyToStatusId = tweetInfo_inReplyToStatusId obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_inReplyToStatusId = tweetInfo_inReplyToStatusId obj}- , if obj == default_TweetInfo{tweetInfo_inReplyToUserId = tweetInfo_inReplyToUserId obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_inReplyToUserId = tweetInfo_inReplyToUserId obj}- , if obj == default_TweetInfo{tweetInfo_retweetedScreenName = tweetInfo_retweetedScreenName obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_retweetedScreenName = tweetInfo_retweetedScreenName obj}- , if obj == default_TweetInfo{tweetInfo_retweetedStatusId = tweetInfo_retweetedStatusId obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_retweetedStatusId = tweetInfo_retweetedStatusId obj}- , if obj == default_TweetInfo{tweetInfo_retweetedUserId = tweetInfo_retweetedUserId obj} then P.Nothing else P.Just $ default_TweetInfo{tweetInfo_retweetedUserId = tweetInfo_retweetedUserId obj}- ]-from_TweetInfo :: TweetInfo -> T.ThriftVal-from_TweetInfo record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v119 -> (1, ("id",T.TI64 _v119))) <$> tweetInfo_id record- , (\_v119 -> (3, ("text",T.TString $ E.encodeUtf8 _v119))) <$> tweetInfo_text record- , (\_v119 -> (4, ("createdAt",T.TString $ E.encodeUtf8 _v119))) <$> tweetInfo_createdAt record- , (\_v119 -> (5, ("user",from_TwitterUser _v119))) <$> tweetInfo_user record- , (\_v119 -> (6, ("truncated",T.TBool _v119))) <$> tweetInfo_truncated record- , (\_v119 -> (7, ("entities",from_TwitterEntities _v119))) <$> tweetInfo_entities record- , (\_v119 -> (8, ("source",T.TString $ E.encodeUtf8 _v119))) <$> tweetInfo_source record- , (\_v119 -> (9, ("coordinates",from_TwitterCoordinates _v119))) <$> tweetInfo_coordinates record- , (\_v119 -> (11, ("place",from_TwitterPlace _v119))) <$> tweetInfo_place record- , (\_v119 -> (12, ("favorited",T.TBool _v119))) <$> tweetInfo_favorited record- , (\_v119 -> (13, ("retweeted",T.TBool _v119))) <$> tweetInfo_retweeted record- , (\_v119 -> (14, ("retweetCount",T.TI32 _v119))) <$> tweetInfo_retweetCount record- , (\_v119 -> (15, ("inReplyToScreenName",T.TString $ E.encodeUtf8 _v119))) <$> tweetInfo_inReplyToScreenName record- , (\_v119 -> (16, ("inReplyToStatusId",T.TI64 _v119))) <$> tweetInfo_inReplyToStatusId record- , (\_v119 -> (18, ("inReplyToUserId",T.TI64 _v119))) <$> tweetInfo_inReplyToUserId record- , (\_v119 -> (19, ("retweetedScreenName",T.TString $ E.encodeUtf8 _v119))) <$> tweetInfo_retweetedScreenName record- , (\_v119 -> (20, ("retweetedStatusId",T.TI64 _v119))) <$> tweetInfo_retweetedStatusId record- , (\_v119 -> (21, ("retweetedUserId",T.TI64 _v119))) <$> tweetInfo_retweetedUserId record- ]-write_TweetInfo :: (T.Protocol p, T.Transport t) => p t -> TweetInfo -> P.IO ()-write_TweetInfo oprot record = T.writeVal oprot $ from_TweetInfo record-encode_TweetInfo :: (T.Protocol p, T.Transport t) => p t -> TweetInfo -> LBS.ByteString-encode_TweetInfo oprot record = T.serializeVal oprot $ from_TweetInfo record-to_TweetInfo :: T.ThriftVal -> TweetInfo-to_TweetInfo (T.TStruct fields) = TweetInfo{- tweetInfo_id = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TI64 _val122 -> _val122; _ -> P.error "wrong type"})) (Map.lookup (1) fields),- tweetInfo_text = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TString _val123 -> E.decodeUtf8 _val123; _ -> P.error "wrong type"})) (Map.lookup (3) fields),- tweetInfo_createdAt = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TString _val124 -> E.decodeUtf8 _val124; _ -> P.error "wrong type"})) (Map.lookup (4) fields),- tweetInfo_user = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TStruct _val125 -> (to_TwitterUser (T.TStruct _val125)); _ -> P.error "wrong type"})) (Map.lookup (5) fields),- tweetInfo_truncated = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TBool _val126 -> _val126; _ -> P.error "wrong type"})) (Map.lookup (6) fields),- tweetInfo_entities = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TStruct _val127 -> (to_TwitterEntities (T.TStruct _val127)); _ -> P.error "wrong type"})) (Map.lookup (7) fields),- tweetInfo_source = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TString _val128 -> E.decodeUtf8 _val128; _ -> P.error "wrong type"})) (Map.lookup (8) fields),- tweetInfo_coordinates = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TStruct _val129 -> (to_TwitterCoordinates (T.TStruct _val129)); _ -> P.error "wrong type"})) (Map.lookup (9) fields),- tweetInfo_place = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TStruct _val130 -> (to_TwitterPlace (T.TStruct _val130)); _ -> P.error "wrong type"})) (Map.lookup (11) fields),- tweetInfo_favorited = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TBool _val131 -> _val131; _ -> P.error "wrong type"})) (Map.lookup (12) fields),- tweetInfo_retweeted = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TBool _val132 -> _val132; _ -> P.error "wrong type"})) (Map.lookup (13) fields),- tweetInfo_retweetCount = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TI32 _val133 -> _val133; _ -> P.error "wrong type"})) (Map.lookup (14) fields),- tweetInfo_inReplyToScreenName = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TString _val134 -> E.decodeUtf8 _val134; _ -> P.error "wrong type"})) (Map.lookup (15) fields),- tweetInfo_inReplyToStatusId = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TI64 _val135 -> _val135; _ -> P.error "wrong type"})) (Map.lookup (16) fields),- tweetInfo_inReplyToUserId = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TI64 _val136 -> _val136; _ -> P.error "wrong type"})) (Map.lookup (18) fields),- tweetInfo_retweetedScreenName = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TString _val137 -> E.decodeUtf8 _val137; _ -> P.error "wrong type"})) (Map.lookup (19) fields),- tweetInfo_retweetedStatusId = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TI64 _val138 -> _val138; _ -> P.error "wrong type"})) (Map.lookup (20) fields),- tweetInfo_retweetedUserId = P.maybe (P.Nothing) (\(_,_val121) -> P.Just (case _val121 of {T.TI64 _val139 -> _val139; _ -> P.error "wrong type"})) (Map.lookup (21) fields)- }-to_TweetInfo _ = P.error "not a struct"-read_TweetInfo :: (T.Transport t, T.Protocol p) => p t -> P.IO TweetInfo-read_TweetInfo iprot = to_TweetInfo <$> T.readVal iprot (T.T_STRUCT typemap_TweetInfo)-decode_TweetInfo :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> TweetInfo-decode_TweetInfo iprot bs = to_TweetInfo $ T.deserializeVal iprot (T.T_STRUCT typemap_TweetInfo) bs-typemap_TweetInfo :: T.TypeMap-typemap_TweetInfo = Map.fromList [(1,("id",T.T_I64)),(3,("text",T.T_STRING)),(4,("createdAt",T.T_STRING)),(5,("user",(T.T_STRUCT typemap_TwitterUser))),(6,("truncated",T.T_BOOL)),(7,("entities",(T.T_STRUCT typemap_TwitterEntities))),(8,("source",T.T_STRING)),(9,("coordinates",(T.T_STRUCT typemap_TwitterCoordinates))),(11,("place",(T.T_STRUCT typemap_TwitterPlace))),(12,("favorited",T.T_BOOL)),(13,("retweeted",T.T_BOOL)),(14,("retweetCount",T.T_I32)),(15,("inReplyToScreenName",T.T_STRING)),(16,("inReplyToStatusId",T.T_I64)),(18,("inReplyToUserId",T.T_I64)),(19,("retweetedScreenName",T.T_STRING)),(20,("retweetedStatusId",T.T_I64)),(21,("retweetedUserId",T.T_I64))]-default_TweetInfo :: TweetInfo-default_TweetInfo = TweetInfo{- tweetInfo_id = P.Nothing,- tweetInfo_text = P.Nothing,- tweetInfo_createdAt = P.Nothing,- tweetInfo_user = P.Nothing,- tweetInfo_truncated = P.Nothing,- tweetInfo_entities = P.Nothing,- tweetInfo_source = P.Nothing,- tweetInfo_coordinates = P.Nothing,- tweetInfo_place = P.Nothing,- tweetInfo_favorited = P.Nothing,- tweetInfo_retweeted = P.Nothing,- tweetInfo_retweetCount = P.Nothing,- tweetInfo_inReplyToScreenName = P.Nothing,- tweetInfo_inReplyToStatusId = P.Nothing,- tweetInfo_inReplyToUserId = P.Nothing,- tweetInfo_retweetedScreenName = P.Nothing,- tweetInfo_retweetedStatusId = P.Nothing,- tweetInfo_retweetedUserId = P.Nothing}
− src/Uuid_Consts.hs
@@ -1,41 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Uuid_Consts where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---import Uuid_Types
− src/Uuid_Types.hs
@@ -1,72 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-fields #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-{-# OPTIONS_GHC -fno-warn-unused-matches #-}---------------------------------------------------------------------- Autogenerated by Thrift Compiler (0.10.0) ----- ----- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING ----------------------------------------------------------------------module Uuid_Types where-import Prelude (($), (.), (>>=), (==), (++))-import qualified Prelude as P-import qualified Control.Exception as X-import qualified Control.Monad as M ( liftM, ap, when )-import Data.Functor ( (<$>) )-import qualified Data.ByteString.Lazy as LBS-import qualified Data.Hashable as H-import qualified Data.Int as I-import qualified Data.Maybe as M (catMaybes)-import qualified Data.Text.Lazy.Encoding as E ( decodeUtf8, encodeUtf8 )-import qualified Data.Text.Lazy as LT-import qualified GHC.Generics as G (Generic)-import qualified Data.Typeable as TY ( Typeable )-import qualified Data.HashMap.Strict as Map-import qualified Data.HashSet as Set-import qualified Data.Vector as Vector-import qualified Test.QuickCheck.Arbitrary as QC ( Arbitrary(..) )-import qualified Test.QuickCheck as QC ( elements )--import qualified Thrift as T-import qualified Thrift.Types as T-import qualified Thrift.Arbitraries as T---data UUID = UUID { uUID_uuidString :: LT.Text- } deriving (P.Show,P.Eq,G.Generic,TY.Typeable)-instance H.Hashable UUID where- hashWithSalt salt record = salt `H.hashWithSalt` uUID_uuidString record -instance QC.Arbitrary UUID where - arbitrary = M.liftM UUID (QC.arbitrary)- shrink obj | obj == default_UUID = []- | P.otherwise = M.catMaybes- [ if obj == default_UUID{uUID_uuidString = uUID_uuidString obj} then P.Nothing else P.Just $ default_UUID{uUID_uuidString = uUID_uuidString obj}- ]-from_UUID :: UUID -> T.ThriftVal-from_UUID record = T.TStruct $ Map.fromList $ M.catMaybes- [ (\_v2 -> P.Just (1, ("uuidString",T.TString $ E.encodeUtf8 _v2))) $ uUID_uuidString record- ]-write_UUID :: (T.Protocol p, T.Transport t) => p t -> UUID -> P.IO ()-write_UUID oprot record = T.writeVal oprot $ from_UUID record-encode_UUID :: (T.Protocol p, T.Transport t) => p t -> UUID -> LBS.ByteString-encode_UUID oprot record = T.serializeVal oprot $ from_UUID record-to_UUID :: T.ThriftVal -> UUID-to_UUID (T.TStruct fields) = UUID{- uUID_uuidString = P.maybe (P.error "Missing required field: uuidString") (\(_,_val4) -> (case _val4 of {T.TString _val5 -> E.decodeUtf8 _val5; _ -> P.error "wrong type"})) (Map.lookup (1) fields)- }-to_UUID _ = P.error "not a struct"-read_UUID :: (T.Transport t, T.Protocol p) => p t -> P.IO UUID-read_UUID iprot = to_UUID <$> T.readVal iprot (T.T_STRUCT typemap_UUID)-decode_UUID :: (T.Protocol p, T.Transport t) => p t -> LBS.ByteString -> UUID-decode_UUID iprot bs = to_UUID $ T.deserializeVal iprot (T.T_STRUCT typemap_UUID) bs-typemap_UUID :: T.TypeMap-typemap_UUID = Map.fromList [(1,("uuidString",T.T_STRING))]-default_UUID :: UUID-default_UUID = UUID{- uUID_uuidString = ""}
+ tests/TestIngesters.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE OverloadedStrings #-}+module Main (main) where++import Data.ByteString.Lazy (ByteString)+import qualified Data.ByteString.Lazy as BS+import Data.Map (toList, (!), keys)+import Data.Monoid ((<>))+import Data.List (intercalate)+import Control.Monad (void, join, liftM)+import Data.Text.Lazy (Text, unpack, take)+import qualified Data.Text.Lazy as T+import Data.Text.Lazy.Encoding (decodeUtf8)+import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn)+import System.FilePath (takeExtension)+import qualified Codec.Compression.GZip as GZip+import Data.Concrete.Utils (writeCommunication, showCommunication)+import Data.Concrete.Parsers.Types (CommunicationParser)+import Data.Concrete.Parsers (communicationParsers, ingest)+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+import Text.Printf (printf)++testFormat :: (String, (desc, CommunicationParser (), [String], String)) -> IO ()+testFormat (f, (d, p, c, i)) = do+ let fname = printf "tests/data/example.%s.gz" f :: String+ ih <- (liftM GZip.decompress . BS.readFile) fname+ putStrLn fname+ putStrLn "***********************\n"+ ingest (\x -> putStrLn $ unpack $ T.concat [showCommunication x, "\n"]) p (decodeUtf8 ih) c i "concrete-haskell unit test data"+ return ()++main = putStrLn "\nTesting parsers:" >> (sequence $ map testFormat (communicationParsers))
+ tests/TestSerialization.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE OverloadedStrings #-}+module Main (main) where++import Data.ByteString.Lazy (ByteString)+import qualified Data.ByteString.Lazy as BS+import Data.Map (toList, (!), keys)+import Data.Monoid ((<>))+import Data.List (intercalate)+import Control.Monad (void, join, liftM)+import Data.Text.Lazy (Text, unpack, take)+import qualified Data.Text.Lazy as T+import Data.Text.Lazy.Encoding (decodeUtf8)+import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn)+import System.FilePath (takeExtension)+import qualified Codec.Compression.GZip as GZip+import Data.Concrete.Utils (writeCommunication, showCommunication)+import Data.Concrete.Parsers.Types (CommunicationParser)+import Data.Concrete.Parsers (communicationParsers, ingest)+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+import Text.Printf (printf)++main = return ()
− tests/UnitTests.hs
@@ -1,30 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-module Main (main) where--import Data.ByteString.Lazy (ByteString)-import qualified Data.ByteString.Lazy as BS-import Data.Map (toList, (!), keys)-import Data.Monoid ((<>))-import Data.List (intercalate)-import Control.Monad (void, join, liftM)-import Data.Text.Lazy (Text, unpack, take)-import Data.Text.Lazy.Encoding (decodeUtf8)-import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn)-import System.FilePath (takeExtension)-import qualified Codec.Compression.GZip as GZip-import Data.Concrete.Utils (writeCommunication, showCommunication)-import Data.Concrete.Parsers.Types (CommunicationParser)-import Data.Concrete.Parsers (communicationParsers, ingest)-import Data.Concrete (Communication(..))-import Text.Printf (printf)--testFormat :: (String, (desc, CommunicationParser (), [String], String)) -> IO ()-testFormat (f, (d, p, c, i)) = do- let fname = printf "tests/data/example.%s.gz" f :: String- ih <- (liftM GZip.decompress . BS.readFile) fname- putStrLn fname- ingest (\x -> putStrLn $ unpack $ showCommunication x) p (decodeUtf8 ih) c i "concrete-haskell unit test data"- --["catchphrase", "name", "age", "relatives.0.name", "favorites.friend.name"] "test_id_${name}_${}" "test_comm" - return ()--main = putStrLn "\nTesting parsers:" >> (sequence $ map testFormat (communicationParsers))
+ utils/FetchService.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE ExplicitNamespaces #-}++module Main (main) where++import System.FilePath (takeExtension)+import Data.Concrete.Services.Fetch (ZipFetch(..), TarFetch(..), HandleFetch(..), process, makeTarFetch)+import Data.Concrete.Services (runConcreteService, Compression(..))+import Options.Generic (Generic, ParseRecord, Unwrapped, Wrapped, unwrapRecord, (:::), type (<?>)(..))+import System.IO (openFile, IOMode(..))+import Control.Monad (liftM)++data Parameters w = Parameters { file :: w ::: String <?> "File to fetch Communications from"+ , port :: w ::: Int <?> "Port for a FetchCommunicationService"+ } deriving (Generic)++instance ParseRecord (Parameters Wrapped)+deriving instance Show (Parameters Unwrapped)++main = do+ ps <- unwrapRecord "Run a file-backed Store service: supports .tar and .tgz"+ let f = file ps + h <- makeTarFetch f+ runConcreteService (port ps) h process
utils/IngestCommunications.hs view
@@ -20,20 +20,21 @@ import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn, hClose) import System.FilePath (takeExtension) import qualified Codec.Compression.GZip as GZip-import Data.Concrete.Utils (writeCommunication, sendCommunication, connectToService)-import Data.Concrete (default_Communication)+import Data.Concrete.Utils (writeCommunication)+import Data.Concrete.Services (connectToService)+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..)) import qualified Data.Concrete.Utils as CU import Data.Concrete.Parsers.Types (CommunicationParser) import Data.Concrete.Parsers (communicationParsers, ingest)-import qualified Data.Concrete.Services.StoreCommunicationService_Client as StoreService-import qualified Data.Concrete.Services.Service_Client as Service+import qualified Data.Concrete.Autogen.StoreCommunicationService_Client as StoreService+import qualified Data.Concrete.Autogen.Service_Client as Service import Options.Generic data Parameters w = Parameters { inputFile :: w ::: Maybe String <?> "Input file, possibly compressed (.bz2 or .gz)" , commType :: w ::: String <?> "Value for the 'type' field of each Communication" , commId :: w ::: String <?> "Template for the 'id' field of each Communication" , contentSectionTypes :: w ::: [String] <?> "Section types that should count as 'content' rather than 'metadata'"- , format :: w ::: String <?> "Input format: (JSON, CSV, PTB)"+ , format :: w ::: String <?> "Input format: (JSON, JSON-LINE, CSV)" , outputFile :: w ::: Maybe String <?> "An output file (.txt, .gz, .bz2, .tgz, .tbz2, .zip)" , host :: w ::: Maybe String <?> "Host name for a StoreCommunicationService" , port :: w ::: Maybe Int <?> "Port for a StoreCommunicationService"@@ -52,13 +53,12 @@ let (_, cp, _, _) = (Map.fromList communicationParsers) ! (format ps) cb <- case (outputFile ps, host ps, port ps) of (Just f, Nothing, Nothing) -> case takeExtension f of- "gz" -> writeCommunication <$> openFile f WriteMode- "bz2" -> writeCommunication <$> openFile f WriteMode+ ".gz" -> writeCommunication <$> openFile f WriteMode+ ".bz2" -> writeCommunication <$> openFile f WriteMode _ -> writeCommunication <$> openFile f WriteMode (Nothing, Just h, Just p) -> do con <- connectToService h p return $ StoreService.store con (Nothing, Nothing, Nothing) -> return $ writeCommunication stdout- _ -> error "Specify either an output file, a host and port, or nothing (for stdout)"- cs <- ingest cb cp (decodeUtf8 ih) (contentSectionTypes ps) (commId ps) (commType ps)- return ()+ _ -> error "Specify either an output file, a host and port, or nothing (for stdout)" + ingest cb cp (decodeUtf8 ih) (contentSectionTypes ps) (commId ps) (commType ps)
− utils/InspectCommunication.hs
@@ -1,43 +0,0 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# LANGUAGE TypeOperators #-}--module Main (main) where--import Data.Monoid ((<>))-import qualified Data.ByteString.Lazy as BS-import qualified Codec.Compression.GZip as GZip-import qualified Codec.Compression.BZip as BZip-import qualified Data.Concrete.Utils as CU-import qualified Data.Concrete as C-import qualified Data.Vector as V-import Control.Monad (liftM, mapM, join)-import Data.List (intercalate, concat)-import qualified Data.Text.Lazy as T-import Data.Maybe (fromJust, catMaybes, maybeToList)-import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn)-import System.FilePath (takeExtension)-import Options.Generic--data Parameters w = Parameters { inputFile :: w ::: Maybe String <?> "Input file, possibly compressed (.bz2 or .gz)"- } deriving (Generic)--instance ParseRecord (Parameters Wrapped)-deriving instance Show (Parameters Unwrapped)--main = do- ps <- unwrapRecord "Inspect Concrete Communications"- cs <- join $ case inputFile ps of- Just f -> case takeExtension f of- ".tar" -> CU.readCommunicationsFromTar <$> (BS.readFile f)- ".tgz" -> CU.readCommunicationsFromTar <$> ((liftM GZip.decompress . BS.readFile) f)- ".tbz2" -> CU.readCommunicationsFromTar <$> ((liftM BZip.decompress . BS.readFile) f)- ".zip" -> return $ CU.readCommunicationsFromZip f- ".bz2" -> CU.readCommunicationsFromBytes <$> ((liftM BZip.decompress . BS.readFile) f)- ".gz" -> CU.readCommunicationsFromBytes <$> ((liftM GZip.decompress . BS.readFile) f)- _ -> CU.readCommunicationsFromBytes <$> (BS.readFile f)- Nothing -> CU.readCommunicationsFromBytes <$> (BS.hGetContents stdin)- putStr $ (T.unpack . T.concat) $ map CU.showCommunication cs
+ utils/InspectCommunications.hs view
@@ -0,0 +1,64 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeOperators #-}++module Main (main) where++import Data.Monoid ((<>))+import qualified Data.ByteString.Lazy as BS+import qualified Codec.Compression.GZip as GZip+import qualified Codec.Compression.BZip as BZip+import qualified Data.Concrete.Utils as CU+import Data.Concrete.Autogen.Communication_Types (default_Communication, Communication(..))+import qualified Data.Concrete.Autogen.FetchCommunicationService_Client as FetchService+import Data.Concrete.Autogen.Access_Types (FetchRequest(..))+import Data.Concrete.Services (connectToService)+import qualified Data.Vector as V+import Control.Monad (liftM, mapM, join)+import Data.List (intercalate, concat)+import qualified Data.Text.Lazy as T+import Data.Maybe (fromJust, catMaybes, maybeToList, fromMaybe)+import System.IO (stdin, stdout, stderr, openFile, Handle, IOMode(..), hPutStrLn)+import System.FilePath (takeExtension)+import Options.Generic++data Parameters w = Parameters { inputFile :: w ::: Maybe String <?> "Input file, possibly compressed (.bz2 or .gz)"+ , start :: w ::: Maybe Int <?> "Index of first Communication to show"+ , end :: w ::: Maybe Int <?> "Index of last Communication to show"+ , host :: w ::: Maybe String <?> "Host name for FetchCommunicationService"+ , port :: w ::: Maybe Int <?> "Port number for FetchCommunicationService" + }+ deriving (Generic)++instance ParseRecord (Parameters Wrapped)+deriving instance Show (Parameters Unwrapped)++main = do+ ps <- unwrapRecord "Inspect Concrete Communications"+ let s = start ps+ e = end ps+ cb = (\x -> (putStrLn . T.unpack) (CU.showCommunication x))+ cs <- case inputFile ps of+ Nothing -> do+ con <- connectToService ((fromMaybe "0.0.0.0" . host) ps) ((fromMaybe 9090 . port) ps)+ c <- FetchService.getCommunicationCount con+ print c+ l <- FetchService.getCommunicationIDs con 0 c+ --print l+ c' <- FetchService.fetch con (FetchRequest (V.drop 50 l) Nothing)+ print c'+ return ()+ Just f -> case takeExtension f of+ --".tar" -> CU.readCommunicationsFromTar <$> (BS.readFile f)+ --".tgz" -> CU.readCommunicationsFromTar <$> ((liftM GZip.decompress . BS.readFile) f)+ --".tbz2" -> CU.readCommunicationsFromTar <$> ((liftM BZip.decompress . BS.readFile) f)+ --".zip" -> return $ CU.readCommunicationsFromZip f+ --".bz2" -> CU.mapCommunicationsFromBytes cb s e <$> ((liftM BZip.decompress . BS.readFile) f)+ --".gz" -> CU.mapCommunicationsFromBytes cb s e <$> ((liftM GZip.decompress . BS.readFile) f)+ _ -> error "unimplemented" --CU.mapCommunicationsFromBytes cb s e <$> (BS.readFile f)+ --Nothing -> CU.readCommunicationsFromBytes <$> (BS.hGetContents stdin)+ return ()+
+ utils/StoreService.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE ExplicitNamespaces #-}++module Main (main) where++import System.FilePath (takeExtension)+import Data.Concrete.Services.Store (ZipStore(..), TarStore(..), HandleStore(..), process, makeTarStore)+import Data.Concrete.Services (runConcreteService, Compression(..))+import Options.Generic (Generic, ParseRecord, Unwrapped, Wrapped, unwrapRecord, (:::), type (<?>)(..))+import System.IO (openFile, IOMode(..))+import Control.Monad (liftM)++data Parameters w = Parameters { file :: w ::: String <?> "File to store Communications in"+ , port :: w ::: Int <?> "Port for a StoreCommunicationService"+ } deriving (Generic)++instance ParseRecord (Parameters Wrapped)+deriving instance Show (Parameters Unwrapped)++main = do+ ps <- unwrapRecord "Run a file-backed Store service: supports .tar and .tgz"+ let f = file ps+ h <- makeTarStore f+ runConcreteService (port ps) h process